Created
January 12, 2015 21:19
-
-
Save adammck/b2eab1c0eda055ed3948 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import sys | |
import urllib2 | |
from datetime import datetime | |
print "# Generated by %s at %s" % (sys.argv[0], datetime.now()) | |
USER_DATA_URL = "http://169.254.169.254/latest/user-data" | |
res = urllib2.urlopen(USER_DATA_URL) | |
for line in res.readlines(): | |
key, val = re.split(r'\s*=\s*', line.strip(), 1) | |
print 'export %s="%s"' % (key.upper(), val) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment