Skip to content

Instantly share code, notes, and snippets.

@toastdriven
Created August 19, 2013 23:58
Show Gist options
  • Save toastdriven/6275574 to your computer and use it in GitHub Desktop.
Save toastdriven/6275574 to your computer and use it in GitHub Desktop.
A simple test script for AWS's Web Identity Federation.
# 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
@sourabhjagtap95
Copy link

Hi,
Where are you getting the web_identity_token from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment