$cat upload_aws.py
# pip install boto3
import boto3
s3_resource = boto3.resource(
's3',
aws_access_key_id='XXXXXXXXXXXXXXXXXXX',
aws_secret_access_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
region_name='ap-northeast-2',
)
bucket_name='XXX'
souce_path='source.jpg'
target_path='to/target/path/target.jpg'
data = open(souce_path, 'rb')
s3_resource.Bucket(bucket_name).put_object(Body=data, Key=target_path, ACL='private')
$python3 upload_aws.py