IAM Roles Anywhere credentials helper
Project description
Iamra
IAM Roles Anywhere credentials helper.
Iamra (ahy-em-rah) is a helper library to abstract and make obtaining temporary AWS IAM credentials easy through using AWS Identity and Access Management Roles Anywhere. Once configured in the cloud, Iamra sessions can be created, and then when credentials are needed, a single call will update the AWS credentials, that can be directly used via boto3 session or client.
Features
- Single object per session, allowing for different scoped credentials
- RSA and EC certificate / private key support
- Certificate chain support for X.509 certificated signed by an intermediate Certificate Authority
- Cached credentials within the expiration time to reduce unneeded calls to IAM Roles Anywhere, but can be force-refreshed as needed
Requirements
- Python 3.9 or later support
- Creation of a trust anchor and profile in the cloud
- Valid X.509 certificate, private key, and optionally a certificate chain file
Installation
You can install Iamra via pip from PyPI:
$ pip install iamra
Usage
Basic usage with local private key and X.509 certificate:
>>> import iamra
>>> # Create a session object
>>> iamra_session = iamra.Credentials(
region="us-east-1",
certificate_filename="client.pem",
private_key_filename="client.key",
duration=3600,
profile_arn="arn:aws:rolesanywhere:us-west-2:1234567890:profile/3d203fc0-7bba-4ec1-a6ef-697504ce1c72",
role_arn="arn:aws:iam::1234567890:role/IamRoleWithPermissionsToUse",
session_name="my_client_test_session",
trust_anchor_arn="arn:aws:rolesanywhere:us-west-2:1234567890:trust-anchor/29efd0b1-1b66-4df4-8ae7-e935716efd8e",
)
>>> # Invoke getting credentials from Roles Anywhere
>>> iamra_session.get_credentials()
>>> # Directly access credentials
>>> iamra_session.access_key_id
'ASIA5FLYQEXXXXXXZ27N'
>>> iamra_session.secret_access_key
'HhAViXXXXqIZrq/qENC4ahPqssXXXX9DEfx3mTv'
>>> iamra_session.session_token
'IQoJb3JpZ2luX2VjEMf//////////wEaCXVzLXdlc3QtMiJ...fARzrFrr0VEpiqFY42NWjFdFUhdLkPiuhsLoTYH+OnaGl92OxAho3j0='
Documentation
Here is the documentation that covers additional usage and module reference.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, Iamra is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.
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
File details
Details for the file iamra-0.6.0.tar.gz
.
File metadata
- Download URL: iamra-0.6.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b1e4bec778f0887b481d633b2e20c5487b668d62c6b979f23856d689dea569e |
|
MD5 | 68613aaf462ed122718b1e9d25ab9d79 |
|
BLAKE2b-256 | 9a36a815935314654bc6eb33ea7845bf3aba1add9a450c8a160d28659afbbc61 |
File details
Details for the file iamra-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: iamra-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd0e8c09e5c4667776c245d3ee2e699055743583b92a48e32c312740432e258d |
|
MD5 | 142bea9cfc1faaf9cc1906341c17627b |
|
BLAKE2b-256 | d5375cd5886a3e6ee35500eac5e0acef87e4783c2364dd0e34caaa02dd978a3f |