From cb9862f5b0157b143bc99a7d702b4b5e6696c0f8 Mon Sep 17 00:00:00 2001 From: Dan Spangenberger Date: Mon, 29 Jun 2015 14:42:41 -0400 Subject: [PATCH] Fix issue requesting current EC2 role EC2 appears to have changed how you access the collection members of instance metadata--you know need a `/` after each collection to list them: ``` curl http://169.254.169.254/latest/meta-data/iam/security-credentials # nothing curl http://169.254.169.254/latest/meta-data/iam/security-credentials/ ec2-staging-es ``` --- util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.py b/util.py index 9823f38d10..fe04351772 100644 --- a/util.py +++ b/util.py @@ -333,7 +333,7 @@ def get_tags(agentConfig): pass try: - iam_role = urllib2.urlopen(EC2.METADATA_URL_BASE + "/iam/security-credentials").read().strip() + iam_role = urllib2.urlopen(EC2.METADATA_URL_BASE + "/iam/security-credentials/").read().strip() iam_params = json.loads(urllib2.urlopen(EC2.METADATA_URL_BASE + "/iam/security-credentials" + "/" + unicode(iam_role)).read().strip()) instance_identity = json.loads(urllib2.urlopen(EC2.INSTANCE_IDENTITY_URL).read().strip()) region = instance_identity['region']