Skip to main content

auth-aws-profile

Make authenticating your AWS credentials with MFA easier by using a script provided in this repository. Developed using Python 3.12 and Poetry. The authentication process uses the V3 SDK for Python.

Requirements

  • Python ^3.12.
  • An AWS credentials file, e.g. ~/.aws/credentials, with one or more sections that contain the following keys.
    • aws_access_key_id
    • aws_secret_access_key
    • aws_session_token
  • An AWS configuration file, e.g. ~/.aws/config, with one or more [profile *] sections.
    • The [profile *] should reference a section from ~/.aws/credentials using source_profile = * and must have the role_arn key as well.

Example

Here's what the script expects your AWS configuration and credentials file to look like.

# ~/.aws/config

[default]
region = <my-aws-region>
output = yaml

[profile my-role]
role_arn = arn:aws:iam::<my-aws-account-number>:role/my-role
source_profile = mfa
# ~/.aws/credentials

[default]
aws_access_key_id = foo
aws_secret_access_key = bar

[mfa]
aws_access_key_id = foo
aws_secret_access_key = bar
aws_session_token = baz

The AWS CLI can still find my-role even if you move it to ~/.aws/credentials as long as it's renamed to [my-role] instead of [profile my-role]. However, this script requires my-role to be in ~/.aws/config and must be passed to the script using the complete profile section name, e.g. profile my-role.

Usage

Install the script from PyPi and verify the version.

pip install auth-aws-profile
auth-aws-profile --version

Here's a simple usage example based on the files mentioned in Example.

auth-aws-profile "profile my-role" "arn:aws:iam::<my-aws-account-number>:mfa/john.doe"

See the help documentation for details.

auth-aws-profile --help

Development

Installation

  • At least Python 3.12 must be installed.
  • Poetry is installed. See Installation.
  • Install the project with Poetry from the root using poetry install.

Installation (Dev Containers)

  • Docker must be installed.
  • Install the Dev Containers extension for VS Code or similar.

Metadata

Release files for auth-aws-profile 0.2.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 auth-aws-profile 0.2.0
File Size Uploaded Provenance
auth-aws-profile-0.2.0.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for auth-aws-profile 0.2.0
File Interpreter ABI Platform
auth_aws_profile-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / auth-aws-profile-0.2.0.tar.gz

Download URL auth-aws-profile-0.2.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c73d7fbaf25d1f69a5ad7956cc16df489a4783e0154ced05dde3b7bb6fa73328
BLAKE2b-256 checksum
How to use checksums
b3c884675f110f64651887c0634327076a3c2cc0e9ef1075b536d5c86d9ab4bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.12.3 Linux/6.10.0-linuxkit

Release files / auth_aws_profile-0.2.0-py3-none-any.whl

Download URL auth_aws_profile-0.2.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1784d00b4e447c0145fbd7e9945f40d8afa7d022eae1ecbd6d421ba2aa3a8383
BLAKE2b-256 checksum
How to use checksums
6d775be7440c29c846ff838e87d0ab0a6cab6b6d07771050c5fcfeec46820b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.12.3 Linux/6.10.0-linuxkit

Security for auth-aws-profile 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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