--- id: aws-assume-role-lib version: "2.10.0" license: Apache-2.0 license_treatment: permissive maintenance: abandoned --- # aws-assume-role-lib — Assumed role session chaining (with credential refreshing) for boto3 License: permissive · Maintenance: abandoned · Downloads: 622.9K/mo ## What it is and what it does aws-assume-role-lib wraps the verbose boilerplate of AWS STS AssumeRole into a single function call on a boto3 Session. Instead of manually calling sts.assume_role(), parsing the response, and creating a new session with temporary credentials, you pass a session and role ARN to assume_role() and get back a session ready to use. The library automatically generates a role session name if you don't provide one, and crucially, it handles credential expiration by refreshing them transparently when needed—eliminating the need to call AssumeRole on every Lambda invocation or manually track credential lifetime. The package depends only on boto3 and is designed to work across Python 3.6 through 3.10. It supports all standard AssumeRole parameters (policies, duration, external ID, tags, etc.) and lets you pass Policy as a dict instead of a JSON string, and DurationSeconds as a timedelta. For Lambda workloads, you initialize the assumed role session once outside the handler and reuse it across invocations, calling AssumeRole only when credentials actually expire. Use it for: - Assume an AWS role in a Lambda function once at initialization and reuse it across invocations without re-assuming on every call. - Simplify multi-account AWS workflows by chaining role assumptions with automatic credential refresh in application code. - Reduce boilerplate when writing boto3 scripts that need to operate under an assumed role with temporary credentials. - Implement cross-account access patterns in microservices where each service assumes a role in another account on startup. - Build automation tools that assume different roles for different tasks without manually managing STS calls and session creation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Simplifies AWS role assumption in boto3 by wrapping STS AssumeRole calls into a single function that automatically refreshes expired credentials and generates session names. Yes, if you are already using boto3 and need to assume roles programmatically. The library genuinely simplifies a common pattern and has no known vulnerabilities. However, be aware that the package is abandoned—last updated in May 2022 with no recent commits. If you need active maintenance or compatibility updates for future boto3 versions, consider whether you can afford to fork it or maintain it internally, or evaluate whether AWS's built-in profile-based role assumption in ~/.aws/config meets your needs instead. ## Install pip install aws-assume-role-lib uv add aws-assume-role-lib poetry add aws-assume-role-lib ## Installing aws-assume-role-lib Before you install: Low install friction with a single runtime dependency on boto3. However, the package is abandoned—last commit was 2022-11-02 and no releases since 2022-05-14. It remains marked Production/Stable and has no known vulnerabilities, but you will not receive updates or maintenance. License in practice: Licensed under Apache-2.0 (permissive). You may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: import boto3 from aws_assume_role_lib import assume_role session = boto3.Session() assumed_role_session = assume_role(session, "arn:aws:iam::123456789012:role/MyRole") print(assumed_role_session.client("sts").get_caller_identity()) Requires boto3 to be installed and valid AWS credentials configured for the initial session. Verify before relying: - Whether the package works correctly with recent boto3 versions released after 2022-05-14. - Whether credential refresh behavior remains compatible with current AWS STS API behavior. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 622.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags boto3 assume role, aws sts assume role wrapper, automatic credential refresh, aws role chaining, boto3 session management, lambda assume role, aws temporary credentials, aws, iam, credential-management [View on SkillFed](https://skillfed.io/packages/aws-assume-role-lib) · [View on PyPI](https://pypi.org/project/aws-assume-role-lib/)