我试图在s3中使用USEast1作为位置create a bucket。在
from boto.s3.connection import Location
mybucket = 'test-voip1'
conn = boto.connect_s3(aws_access_key_id, aws_secret_access_key)
if conn.lookup(mybucket) is None:
conn.create_bucket(mybucket, location=Location.USEast1)
# conn.create_bucket(mybucket)
当我尝试运行时,它会给我一个属性错误
^{pr2}$我可以连接以创建连接,并且可以创建一个以USWest为位置的bucket。在安装boto时,我没有得到任何错误,但为什么我得到这个错误?在
即使我试过用boto3
session = boto3.Session(aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key)
s3 = session.resource('s3')
s3.create_bucket(Bucket='mybucket', CreateBucketConfiguration={'LocationConstraint': 'us-east-1'})
我也有类似的错误
botocore.exceptions.ClientError: An error occurred (InvalidLocationConstraint) when calling the CreateBucket operation: The specified location-constraint is not valid
如何解决错误?在
当我试图检查s3中其他先前创建的bucket的位置时
bucket = conn.get_bucket('ml-vectors')
bucket.get_location()
>> ''
它是空的,我无法检查其他桶是如何在我的s3中创建的。在
一旦查看AWS中Location类的定义,就可以理解所得到的错误连接.py公司名称:
正如你所见,这是没有用的。这个问题的解决方案可以在下面的引文中找到:
您可以在以下网站上找到完整的讨论: https://github.com/elastic/elasticsearch/issues/16978
相关问题 更多 >
编程相关推荐