Last active
August 29, 2015 14:20
-
-
Save smj10j/a4fe775b0e4f4fa68b45 to your computer and use it in GitHub Desktop.
Create AWS Configuration Files
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
| #!/bin/bash | |
| # Usage example | |
| # | |
| # curl "https://gist.githubusercontent.com/smj10j/a4fe775b0e4f4fa68b45/raw/create-aws-configuration-files.sh" | \ | |
| # bash -s 'access key' 'secret key' 'us-east-1' && \ | |
| # aws iam list-access-keys --user-name SomeUser | |
| # | |
| ACCESS_KEY=$1 | |
| SECRET_KEY=$2 | |
| REGION=${3:-us-east-1} | |
| PROFILE_NAME=${4:-default} | |
| echo "Installing Homebrew..." | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| echo "Installing AWS cli via Homebrew..." | |
| brew install awscli | |
| echo "Creating AWS configuration files in ~/.aws/ ..." | |
| mkdir -p ~/.aws/ | |
| echo " | |
| [$PROFILE_NAME] | |
| aws_access_key_id=$ACCESS_KEY | |
| aws_secret_access_key=$SECRET_KEY | |
| " >> ~/.aws/credentials | |
| echo " | |
| [$PROFILE_NAME] | |
| region=$REGION | |
| output=json | |
| " >> ~/.aws/config | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment