Last active
October 11, 2019 07:22
-
-
Save ryanbekabe/3cc5f0a26e49db8c013cf8b38b7b9d7f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
from botocore.exceptions import NoCredentialsError | |
ACCESS_KEY = 'AxKIAI2772U77ALJUKS5xA' | |
SECRET_KEY = 'bxBVLKyrc2GwJuNGBE8u92AU5W4LyBiZrpIU4q9rxK' | |
def upload_to_aws(local_file, bucket, s3_file): | |
s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY, | |
aws_secret_access_key=SECRET_KEY) | |
try: | |
s3.upload_file(local_file, bucket, s3_file) | |
print("Upload Successful") | |
return True | |
except FileNotFoundError: | |
print("The file was not found") | |
return False | |
except NoCredentialsError: | |
print("Credentials not available") | |
return False | |
uploaded = upload_to_aws('pyrsa.py', 's3neo', 'pyrsa-ok2.py') | |
#uploaded = upload_to_aws('fileonpc.txt', 'bucketname', 'fileonbucket.txt') | |
#https://s3neo.s3-ap-southeast-1.amazonaws.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment