Created
June 8, 2018 21:38
-
-
Save spdrman/d06e946ea6ab57957e549b60222f26dd to your computer and use it in GitHub Desktop.
Use Boto3 to upload and delete an object from an AWS S3 bucket using given 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
import boto3 | |
session = boto3.Session( | |
aws_access_key_id="id", | |
aws_secret_access_key="secret", | |
region_name="us-east-1" | |
) | |
s3 = session.resource("s3") | |
obj = s3.Object("mybucket", "test.txt") | |
obj.put(Body="testing") | |
# A prompt to stop and check the object was created | |
input("Object created, waiting for input to delete") | |
obj.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment