Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active November 9, 2020 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/e3eba29ebb9caabc556631fe8d0056b4 to your computer and use it in GitHub Desktop.
Save RichardBronosky/e3eba29ebb9caabc556631fe8d0056b4 to your computer and use it in GitHub Desktop.
Convert the output of `aws sts get-session-token` to shell export statements
#!/usr/bin/env python
import json, re, sys
for k,v in json.load(sys.stdin)['Credentials'].items(): print("export AWS{}='{}'".format(re.sub('([A-Z])', r'_\1', k).upper(),v))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment