Does creating a boto3 session trigger an http request to the AWS API?
Or is it only when a resource operation takes place?
CodePudding user response:
No, it doesn't. A boto3 session is a local collection of config data and state e.g. credentials, region etc. There's no interaction with an AWS backend API. To actually invoke an AWS API you need to create a boto3 client or resource with the session and then call the various methods on that client or resource.
The reference documentation for Session shows that it does expose methods that could cause API calls to AWS but I don't believe these are called (unless you decide to call them). They include:
- get_available_partitions
- get_available_regions
You can review the source code for Session to see that it appears to be simply a container for config and state. Here is the start of the inline documentation for the class:
A session stores configuration state and allows you to create service clients and resources.