s3 pull file

PHOTO EMBED

Thu Jan 26 2023 15:50:57 GMT+0000 (Coordinated Universal Time)

Saved by @praveenms079 #s3 #aws

import boto3

# Create an S3 client
s3 = boto3.client('s3')

# Set the name of the S3 bucket and the file key
bucket_name = 'my-bucket'
file_key = 'path/to/file.txt'

# Use the S3 client to get the object
response = s3.get_object(Bucket=bucket_name, Key=file_key)

# Extract the file content from the response
file_content = response['Body'].read()

# Print the file content
print(file_content)
content_copyCOPY