Generates AWS credentials for roles using STS
Project description
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 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.
- --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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws_role_credentials-0.6.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f6350d2825c71f71ac8e3e9db809c0d1fc3e28176303057ea2ba2350ece3686 |
|
MD5 | 599b87786203815157db8ce8e7f6141c |
|
BLAKE2b-256 | 7a8ef5612a2238ced3650e788f7c49322b962f84c287c920b3148b6d00297c0b |
Hashes for aws_role_credentials-0.6.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40b649619f0df6c7919333ef3175bf7af24d8caeaba4014fb7362a360a05e0b9 |
|
MD5 | f21c8951fff92af941f7119da54435ef |
|
BLAKE2b-256 | 483463bbe2acaf1c41be02cac5b90756f088ede7485f85f76e8594425b4961be |