I'm trying to make a Launch Configuration for my AWS Cloud Environment.
I wan't to install httpd and start it up on the fly, when the autoscaling group spins up a new EC2 instance.
I can SSH into the instance manually and install httpd with: sudo yum update -y sudo yum install httpd -y sudo service httpd start
But I can't make it happen, with the Launch Configuration under Advance Details -> User Data sudo yum update -y sudo yum install httpd -y sudo service httpd start
Any ideas why it's not the same?
Update
After adding #!/bin/bash
as @Mark-B suggested, then service is kindda installed. It gives the following error when restarting the service. Maybe it could be a hint for you, to figure out what is wrong?