-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathget_udf_aws_keys.sh
More file actions
executable file
·23 lines (19 loc) · 1016 Bytes
/
get_udf_aws_keys.sh
File metadata and controls
executable file
·23 lines (19 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
curl -s 10.1.1.254/cloudAccounts > cloudAccounts.json
export AWS_ACCESS_KEY_ID=$(jq -r '.cloudAccounts[].apiKey' < ./cloudAccounts.json)
export AWS_SECRET_ACCESS_KEY=$(jq -r '.cloudAccounts[].apiSecret' < ./cloudAccounts.json)
export AWS_ACCCOUNT_ID=$(jq -r '.cloudAccounts[].accountId' < ./cloudAccounts.json)
export AWS_CONSOLE_LINK=$(printf https://${AWS_ACCCOUNT_ID}.signin.aws.amazon.com/console)
export AWS_USER=$( jq -r '.cloudAccounts[].consoleUsername' < ./cloudAccounts.json)
export AWS_PASSWORD="$(jq -r '.cloudAccounts[].consolePassword' < ./cloudAccounts.json)"
if [ ! -d ~/.aws ]; then
mkdir ~/.aws
envsubst < ./config.template > ~/.aws/config
else
envsubst < ./config.template > ~/.aws/config
fi
printf "AWS Access Key ID: \n%s\n\n" ${AWS_ACCESS_KEY_ID}
printf "AWS Secret key: \n%s\n\n" ${AWS_SECRET_ACCESS_KEY}
printf "AWS Console URL:\n%s\n\n" ${AWS_CONSOLE_LINK}
printf "AWS Console Username:\n%s\n\n" ${AWS_USER}
printf "AWS Console Password:\n%s\n\n" ${AWS_PASSWORD}