Diving into buckets

Introduction to AWS Boto in Python

Maksim Pecherskiy

Data Engineer

S3 Components - Buckets

  • Desktop folders
  • Own permission policy
  • Website storage
  • Generate logs

Bucket

Introduction to AWS Boto in Python

S3 Components - Objects

Objects in buckets

Introduction to AWS Boto in Python

What can we do with buckets?

  • Create Bucket
  • List Buckets
  • Delete Bucket

Bucket

Introduction to AWS Boto in Python

Creating a Bucket

Create boto3 client

import boto3
s3 = boto3.client('s3', region_name='us-east-1', 
                         aws_access_key_id=AWS_KEY_ID, 
                         aws_secret_access_key=AWS_SECRET)

Create bucket!

bucket = s3.create_bucket(Bucket='gid-requests')
Introduction to AWS Boto in Python

Bang!

Bang bucket!

Introduction to AWS Boto in Python

Our bucket in the console

Bucket in the console

Introduction to AWS Boto in Python

Listing buckets

Create boto3 client

import boto3
s3 = boto3.client('s3', region_name='us-east-1', 
                         aws_access_key_id=AWS_KEY_ID, 
                         aws_secret_access_key=AWS_SECRET)

List Buckets

bucket_response = s3.list_buckets()
Introduction to AWS Boto in Python

Listing Buckets

Get Buckets Dictionary

buckets = bucket_response['Buckets']
print(buckets)
Introduction to AWS Boto in Python

Listing Buckets

Bucket listing

Introduction to AWS Boto in Python

Deleting buckets

Create boto3 client

import boto3
s3 = boto3.client('s3', region_name='us-east-1', 
                         aws_access_key_id=AWS_KEY_ID, 
                        aws_secret_access_key=AWS_SECRET)

Delete Bucket

response = s3.delete_bucket('gid-requests')
Introduction to AWS Boto in Python

Bye Bye Bucket

Bucket is gone

Introduction to AWS Boto in Python

Bye Bye Bucket

Bucket is gone

Introduction to AWS Boto in Python

Other operations

Boto3 documentation for S3 client

Introduction to AWS Boto in Python

Summary

s3.create_bucket(Bucket='buck')

s3.list_buckets()
s3.delete_bucket(Bucket='buck')

Objects in S3 bucket

Introduction to AWS Boto in Python

Let's practice!

Introduction to AWS Boto in Python

Preparing Video For Download...