Skip to content

Instantly share code, notes, and snippets.

View mkostrikin's full-sized avatar

Maxim N. Kostrikin mkostrikin

View GitHub Profile
@mkostrikin
mkostrikin / aws-creds.bash
Created April 27, 2017 10:30 — forked from ddgenome/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