skillfed

boto3-assume

Easily create boto3 assume role sessions with automatic credential refreshing.

boto3-assume v0.2.1 216.2K downloads/30d#9,385 on PyPI3
Permissive license Apache License 2.0 AGING released

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-assume

uv

uv add boto3-assume

poetry

poetry add boto3-assume

Installing 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

Development Status :: 4 - BetaLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries :: Python Modules

Tags

boto3 assume roleaws iam role assumptionautomatic credential refreshcross-account aws accessboto3 session wrapperaws sts assume rolerefreshable aws credentials
aws-iamcredential-management

More Python Modules packages