AWS Data Wrangler

2 - Sessions

How Wrangler handle Sessions and AWS credentials?

After version 1.0.0 Wrangler absolutely relies on Boto3.Session() to manage AWS credentials and configurations.

Wrangler will not store any kind of state internally. Users are in charge of managing Sessions.

Most Wrangler functions receive the optional boto3_session argument. If None is received, the default boto3 Session will be used.

[1]:
import awswrangler as wr
import boto3

Using the default Boto3 Session

[2]:
wr.s3.does_object_exist("s3://noaa-ghcn-pds/fake")
[2]:
False

Customizing and using the default Boto3 Session

[3]:
boto3.setup_default_session(region_name="us-east-2")

wr.s3.does_object_exist("s3://noaa-ghcn-pds/fake")
[3]:
False

Using a new custom Boto3 Session

[4]:
my_session = boto3.Session(region_name="us-east-2")

wr.s3.does_object_exist("s3://noaa-ghcn-pds/fake", boto3_session=my_session)
[4]:
False