Last active
January 10, 2023 22:07
-
-
Save enricofer/21d8975d5ee0487920609f99f0a5ffa7 to your computer and use it in GitHub Desktop.
List s3 public bucket objects without AWS credentials
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install boto3 | |
import boto3 | |
import botocore | |
s3client = boto3.client('s3', region_name='eu-central-1') #specify aws region | |
#exclude credential signing, otherwise, without providind AWS credential you will get a "NoCredentialsError" | |
s3client.meta.events.register('choose-signer.s3.*', botocore.handlers.disable_signing) | |
objects = s3client.list_objects(Bucket='vito.landcover.global') | |
for item in objects["Contents"]: | |
print (item["key"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment