2 - Sessions¶
How awswrangler handles Sessions and AWS credentials?¶
After version 1.0.0 awswrangler relies on Boto3.Session() to manage AWS credentials and configurations.
awswrangler will not store any kind of state internally. Users are in charge of managing Sessions.
Most awswrangler functions receive the optional boto3_session
argument. If None is received, the default boto3 Session will be used.
[1]:
import boto3
import awswrangler as wr
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