AWS_ACCESS_KEY_ID = '<access key>'
AWS_SECRET_ACCESS_KEY = '<my secret key>'
Bucketname = 'Bucket-name'
import boto
from boto.s3.key import Key
import boto.s3.connection
conn = boto.connect_s3(AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,
host ='s3.ap-southeast-1.amazonaws.com',
is_secure=True, # uncommmnt if you are not using ssl
calling_format = boto.s3.connection.OrdinaryCallingFormat(),
)
bucket = conn.get_bucket(Bucketname)
Error:
Traceback (most recent call last):
File "uploads3.py", line 69, in <module>
upload_hello_file_s3()
File "uploads3.py", line 25, in upload_hello_file_s3
bucket = conn.get_bucket(Bucketname)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 431, in get_bucket
bucket.get_all_keys(headers, maxkeys=0)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 364, in get_all_keys
'', headers, **params)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 321, in _get_all
query_args=s)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 543, in make_request
override_num_retries=override_num_retries)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 937, in make_request
return self._mexe(http_request, sender, override_num_retries)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 899, in _mexe
raise e
socket.gaierror: [Errno -2] Name or service not known
please help me to solve this problem there is no problem in bucket name and access key and secret key.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…