Registry / security / iam-rolesanywhere-session

iam-rolesanywhere-session

JSON →
library2.3.0pypypi✓ verified 79d ago

Creates a boto3 session using IAM Roles Anywhere for authenticating workloads outside AWS with temporary credentials. Version 2.3.0 supports both synchronous and async session creation. Release cadence is irregular.

pip install iam-rolesanywhere-session
INSTALL
IMPORT
SIG · IAM-ROLESANYWHERE-
I
iam-rolesanywhere-session
securitypythonv2.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IAMRolesAnywhereSession
from iam_rolesanywhere_session import IAMRolesAnywhereSession
from iam_rolesanywhere_session import IamRolesAnywhereSession

Create a session with IAM Roles Anywhere and get a boto3 client.

import os from iam_rolesanywhere_session import IamRolesAnywhereSession session = IamRolesAnywhereSession( profile_arn=os.environ.get('PROFILE_ARN', ''), role_arn=os.environ.get('ROLE_ARN', ''), trusted_anchor_arn=os.environ.get('TRUSTED_ANCHOR_ARN', ''), certificate_arn=os.environ.get('CERTIFICATE_ARN', ''), private_key=os.environ.get('PRIVATE_KEY', ''), duration_seconds=3600, ) # Get a boto3 client s3_client = session.get_client('s3') print(s3_client.list_buckets())
Debug
Known issues
breakingVersion 2.0 renamed the package from boto3-rolesanywhere-session to iam-rolesanywhere-session. Update imports and install commands.
fix
Install iam-rolesanywhere-session and change imports to use iam_rolesanywhere_session.
affects: <2.0
deprecatedThe parameter 'session_duration' was renamed to 'duration_seconds' in v2.0. Using the old name will raise an error.
fix
Use 'duration_seconds' instead of 'session_duration'.
affects: >=2.0
gotchaThe private_key parameter expects the raw key string, not a file path. Passing a path will fail silently or cause authentication errors.
fix
Read the private key file contents and pass the string: open('key.pem').read().
affects: >=1.0
gotchaWhen providing a certificate via certificate_arn, the corresponding certificate must be stored in AWS Certificate Manager (ACM) Private CA, not self-managed.
fix
Ensure the certificate ARN references an ACM Private CA certificate.
affects: >=1.0
breakingAsync session creation (AsyncIamRolesAnywhereSession) requires an event loop. Calling without an active loop will raise a RuntimeError.
fix
Use asyncio.run() or ensure an event loop is running when creating the async session.
affects: >=2.0
Upgrade
Version history
2.3.0latest on PyPI · released May 12, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources

No resource links recorded.

iam-rolesanywhere-session — pip install iam-rolesanywhere-session · libregistry