schrodinger.stepper.cloud.aws_client module

Helper module for returning an AWS client object.

schrodinger.stepper.cloud.aws_client.get_client(aws_service)[source]

Retrieve an AWS client for the requested AWS service. AWS credentials are obtained in one of the following manner and order: 1. Shared credential file (~/.aws/credentials) 2. AWS config file (~/.aws/config) 3. Environment variables: SCHRODINGER_AWS_KEY_ID and SCHRODINGER_AWS_KEY

See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html for more details.

Parameters

aws_service (str) – name of AWS service to connect to.

Returns

an active client connected to requested AWS service.

Return type

boto3.Session.client

schrodinger.stepper.cloud.aws_client.get_resource(aws_service)[source]

Retrieve an AWS resource for the requested AWS service. See aws_client.get_client() for details on how credentials are obtained.

Parameters

aws_service (str) – name of AWS service to connect to.

Returns

an active resource connected to requested AWS service.

Return type

boto3.Session.resource

schrodinger.stepper.cloud.aws_client.get_session()[source]

Retrieve an AWS active session. AWS credentials are obtained in one of the following manner and order: 1. Shared credential file (~/.aws/credentials) 2. AWS config file (~/.aws/config)

Returns

an active AWS session.

Return type

boto3.Session

schrodinger.stepper.cloud.aws_client.get_credentials()[source]

This helper method usage is meant to retrieve aws credentials when they are set under ~/.aws. Note that this is typically encouraged only for development purposes and production services should instead use IAM roles for authentication across aws services.

Returns

boto3 active credentials object

Return type

botocore.credential.Credential

schrodinger.stepper.cloud.aws_client.get_region()[source]

Retrieves the AWS region such as us-east-1 in the following manner and order: 1. EC2 instance metadata (most production services will use this feature). 2. Custom schrodinger environment variables If neither are available then None is returned. Note that most often credential profiles also encode the region property so a None value should not be a cause for concern.

Returns

AWS region

Return type

str or None