Diving into buckets

Introducción a AWS Boto en Python

Maksim Pecherskiy

Data Engineer

S3 Components - Buckets

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

Bucket

Introducción a AWS Boto en Python

S3 Components - Objects

Objects in buckets

Introducción a AWS Boto en Python

What can we do with buckets?

  • Create Bucket
  • List Buckets
  • Delete Bucket

Bucket

Introducción a AWS Boto en 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')
Introducción a AWS Boto en Python

Bang!

Bang bucket!

Introducción a AWS Boto en Python

Our bucket in the console

Bucket in the console

Introducción a AWS Boto en 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()
Introducción a AWS Boto en Python

Listing Buckets

Get Buckets Dictionary

buckets = bucket_response['Buckets']
print(buckets)
Introducción a AWS Boto en Python

Listing Buckets

Bucket listing

Introducción a AWS Boto en 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')
Introducción a AWS Boto en Python

Bye Bye Bucket

Bucket is gone

Introducción a AWS Boto en Python

Bye Bye Bucket

Bucket is gone

Introducción a AWS Boto en Python

Other operations

Boto3 documentation for S3 client

Introducción a AWS Boto en Python

Summary

s3.create_bucket(Bucket='buck')

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

Objects in S3 bucket

Introducción a AWS Boto en Python

Let's practice!

Introducción a AWS Boto en Python

Preparing Video For Download...