python
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)
This is to help see if you have access to a particular bucket on S3
Was this helpful?
Similar Posts
- Python - String , Check If Word Is In string
- Pandas - How to check whether a pandas DataFrame is empty
- Check python version on Mac and Windows
- Evaluate,check before class feald values set, bothe constructor,property option
- Check PyTorch GPU Availability
- Check if a key exist in a dictionary Python
- Check if given value is a number or integer in python