Skip to main content

AWS Role Credentials

https://img.shields.io/pypi/v/aws_role_credentials.svg https://snap-ci.com/ThoughtWorksInc/aws_role_credentials/branch/master/build_image

Generates AWS credentials for roles using STS and writes them to `~/.aws/credentials`

Usage

Simply pipe a SAML assertion into awssaml

# create credentials from saml assertion
$ oktaauth -u jobloggs | aws_role_credentials saml --profile dev

Or for assuming a known role name:

# create credentials from saml assertion using a known role ARN
$ oktaauth -u jobloggs | aws_role_credentials saml --profile dev --role-arn arn:aws:iam::098765432109:role/ReadOnly

Or for assuming a role using an IAM user:

# create credentials from an iam user
$ aws_role_credentials user \
  arn:aws:iam::111111:role/dev jobloggs-session \
  --profile dev

For roles that require MFA:

# create credentials from an iam user with mfa
$ aws_role_credentials user \
  arn:aws:iam::111111:role/dev jobloggs-session \
  --profile dev \
  --mfa-serial-number arn:aws:iam::111111:mfa/Jo \
  --mfa-token 102345

Transient mode

`aws_role_credentials` also supports ‘transient’ mode where the credentials are passed to a command as environment variables within the process. This adds an extra layer of safety and convinience.

To use transient mode simply pass a command to the `--exec` option like so:

# run 'aws s3 ls' with the generated role credentials from an iam user
$ aws_role_credentials user \
  arn:aws:iam::111111:role/dev jobloggs-session \
  --exec 'aws s3 ls'

Options

--profile

Use a specific profile in your credential file (e.g. Development). Defaults to sts.

--region

The region to use. Overrides config/env settings. Defaults to us-east-1.

--role-arn

Optional role ARN to use when multiple roles are available.

--exec

The command to execute with the AWS credentials

Thanks

Thanks to Quint Van Deman of AWS for demonstrating how to do this. https://blogs.aws.amazon.com/security/post/Tx1LDN0UBGJJ26Q/How-to-Implement-Federated-API-and-CLI-Access-Using-SAML-2-0-and-AD-FS

Authors

  • Peter Gillard-Moss

History

0.1.0 (2015-01-11)

  • First release on PyPI.

Metadata

Release files for aws-role-credentials 0.6.4

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-role-credentials 0.6.4
File Size Uploaded Provenance Actions
aws_role_credentials-0.6.4.tar.gz 18.1 kB Without provenance Details for aws_role_credentials-0.6.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aws-role-credentials 0.6.4
File Interpreter ABI Platform Actions
aws_role_credentials-0.6.4-py2.py3-none-any.whl Python 3, Python 2 none any Details for aws_role_credentials-0.6.4-py2.py3-none-any.whl

Total release size: 27.9 kB

Release files / aws_role_credentials-0.6.4.tar.gz

Download URL aws_role_credentials-0.6.4.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
04d3e5b8223b2d04a8fb1eaac7f7300a657593e5e8f48ae8333053c333c4b8a0
BLAKE2b-256 checksum
How to use checksums
7da0cda6e2d31190fc1fcec0cfb547dd2d5143d1b5348288725adec9a911ee98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.2

Release files / aws_role_credentials-0.6.4-py2.py3-none-any.whl

Download URL aws_role_credentials-0.6.4-py2.py3-none-any.whl
Size 9.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
372151ac7e7470305fd5eb782bbd99f84759a59fbb10f501566e1514e787f8fb
BLAKE2b-256 checksum
How to use checksums
1ed332dba1f6826fd9ac5dfb91902014e8a1880bcceffae0147c3b5df9804533
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.2

Security for aws-role-credentials 0.6.4

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