Skip to main content

A library to setup an AWS CLI profile for an account with MFA enabled

Project description

AWS STS Get MFA Profile

Use this package to automatically setup an MFA enabled profile for AWS CLI

  1. Install AWS CLI
  2. Sign up for MFA in the AWS IAM Management console (if you haven't already) and note the MFA ARN. AWS Console MFA ARN
  3. Create an access key in the AWS IAM Management console (if you haven't already) and note the access key id and secret. AWS Console CLI Access Key
  4. Create a credential text file profile in your home directory ('C:\Users\SamuelMercer\.aws\credentials') with an mfa profile like below
[mfa]
aws_access_key_id = AKIAWZ...
aws_secret_access_key = XzRI...
mfa_serial = arn:aws:iam::467792...:mfa/...
  1. Install the python package using pip
> python -m pip install aws-sts-get-mfa-profile
  1. Run the script get-sts-token.py using the required length of token in seconds (don't do more than 1 day == 86400 seconds)
> get-sts-token.py
  1. When making AWS CLI calls from now on it should work, e.g.
> aws iam list-users

{
    "Users": [
        {
            ...

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-sts-get-mfa-profile-1.2.1.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

aws_sts_get_mfa_profile-1.2.1-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

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