I am creating a launch configuration for a an auto scaling group.
WebAppLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
UserData: !Base64 |
#!/bin/bash
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
sudo su
apt-get update -y
apt-get install unzip awscli -y
apt-get install apache2 -y
systemctl start apache2.service
cd /var/www/html
aws s3 cp s3://udacity-demo-1/udacity.zip .
unzip -o udacity.zip
/bin/echo "Hello World" >> /tmp/testfile.txt
IamInstanceProfile:
Ref: "ProfileWithRolesForOurApp"
KeyName: UdacityCFNEC2Key
ImageId: ami-005bdb005fb00e791
SecurityGroups:
- Ref: WebServerSecGroup
InstanceType: t3.medium
BlockDeviceMappings:
- DeviceName: "/dev/sdk"
Ebs:
VolumeSize: '10'
I put the server in a public subnet to simply ssh in and confirm if Apache started and I can see it is not. When I try to run the start command I get an error that httpd.conf file does not exist.
What am I doing wrong here?
The closest question I found is: Using userdata in Cloudformation where they are discussing the type of ami and I have been able to export the userdata logs to the console successfully and I am using and ubuntu ami so I think this is not a similar problem.