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)
错误:
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
请帮我解决这个问题,存储桶名称、访问密钥和安全密钥均无问题。
ping s3-ap-southeast-1.amazonaws.com
- Rico