Created
November 28, 2016 19:01
-
-
Save serkanh/d95f891b3f903746eb1533a113afb87b to your computer and use it in GitHub Desktop.
zshrc export function for aws credentials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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