I can successfully run sudo yum update
when ssh-ing to my EC2 instance. However, when I attach the same command to the userData of my launch configuration, I see the following error (in /var/log/cloud-init-output.log
):
launch script..
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
My script:
#!/bin/bash
echo "launch script.."
sudo yum update -y
sudo yum install java-1.8.0 -y
aws s3 cp s3://bucket/app.jar ./app.jar
java -jar app.jar >> out.log
How can I run yum commands at EC2 instance startup?