Amazon Web Services named profile per project#
You're a freelance software developer. You have two directories to distinguish between your personal and client projects:
~/codefor personal projects.~/client-foofor client foo's projects.
You use Amazon Web Services for both personal and client projects, and you have AWS named profiles set up for each account you interact with:
- The
personalprofile for your personal AWS account. - The
fooprofile for client foo's AWS account.
Right now, you need to remember to run aws with --profile personal or --profile foo depending on the project you're working on.
However, wev's contextual environment variables can manage that for you.
-
Install
wev:pip3 install wev -
Create
~/code/wev.yml:AWS_DEFAULT_PROFILE: plugin: id: wev-echo value: personal -
Create
~/client-foo/wev.yml:AWS_DEFAULT_PROFILE: plugin: id: wev-echo value: foo -
Open a terminal and
cdinto~/code. Verify that the personal named profile is used:cd ~/code wev aws sts get-caller-identity{ "UserId": "000000000000", "Account": "000000000000", "Arn": "arn:aws:iam::000000000000:user/you" } -
Open a terminal and
cdinto~/client-foo. Verify that the foo named profile is used:cd ~/client-foo wev aws sts get-caller-identity{ "UserId": "111111111111", "Account": "111111111111", "Arn": "arn:aws:iam::111111111111:user/contractor" }
Last update: 2021-01-23