Skip to main content

AWS Session Management

Project description

AWS Session Management

This package contains

AwsSessionManagement - handles AWS Session with AWS Temp credentials by Assuming a given Role it renews the temp credentials when needed This library helps keeping boto3 clients with the fresh aws temp credentials


This example shows how to manage the AWSRequestAuth object with the fresh temp credentials These credentials will be automatically refreshed by the AwsSessionManamagement class

Using the following libraries:

import requests import aws_requests_auth (

def get_auth_request(aws_access_key_id, aws_secret_access_key, aws_session_token, aws_host, aws_region, aws_service):"creating/updating auth request ...")
    auth = AWSRequestsAuth(aws_access_key=aws_access_key_id,
                           aws_service=aws_service)"returning auth request")
    return auth

awsSessionManagement = AwsSessionManagement(role_arn='roleArnValue',
                                            func_params_dict={'aws_host': 'your_service_aws_host_name', 'aws_region': 'your_service_region', 'aws_service': 'your_aws_service_name'},

# For example:
# aws_host = f'{self.api_gateway_id}.execute-api.{self.api_gateway_region}'
# aws_region = 'eu-west-1'
# aws_service = 'execute-api'

# get the auth request object with the temp aws credentials
auth = awsSessionManagement.get_func_res()
headers = {'Accept': 'application/json'}
response = requests.get(f"{self.api_gateway_url}/abc", auth=auth, headers=headers)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-session-management-0.0.1.tar.gz (3.0 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page