Skip to content

Instantly share code, notes, and snippets.

@stuartwakefield
Last active August 13, 2017 11:32
Show Gist options
  • Save stuartwakefield/444fe9ea9780450c30ff31d80407ed92 to your computer and use it in GitHub Desktop.
Save stuartwakefield/444fe9ea9780450c30ff31d80407ed92 to your computer and use it in GitHub Desktop.
Script to convert STS output to credentials file format
#!/bin/bash
#
# Converts the output of the AWS STS assume role
# CLI command into the correct format for a
# credentials file.
#
jq -r '"[default]\n" +
"aws_access_key_id = " + .Credentials.AccessKeyId + "\n" +
"aws_secret_access_key = " + .Credentials.SecretAccessKey + "\n" +
"aws_session_token = " + .Credentials.SessionToken'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment