# pip install doto3
I set config etc. by hand, but I get an endpoint error. Error without s3.tokyo .....
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://s3.tokyo.amazonaws.com/"
If you look closely, you can't use tokyo when you specify region in config.
.aws/config
の中で、
region=ap-northeast-1
The user sets the authentication key to ~ / .aws / confidential
by setting it with IamUser of amazon.
Execute from python command line below (see Official Quickstart)
s3 = boto3.resource('s3')
read the list
for bucket in s3.buckets.all():
print(bucket.name)
Upload
data = open('test.jpg', 'rb')
s3.Bucket('my-bucket').put_object(Key='test.jpg', Body=data)
Recommended Posts