Explorarea bucket-urilor

Introducere în AWS Boto în Python

Maksim Pecherskiy

Data Engineer

Componente S3 - Bucket-uri

  • Foldere desktop
  • Politică de permisiuni proprie
  • Stocare pentru site-uri web
  • Generare jurnale

Bucket

Introducere în AWS Boto în Python

Componente S3 - Obiecte

Obiecte în bucket-uri

Introducere în AWS Boto în Python

Ce putem face cu bucket-urile?

  • Creare bucket
  • Listare bucket-uri
  • Ștergere bucket

Bucket

Introducere în AWS Boto în Python

Crearea unui bucket

Creare client boto3

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

Creare bucket!

bucket = s3.create_bucket(Bucket='gid-requests')
Introducere în AWS Boto în Python

Bang!

Bang bucket!

Introducere în AWS Boto în Python

Bucket-ul nostru în consolă

Bucket în consolă

Introducere în AWS Boto în Python

Listarea bucket-urilor

Creare client boto3

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

Listare bucket-uri

bucket_response = s3.list_buckets()
Introducere în AWS Boto în Python

Listarea bucket-urilor

Obținere dicționar bucket-uri

buckets = bucket_response['Buckets']
print(buckets)
Introducere în AWS Boto în Python

Listarea bucket-urilor

Listă bucket-uri

Introducere în AWS Boto în Python

Ștergerea bucket-urilor

Creare client boto3

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

Ștergere bucket

response = s3.delete_bucket('gid-requests')
Introducere în AWS Boto în Python

La revedere, bucket!

Bucket-ul a dispărut

Introducere în AWS Boto în Python

La revedere, bucket!

Bucket-ul a dispărut

Introducere în AWS Boto în Python

Alte operații

Documentație boto3 pentru clientul S3

Introducere în AWS Boto în Python

Rezumat

s3.create_bucket(Bucket='buck')

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

Obiecte în bucket S3

Introducere în AWS Boto în Python

Să exersăm!

Introducere în AWS Boto în Python

Preparing Video For Download...