Skip to content

Instantly share code, notes, and snippets.

@serkanh
Created November 28, 2016 19:01
Show Gist options
  • Save serkanh/d95f891b3f903746eb1533a113afb87b to your computer and use it in GitHub Desktop.
Save serkanh/d95f891b3f903746eb1533a113afb87b to your computer and use it in GitHub Desktop.
zshrc export function for aws credentials
expawskeys(){
if [ -z "$1" ];then
echo "Profile prefix is required! ex: HA, jumpstart etc..."
fi
FILE="$HOME/.aws/credentials"
KEYS=$(cat ${FILE} | grep "\[$1\]" -A2 | tail -2 | cut -f2 -d= | xargs)
export AWS_ACCESS_KEY_ID=$(echo ${KEYS} | cut -f1 -d' ')
export AWS_SECRET_ACCESS_KEY=$(echo ${KEYS} | cut -f2 -d' ')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment