Simple way to generate and jump into a new AWS temp session. The session here expires after 15 minutes.

#!/bin/bash
set -e

sts=( $(
    aws sts get-session-token --duration-seconds 900  \
    --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
    --output text
) )
export TMP_AWS_ACCESS_KEY_ID=${sts[0]}
export TMP_AWS_SECRET_ACCESS_KEY=${sts[1]}
export TMP_AWS_SESSION_TOKEN=${sts[2]}