At Cinevee, we are developing several forks of our distribution platform for each of our partners. This means we deploy to a different environment in a different AWS account (with differing credentials) for each fork. Re-initializing Elastic Beanstalk eb init
before you git aws.push
can get annoying when you are switching back forth between projects a dozen times a day (we’re quite agile). So here’s a quick way to setup and switch between your AWS credential files per project.
- Create a simple text file and save it in your git repo as ‘AWS_CREDENTIAL’ with:
AWSAccessKeyId=Write your AWS access ID AWSSecretKey=Write your AWS secret key
replacing your AWS access ID and secret key.
- Limit file permissions with:
chmod 600 <file path to AWS_CREDENTIAL>
- Set the AWS credential environment variable with
export AWS_CREDENTIAL_FILE=<file path to AWS_CREDENTIAL>
replacing the file path to the text file you created in step 1.
- Instead of typing “export AWS_CRED…” every time you switch between projects, you can create an alias in Terminal by updating your .bash_profile found at “Users/<USERNAME>/.bash_profile”. Add:
alias AWS-Project1="export AWS_CREDENTIAL_FILE=<file path to AWS_CREDENTIAL for project1>"
- Repeat this alias line for each project, updating the alias command “AWS-Cinevee” and the AWS_CREDENTIAL file path for each entry.
Information used from the AWS CLI Tools docs.