{"action":"closed","issue":{"url":"https://api.github.com/repos/boto/boto3/issues/1226","repository_url":"https://api.github.com/repos/boto/boto3","labels_url":"https://api.github.com/repos/boto/boto3/issues/1226/labels{/name}","comments_url":"https://api.github.com/repos/boto/boto3/issues/1226/comments","events_url":"https://api.github.com/repos/boto/boto3/issues/1226/events","html_url":"https://github.com/boto/boto3/issues/1226","id":250082745,"number":1226,"title":"Exporting login credentials to environment","user":{"login":"roryai","id":18268474,"avatar_url":"https://avatars3.githubusercontent.com/u/18268474?v=4","gravatar_id":"","url":"https://api.github.com/users/roryai","html_url":"https://github.com/roryai","followers_url":"https://api.github.com/users/roryai/followers","following_url":"https://api.github.com/users/roryai/following{/other_user}","gists_url":"https://api.github.com/users/roryai/gists{/gist_id}","starred_url":"https://api.github.com/users/roryai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roryai/subscriptions","organizations_url":"https://api.github.com/users/roryai/orgs","repos_url":"https://api.github.com/users/roryai/repos","events_url":"https://api.github.com/users/roryai/events{/privacy}","received_events_url":"https://api.github.com/users/roryai/received_events","type":"User","site_admin":false},"labels":[{"id":217065744,"url":"https://api.github.com/repos/boto/boto3/labels/closing-soon-if-no-response","name":"closing-soon-if-no-response","color":"5319e7","default":false},{"id":134690911,"url":"https://api.github.com/repos/boto/boto3/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-08-14T16:24:27Z","updated_at":"2017-08-28T16:15:51Z","closed_at":"2017-08-28T16:15:51Z","body":"I have written a python script to check the health of my ELBs.\r\n\r\nI am running the script from a VM.\r\n\r\nI need to log in and assume a role before I can check the state of the ELBs.\r\n\r\nWhen I was running this program on my machine, I would assume a role in the shell and then run my program in that shell. I need to do the same process on my VM but am encountering difficulty.\r\n\r\nMy code for logging in and assuming a role is here:\r\n\r\n```\r\ndef assume_role(cls, env):\r\n\r\n        client = boto3.client (\r\n        'sts',\r\n        aws_access_key_id='XXX',\r\n        aws_secret_access_key='xxx'\r\n        )\r\n\r\n        account = ELB.account_handler(env)\r\n\r\n        assumed_role_object = client.assume_role(\r\n            RoleArn = \"arn:aws:iam::{}:role/SmokeTester\".format(account),\r\n            RoleSessionName=\"SmokeTester\"\r\n        )\r\n\r\n        credentials = assumed_role_object['Credentials']\r\n\r\n        s3_resource = boto3.resource(\r\n        'cloudformation',\r\n        aws_access_key_id = credentials['AccessKeyId'],\r\n        aws_secret_access_key = credentials['SecretAccessKey'],\r\n        aws_session_token = credentials['SessionToken']\r\n        )\r\n```\r\n\r\nThe part of my code that calls the load balancers looks like this:\r\n\r\n```\r\nclient=boto3.client('elb')\r\n\r\nELB.ELBList = ELB.ELBList or client.describe_load_balancers()['LoadBalancerDescriptions']\r\n```\r\n\r\nEssentially I need to know how to export the logged in status to the environment, or how to call the ELB client with the sts credentials I have. If that doesn't make sense then it's because I'm a bit stumped as to how to solve it!"}}
{"actor":{"display_login":"JordonPhillips"}}