title: AWS EC2 set environment variables
body: <p>I am deploying my code to AWS EC2.  The documentation says there's something called "user data" or "user data scripts" that you can enter this info when you're launching an ec2 instance and the script will be executed at instance startup.  </p>
  
  <p><a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts" rel="nofollow noreferrer">http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts</a></p>
  
  <p>the following is in my user data script: </p>
  
  <pre><code>#!/bin/bash
  echo 1111 &gt;&gt; /home/ubuntu/1111.txt
  export MONGODB_HOST=www.mongodb.com
  export MONGODB_PORT=12345
  export MONGODB_USER=user
  export MONGODB_PASS=pass
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/r9pdG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r9pdG.png" alt="enter image description here"></a></p>
  
  <p>So when I launch the instance with this user data script I would expect to see the environment variables being set, but it didn't. </p>
  
  <p>So is there something that I did wrong?  </p>