Created
August 19, 2013 23:58
-
-
Save toastdriven/6275574 to your computer and use it in GitHub Desktop.
A simple test script for AWS's Web Identity Federation.
This file contains 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
# Use the following to generate the necessary values. | |
# https://web-identity-federation-playground.s3.amazonaws.com/index.html | |
from boto.sts.connection import STSConnection | |
sts = STSConnection(anon=True) | |
# Substitute your own values from the Playground here. | |
arn = 'arn:aws:iam::XXXXXXX:role/WebIdFed_Amazon' | |
session_name = 'web-identity-federation' | |
token = 'Atza|XXXXXXX' | |
creds = sts.assume_role_with_web_identity( | |
role_arn=arn, | |
role_session_name=session_name, | |
web_identity_token=token, | |
# You may need to switch this to your identity provider. | |
provider_id='www.amazon.com', | |
) | |
print creds.user.arn | |
print creds.user.assume_role_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Where are you getting the web_identity_token from?