Skip to main content

AWS Profile Manager

Actions Status PyPI version GitHub License Commit Activity

The tool which allows you to jump between your profiles in your ~/.aws/credentials

Problematics

Well, if you are operating only one AWS account then you will not find this util useful. Problem appears when there are more than 3 accounts under your control. Sure, you can use --profile flag with any your aws cli command. But what if you need to run number of commands for several accounts, then make sure you don't forget to add --profile to your command or specified the right profile name. Another example is about Hashicorp Terraform. Let's imagine that you have one module which you need to apply for several accounts. Unfortunately, terraform doesn't allow you to specify --profile and that's logically since Terraform is not about AWS. So, you will need to hardcode your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or go to ~/.aws/credentials and change the [default] profile.

How to install

That's easy just run

sudo pip install aws-profile-manager

Or clone this repository and run

make install

Usage

Usage: aws-profile-manager [OPTIONS] COMMAND [ARGS]...

  This tool's subcommands are loaded from a plugin folder dynamically.

Options:
  --version    Show the version and exit.
  -q, --quiet  Less outputs
  --help       Show this message and exit.

Commands:
  profile-add      Add new AWS profile to your ~/.aws/credentials
  profile-current  Shows current default AWS profile from your ~/.aws/credentials
  profile-edit     Edit AWS profile from your ~/.aws/credentials
  profile-list     Shows all AWS profile from your ~/.aws/credentials
  profile-remove   Removes AWS profile from your ~/.aws/credentials
  profile-switch   Switch default AWS profile in your ~/.aws/credentials
  rotate-keys      Rotate keys for defined profile ~/.aws/credentials

How does it work

Add profile

Allows to add new profile to your ~/.aws/credentials To run profile-add in interactive run next command

aws-profile-manager profile-add

Or you can specify everything inline

aws-profile-manager profile-add --aws-profile-name=your-profile-name --aws-access-key-id=AKIAAAAAAAAAAAAAAAAA --aws-secret-access-key=Aa1Aa0az00+AzA/01AzZZZz0Z0z0ZzzZZzZZz0zZ

Edit profile

Allows to edit existing profile in your ~/.aws/credentials To run profile-edit in interactive run next command

aws-profile-manager profile-edit

Or you can specify everything inline

aws-profile-manager profile-edit --aws-profile-name=your-profile-name --aws-access-key-id=AKIAAAAAAAAAAAAAAAAA --aws-secret-access-key=Aa1Aa0az00+AzA/01AzZZZz0Z0z0ZzzZZzZZz0zZ

Remove profile

Allows to add remove profile from your ~/.aws/credentials To run profile-remove in interactive mode run next command

aws-profile-manager profile-remove

Or you can specify the profile inline and confirm that you understand that profile will be removed from your file using flag --yes

aws-profile-manager profile-remove --aws-profile-name=your-profile-name --yes

Switch profile

Makes a specified profile default in your ~/.aws/credentials To run profile-switch in interactive mode run next command

aws-profile-manager profile-switch

Unfortunately, there is no inline option here, but I swear it will be added in the nearest future

List profiles

Shows all AWS profile from your ~/.aws/credentials and exits

aws-profile-manager profile-list

Rotate keys

Rotate keys for defined profile ~/.aws/credentials To run rotate-keys in interactive mode run next command

aws-profile-manager rotate-keys 

Or you can specify the profile inline and confirm that you understand that keys for profile will be rotated using flag --yes

aws-profile-manager rotate-keys --aws-profile-name=your-profile-name --yes

⚠️ Be careful in case you specified --yes flag since you will not see tips regarding your keys. Rotation will DELETE your key second key if such exists since there may be only two keys per user and the rotation procedure requires to create new key before deleting an old one Also, you can make the rotaton on a regular basis using cron. Simply add this line to your crontab.

crontab -e

In order to rotate on monthly basis add next line

@monthly aws-profile-manager rotate-keys --aws-profile-name=your-profile-name --yes

Metadata

Release files for aws-profile-manager 0.7.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-profile-manager 0.7.3
File Size Uploaded
aws-profile-manager-0.7.3.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-profile-manager 0.7.3
File Interpreter ABI Platform
aws_profile_manager-0.7.3-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / aws-profile-manager-0.7.3.tar.gz

Download URL aws-profile-manager-0.7.3.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
457843fe09dccf8aed7e1760aa06f082f77a2bc17b4ced5cae4c56da39a5e01e
BLAKE2b-256 checksum
How to use checksums
1adeb07168ba5891de7c37d8efb448f00b89e7ca1bd8bf02bd8b59a588947b69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release files / aws_profile_manager-0.7.3-py3-none-any.whl

Download URL aws_profile_manager-0.7.3-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a00b28c2451ddc0c41f0bf7bf0c080c9a12e9ea4fd79b2ab5524fd442c41174f
BLAKE2b-256 checksum
How to use checksums
e24565ab201d5fed47e274e227aea1dd65a2f8ec5c07fa33f7e969d487d234e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release history Release notifications | RSS feed

This release

0.7.3 This release

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page