title: AWS EC2 - yum update does not work in AutoScaling LaunchConfig UserData
body: <p>I can successfully run <code>sudo yum update</code> 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 <code>/var/log/cloud-init-output.log</code>):</p>
  
  <pre><code>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:
  </code></pre>
  
  <p>My script:</p>
  
  <pre><code>#!/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 &gt;&gt; out.log
  </code></pre>
  
  <p>How can I run yum commands at EC2 instance startup?</p>