Skip to content

Instantly share code, notes, and snippets.

@ghostsquad
Created September 4, 2019 19:34
Show Gist options
  • Save ghostsquad/5d0166af0db965d68c19396a2766b49f to your computer and use it in GitHub Desktop.
Save ghostsquad/5d0166af0db965d68c19396a2766b49f to your computer and use it in GitHub Desktop.
aws creds to env vars
#!/usr/bin/env bash
function aws-creds-to-env {
profile_name="${1:-default}"
AWS_ACCESS_KEY_ID=$(aws configure get "${profile_name}.aws_access_key_id")
export AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=$(aws configure get "${profile_name}.aws_secret_access_key")
export AWS_SECRET_ACCESS_KEY
}
function aws-creds-out-of-env {
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment