Skip to content

Instantly share code, notes, and snippets.

@Merlz
Merlz / aws-creds.bash
Created August 2, 2018 13:55 — forked from mkostrikin/aws-creds.bash
Fetch AWS STS keys and set environment variables
#!/bin/bash
# Fetch 24-hour AWS STS session token and set appropriate environment variables.
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html .
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ .
# Add this function to your .bashrc or save it to a file and source that file from .bashrc .
# Usage: aws-creds MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS]
function aws-creds () {
if [[ ! $1 ]]; then
echo "aws-creds: missing required argument: MFA_TOKEN_CODE" 1>&2

Keybase proof

I hereby claim:

  • I am Merlz on github.
  • I am jstaker (https://keybase.io/jstaker) on keybase.
  • I have a public key whose fingerprint is 1322 1449 EA26 039F 03C4 F6F8 B49F 1AD1 C1D8 0988

To claim this, I am signing this object: