Last active
October 31, 2019 20:55
-
-
Save codygreen/be9598b8ebfc1216b6216c1eb6a0b544 to your computer and use it in GitHub Desktop.
UDF Cloud Account AWS Share Credentials File
This file contains 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
#!/bin/bash | |
home=/home/ubuntu | |
creds=$home/.aws/credentials | |
caURL="http://10.1.1.254/cloudAccounts" | |
apiKey=`curl -s $caURL | jq '.[][] | .apiKey'` | |
apiSecret=`curl -s $caURL | jq '.[][] | .apiSecret'` | |
region=`curl -s $caURL | jq '.[][] | .regions[]'` | |
sudo -u ubuntu mkdir -p $home/.aws | |
sudo -u ubuntu touch $creds | |
sudo -u ubuntu chmod 600 $creds | |
sudo -u ubuntu cat << EOF > $creds | |
[default] | |
aws_access_key_id = $apiKey | |
aws_secret_access_key = $apiSecret | |
region = $region | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment