Wrapper script to generate and pass AWS AssumeRole keys to other scripts
Usage
There are two primary ways to use aws-profile, inline using arguments and with environment variables.
Inline Profile Name
aws-profile [-p, –profile <profile name> -r, –region <region>] <command>
Profile Environment Variable
aws-profile –profile dev –region us-west-2 <command> or aws-profile -p dev -r us-west-2 <command>
Options
AWS_CACHE: Set the AWS_CACHE environment variable to control caching. Use AWS_CACHE=false to disable caching, or any other value (or unset) to keep caching enabled. When set to false the MFA code will be requested every time.
Configuring Profiles
aws-profile uses the built in profiles from the AWS CLI. For full details see Named Profiles in the AWS Documentation.
Here is an example of how to configure a profile for a role, with MFA:
[profile my_profile] role_arn = arn:aws:iam::<account_id>:role/<role_name> source_profile = default mfa_serial = arn:aws:iam::<account_id>:mfa/<username>
Where <account_id> is your AWS Account ID, <role_name> is the name of the role you want to assume, and <username> is the username of the AWS User used fo your default profile.
Development
Clone from github (or preferably from your own fork)
git clone https://github.com/jrstarke/aws-profile.git
Create a clean virtual environment examples for virtualenv and pyenv with virtualenv wrapper
virtualenv venv source venv/bin/activate
or
pyenv virtualenv aws-profile pyenv activate aws-profile
Install the development dependencies
pip install -e ".[dev]"
Run the tests before making changes and then again before creating a pull request (There will be 3 warnings about external dependencies which can be ignored)
pytest --cov=awsprofile --cov-report term-missing
Release files for aws-profile 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aws-profile-0.6.1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_profile-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / aws-profile-0.6.1.tar.gz
| Download URL | aws-profile-0.6.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83ed35e71a70193c3886005fa5fdb6466df6601be5da4b3bbed579709e481363
|
|
BLAKE2b-256 checksum How to use checksums |
c28a02464ad132f1a74496c585b8aa36ebf9e74d7abe434354d02ac047264b79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.6
|
Release files / aws_profile-0.6.1-py3-none-any.whl
| Download URL | aws_profile-0.6.1-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
405325430f0c728714faeed63ba49ab6e5ea7198ccf8a11018e11e319986c451
|
|
BLAKE2b-256 checksum How to use checksums |
8fd88233630ba396660272f9091dd9f6b38bfe387d5fa6293930eef1ad9a6575
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.6
|