Search code snippets, questions, articles...

Check S3 Bucket

import os
import boto3
from botocore.exceptions import ClientError

client = boto3.client(
    's3',
    # Hard coded strings as credentials, not recommended.
    aws_access_key_id='',
    aws_secret_access_key=''
)
s3 = boto3.resource(
    's3',
    # Hard coded strings as credentials, not recommended.
    aws_access_key_id='',
    aws_secret_access_key=''
)
        
# print(bucket_subfolder)
bucket = 'bucket-name'

for my_bucket_object in s3.Bucket(bucket).objects.all():
    print(my_bucket_object)
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

This is to help see if you have access to a particular bucket on S3

Was this helpful?
0 Comments