No project description provided
Project description
AWS Profile Utility
The awsprofile
utility can be used to simplify working with a large number of profiles. This utility reads from ~/.aws/credentials
and ~/.aws/awsprofile
to list profiles.
Install
pip install xawsprofile
Usage
# list profiles
awsprofile list
# set profile to profile1 and set alias
eval $(awsprofile set profile1 --alias p1)
# list regions
awsprofile list-regions
Bash Completion
This utility includes the following bash completions:
Select Profile
ap
(aws profile) - ap {TAB}{TAB}
then select a profile, hit {ENTER}
$ ap prof{TAB}{TAB}
profile1 profile2
Select Region
ar
(aws region) - ar {TAB}{TAB}
, then select a region, hit {ENTER}
$ ar us-{TAB}{TAB}
us-east-1 us-west-1
Setup Bash Completion
# add to your .bash_profile
eval "$(awsprofile completion bash)"
Commands
List Profiles
list
- list profiles
$ awsprofile list
profile1
profile2
Set Profile
set
- set the current profile using exported environment variables
$ eval(awsprofile set profile1)
# set profile and set alias
$ eval(awsprofile set profile1 --alias p1)
List Regions
list-regions
- list AWS regions
Configure
config
- configure awsprofiles
This currently supports cwd
to configure the current working directory with a filter.
# filter only profiles-* and remove `profiles-` prefix
awsprofile config cwd --match 'profiles-(.*)`
Customizations
Aliases
To set an alias, update ~/.aws/awsprofile
or use awsprofile set ... --alias ...
or use ap {profile} {alias}
.
eval $(awsprofile set profile1 --alias p1)
ap profile1 p1
Naming Rules
To simplify the profile names, rules can be applied when awsprofile list
is run.
- global: ~/.aws/awsprofile
- working directory: {workdir}/.awsprofile (this overrides anything in global)
# rename blah-* by removing "blah-" (ex: blah-test would be just test)
[naming cleanup-blah]
match = blah-(.*)
replace = \1
# hide test-*
[naming hide-test]
match = test-(.*)
visible = false
# hide all but test-*
[naming hide-others]
match = test-(.*)
negate = true
visible = false
# only applies to {workdir}/.awsprofile
[naming]
inherit_global = true
Tips
awsprofile config cwd --match 'profiles-(.*)
will setup the current working directory to filter onlyprofiles-*
as well as stripprofiles-
from the profile names. This generates a.awsprofile
in the current working directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for xawsprofile-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cbfcc3a8bb9e7e9a70de193d0e7996969192e8ac95c0321cd8a435cb0ed8420 |
|
MD5 | 30c1b917e2d0de1f6215716d65763a3b |
|
BLAKE2b-256 | 7f57189bbdb81b4e4e39bc6905f645d336bcb7f43f96cfd69414cc94d98b3417 |