boto3-assume
Easily create boto3 assume role sessions with automatic credential refreshing.
What it is and what it does
boto3-assume is a thin wrapper around boto3 that simplifies the creation of assume-role sessions with built-in credential refreshing. Instead of manually managing STS AssumeRole calls and credential expiration, you pass a source boto3 Session and role details to assume_role(), which returns a new session whose credentials automatically refresh when they expire. The wrapper handles the STS client creation and credential lifecycle internally.
The package is designed for developers who need to work with multiple AWS IAM roles within a single application—particularly in cross-account scenarios or when switching between roles frequently. It reduces boilerplate by eliminating the need to manually track credential expiration times or re-invoke AssumeRole. The underlying mechanism uses boto3's STS client to call assume_role with your specified parameters (RoleArn, RoleSessionName, optional DurationSeconds, tags, etc.) and wraps the resulting credentials in a session that refreshes them transparently.
Use it for:
- Cross-account AWS access: assume a role in another AWS account to access resources without managing separate credentials.
- Multi-role applications: switch between different IAM roles within the same application without manual credential refresh logic.
- Long-running services: maintain assume-role credentials that auto-refresh over hours or days without manual intervention.
- Temporary elevated permissions: assume a higher-privilege role for specific tasks, with credentials automatically expiring after a set duration.
- CI/CD pipelines: assume deployment or testing roles without hardcoding temporary credentials in environment variables.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps boto3 to create AWS IAM assume-role sessions with automatic credential refreshing, eliminating manual credential management when switching roles.
Yes, if you regularly assume AWS IAM roles in boto3 applications. The package eliminates credential-refresh boilerplate and is lightweight (two dependencies). The aging maintenance status (211 days since last release) is a minor concern for a stable, narrow-scope utility, but check whether your Python version (3.10+) and boto3 version are compatible. No known vulnerabilities.
Install
boto3-assume on PyPI
pip
pip install boto3-assumeuv
uv add boto3-assumepoetry
poetry add boto3-assumeInstalling boto3-assume
Before you install
Low install friction with only two runtime dependencies (boto3, botocore). Maintenance status is aging—last release was 211 days ago, though the repository remains active with a recent commit on 2026-01-15.
License in practice
Apache License 2.0 is permissive, allowing commercial use, modification, and distribution with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
pip install boto3-assume
import boto3
from boto3_assume import assume_role
assume_session = assume_role(
source_session=boto3.Session(),
assume_role_kwargs={
"RoleArn": "arn:aws:iam::123412341234:role/my_role",
"RoleSessionName": "my-role-session"
}
)
sts_client = assume_session.client("sts", region_name="us-east-1")
Requires a boto3 Session with automatic credential refreshing already configured; credentials must have permission to assume the target role.
Verify before relying
- Whether automatic refresh happens transparently on every client call or only when credentials expire.
- Performance overhead compared to creating a standard boto3 session with assume-role credentials.
- Support for cross-account and cross-partition role assumptions beyond standard AWS partitions.
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — boto3, botocore |
| Maintenance | aging — 211 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 216,159/month — #9,385 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: boto3_assume-0.2.1-py3-none-any.whl
Keywords: assume, aws, boto3, botocore, credentials, creds, iam, refresh, refreshable, role, sdk
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
aws-assume-role-libSimplifies AWS role assumption in boto3 by…
permissive · top 15,000 on PyPI
boto_session_managerWraps boto3 sessions with typed client…
permissive · top 5,000 on PyPI
gimme-aws-credsA CLI tool that obtains temporary AWS…
permissive · top 15,000 on PyPI
aws-sso-libProgrammatically interact with AWS IAM Identity…
permissive · top 15,000 on PyPI
cloudsec-auditAudits AWS cloud security posture by checking…
permissive · top 15,000 on PyPI
alibabacloud-credentialsManages authentication credentials for Alibaba…
permissive · top 5,000 on PyPI
requests-aws-signAdds AWS V4 request signing to the requests…
permissive · top 5,000 on PyPI
aws-cdk.aws-iamProvides Python constructs for defining AWS IAM…
permissive · top 15,000 on PyPI
alibabacloud-sts20150401Provides Python bindings to Alibaba Cloud's…
permissive · top 15,000 on PyPI
pymongo-auth-awsEnables PyMongo to authenticate to MongoDB…
permissive · top 5,000 on PyPI