Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import boto3
bucket_name = "annageller"
s3_object = "ted_lasso.txt"
s3_object_body = "Be curious, not judgemental"
s3_resource = boto3.resource("s3")
upload_result = s3_resource.Object(bucket_name, s3_object).put(Body=s3_object_body)
assert upload_result["ResponseMetadata"]["HTTPStatusCode"] == 200
text_file_from_s3 = (
s3_resource.Object(bucket_name, s3_object).get()["Body"].read().decode("utf-8")
assert s3_object_body == text_file_from_s3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment