The AWS SDK for Python Boto3 uses the Amazon Web Services Botocore
Table of contents
- boto3 GitHub
- AWS SDK For Python (Boto3)
- Quickstart - Getting started with Boto 3 is easy, but requires a few steps.
- Boto 3 Documentation - Boto is the Amazon Web Services (AWS) SDK for Python, which allows Python developers to write software that makes use of Amazon services like S3 and EC2. Boto provides an easy to use, object-oriented API as well as low-level direct service access.
Where is Python 3 installed...
Use the results of the which command to create the virtualenv, for example /usr/bin/python3
virtualenv myawsproject -p /usr/bin/python3
Activate the virtualenv
cd myawsproject source bin/activate
(myawsproject)pip install boto3
Boto can be configured in multiple ways. Regardless of the source or sources that you choose, you must have AWS credentials and a region set in order to make requests.2
The mechanism in which boto3 looks for credentials is to search through a list of possible locations and stop as soon as it finds credentials. The order in which Boto3 searches for credentials is:3
- Passing credentials as parameters in the boto.client() method
- Passing credentials as parameters when creating a Session object
- Environment variables
- Shared credential file (~/.aws/credentials) (see AWS Command Line Interface)
- AWS config file (~/.aws/config)
- Assume Role provider
- Boto2 config file (/etc/boto.cfg and ~/.boto)
- Instance metadata service on an Amazon EC2 instance that has an IAM role configured.
session = boto3.Session(profile_name='dev') # Any clients created from this session will use credentials # from the [dev] section of ~/.aws/credentials. dev_s3_client = session.client('s3')