Last active
August 1, 2016 03:05
-
-
Save ryan-lane/f612529c451c0d4d68ea9ee221ff1df6 to your computer and use it in GitHub Desktop.
Token and username generation for KMS authentication
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
import kmsauth | |
generator = kmsauth.KMSTokenGenerator( | |
# KMS key to use for authentication to the lambda | |
'alias/awseipext-production-iad', | |
# Encryption context to use | |
{ | |
# We're authenticating to this service | |
'to':'awseipext-production-iad', | |
# It's from this IAM role | |
'from':'myrole-production-iad', | |
# This token is for a service | |
'user_type': 'service', | |
# This is an association action | |
'action': 'associate', | |
'resource': '52.0.0.1', | |
}, | |
# Find the KMS key in this region | |
'us-east-1' | |
) | |
username = generator.get_username() | |
token = generator.get_token() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment