简体   繁体   English

在Amazon AWS中使用python中的boto创建S3存储桶失败…

[英]Creating a S3 bucket in Amazon AWS with boto in python fails …

import boto
import boto.s3
import boto.s3.connection

conn = boto.s3.connect_to_region(
'us-west-2', 
aws_access_key_id='MY_KEY', 
aws_secret_access_key='MY_ACCESS_KEY'
)

conn.create_bucket('bucket_in_west')

And I get this error: 我得到这个错误:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/user/.virtualenvs/west-tests/lib/python2.7/site-packages/boto/s3/connection.py", line 621, in create_bucket
    response.status, response.reason, body)
S3ResponseError: S3ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>IllegalLocationConstraintException</Code><Message>The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.</Message><RequestId>0C0F09FBC87

Does anybody have an answer for how to create an S3 bucket in a specific region with boto? 是否有人对如何使用Boto在特定区域创建S3存储桶有答案?

如果您正在与us-west-2端点通信,并且想要在该区域中创建存储桶,则在调用create_bucket时必须指定该存储桶:

conn.create_bucket('bucket-in-west', location='us-west-2')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python boto - 没有存储桶名称的 AWS S3 访问 - python boto - AWS S3 access without a bucket name 如何使用Boto使用python监视AWS S3存储桶? - How to monitor a AWS S3 bucket with python using boto? python boto3:AWS Rekognition无法访问S3存储桶 - python boto3: AWS Rekognition is unable to access S3 bucket python boto3 for AWS - S3 Bucket Sync 优化 - python boto3 for AWS - S3 Bucket Sync optimization 使用boto + Python,Amazon S3上传失败 - Amazon S3 upload fails using boto + Python 如何使用Boto在Amazon S3上使用python脚本将文件从一个存储桶复制到另一个存储桶 - How to use python script to copy files from one bucket to another bucket at the Amazon S3 with boto 如何在Python(Boto lib)中像在Openstack Swift中那样获取Amazon S3存储桶的元数据/标头? - How to get metadata/headers of an Amazon S3 Bucket in Python (Boto lib) like in Openstack Swift? 如何使用 python (boto3) 连接到带有 pem 文件的 Amazon S3 存储桶 - How do I connect to an Amazon S3 bucket with a pem file using python (boto3) Boto3 Amazon S3(Python软件包)-仅获取满足条件的文件(已过滤的bucket.list()) - Boto3 Amazon S3 (Python package) - getting only files that fill a condition (a filtered bucket.list()) 在亚马逊s3 boto bucket中设置特定权限 - Setting specific permission in amazon s3 boto bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM