Skip to main content

aws-mfa-profiles

A package to create credential for AWS using MFA and with the support of multiple profiles

This package wants to simplify the connection to AWS using the MFA supporting also the possibility to use yours profiles.

Installation


You can install the package using pip install aws-mfa-profiles.

Usage


There is a little help function callable with aws-mfa-profiles -h that it shows this:

usage: aws-mfa-profiles [-h] [-p profile] [-t seconds]

Set credential to connect on AWS using MFA

optional arguments:
  -h, --help  show this help message and exit
  -p profile  Profile from which get mfa configuration
  -t seconds  Token expiration time in second from 900 (15 minutes) to 129600 (36 hours) (default: 43200)

I set default value for the expiration time session which is 43200 for the expiration time session, this means that the default section is valid for 12 hours. Take in mind that if you use the AWS owner account (root), you can set the session time at maximum at 3600 seconds.

How does it works?


The package read from your ${HOME}/.aws/credentials file the accounts that you specified and generate a new section in the same file named ${profile_name_selected/choosed}-mfa with the credentials generated. Then, you need to define this new account as default for the profiles that you have on ${HOME}/.aws/config

credentials:

[account_one]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
mfa_serial = YOUR_MFA_ARN

[account_two]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
mfa_serial = YOUR_MFA_ARN

[account_one-mfa]
aws_access_key_id = YOUR_TEMPORARY_ACCESS_KEY_ID
aws_secret_access_key = YOUR_TEMPORARY_SECRET_ACCESS_KEY
aws_session_token = YOUR_TEMPORARY_SESSION_TOKEN

[account_two-mfa]
aws_access_key_id = YOUR_TEMPORARY_ACCESS_KEY_ID
aws_secret_access_key = YOUR_TEMPORARY_SECRET_ACCESS_KEY
aws_session_token = YOUR_TEMPORARY_SESSION_TOKEN

config:

[default]
region = eu-west-1
cli_pager=

[profile profile-that-use-mfa-from-account_one]
role_arn = arn:aws:iam::111111111111:role/your_role
source_profile = account_one-mfa

[profile profile-that-use-mfa-from-account_two]
role_arn = arn:aws:iam::222222222222:role/your_role
source_profile = account_two-mfa

Metadata

Release files for aws-mfa-profiles 2.0.0

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-mfa-profiles 2.0.0
File Size Uploaded Provenance
aws-mfa-profiles-2.0.0.tar.gz 4.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-mfa-profiles 2.0.0
File Interpreter ABI Platform
aws_mfa_profiles-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / aws-mfa-profiles-2.0.0.tar.gz

Download URL aws-mfa-profiles-2.0.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0d42bdf0e7152fea32d9baffe78f11eaba5a7d4f3949c4dcc6c522a79f00c504
BLAKE2b-256 checksum
How to use checksums
32ef7e088c7e04ca5e242ef3de4550814269ea266c449651bdaa8c958f988af6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / aws_mfa_profiles-2.0.0-py3-none-any.whl

Download URL aws_mfa_profiles-2.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31582723958574362162317ddc8fdc28fbb1cf0fc3b108b9badf5f47d6776f19
BLAKE2b-256 checksum
How to use checksums
3630760f785f78b4a0476613fa84e47c9d573a1ab140cf9db30b742e02f70b01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Security for aws-mfa-profiles 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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