Skip to main content

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

Project description

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

Project details


Download files

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

Source Distribution

aws-mfa-profiles-2.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

aws_mfa_profiles-2.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file aws-mfa-profiles-2.0.0.tar.gz.

File metadata

  • Download URL: aws-mfa-profiles-2.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for aws-mfa-profiles-2.0.0.tar.gz
Algorithm Hash digest
SHA256 0d42bdf0e7152fea32d9baffe78f11eaba5a7d4f3949c4dcc6c522a79f00c504
MD5 bf59e5e68ccd114c901a4b80c9e897df
BLAKE2b-256 32ef7e088c7e04ca5e242ef3de4550814269ea266c449651bdaa8c958f988af6

See more details on using hashes here.

File details

Details for the file aws_mfa_profiles-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_mfa_profiles-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31582723958574362162317ddc8fdc28fbb1cf0fc3b108b9badf5f47d6776f19
MD5 8077fbd27c3a925106f2dd5a2a65b8c0
BLAKE2b-256 3630760f785f78b4a0476613fa84e47c9d573a1ab140cf9db30b742e02f70b01

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page