A wrapper for executing a command using AWS Assumed Role
Project description
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>] <command>
Profile Environment Variable
AWS_DEFAULT_PROFILE=’<profile>’ aws-profile <command>
AWS_PROFILE=’<profile>’ aws-profile <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
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 aws_profile-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 003ae046a354e1e4632bca64852a1e7faba8f644c768ed4a6e1f2273e18a0178 |
|
MD5 | e4e3e2b80ebdaa630d1d3f2402f7c1a1 |
|
BLAKE2b-256 | 93516780ee70076d78e485745270e48a83f920a24f364c153262fdab86a24563 |