A Basic Introduction to Boto3

How to interact with S3 using Boto3

George Pipis
The Startup

--

Image by Nils Schirmer on Unsplash

In a previous post, we showed how to interact with S3 using AWS CLI. In this post, we will provide a brief introduction to boto3 and especially how we can interact with the S3.

Download and Configure Boto3

You can download the Boto3 packages with pip install:

$ python -m pip install boto3

or through Anaconda:

conda install -c anaconda boto3

Then, it is better to configure it as follows:

For the credentials which are under ~/.aws/credentials :

[default] 
aws_access_key_id = YOUR_KEY
aws_secret_access_key = YOUR_SECRET

And for the region, you can with the file which is under ~/.aws/config :

[default] region=us-east-1

Once you are ready you can create your client:

import boto3 s3 = boto3.client('s3')

--

--

George Pipis
The Startup

Sr. Director, Data Scientist @ Persado | Co-founder of the Data Science blog: https://predictivehacks.com/