Skip to main content

A wrapper for executing a command using AWS Assumed Role

Project description

Wrapper script to generate and pass AWS AssumeRole keys to other scripts


There are two primary ways to use aws-profile, inline and with environment variables.

Inline Profile Name

aws-profile <profile> <command>

Profile Environment Variable

AWS_PROFILE=’<profile>’ aws-profile <command>


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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aws-profile, version 0.4.1
Filename, size File type Python version Upload date Hashes
Filename, size aws-profile-0.4.1.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page