STS Refresh Methods#
Implements the STS-based credential refresh strategy for use with
boto3_refresh_session.session.RefreshableSession.
This module defines the STSRefreshableSession class, which uses
IAM role assumption via STS to automatically refresh temporary credentials
in the background.
Added in version 1.1.0.
Tip
For additional details on configuring MFA, refer to the MFA usage documentation. For additional details on client and resource caching, refer to the caching documentation.
Examples#
>>> from boto3_refresh_session import AssumeRoleConfig, RefreshableSession
>>> session = RefreshableSession(
... assume_role_kwargs=AssumeRoleConfig(
... RoleArn="arn:aws:iam::123456789012:role/MyRole",
... RoleSessionName="my-session",
... ),
... region_name="us-east-1"
... )
>>> s3 = session.client("s3")
>>> s3.list_buckets()
STS#
A |