Google cloud storage 在自定义位置的Google云存储中创建bucket
我想使用python客户端在欧洲的GCS中创建一个bucketGoogle cloud storage 在自定义位置的Google云存储中创建bucket,google-cloud-storage,google-cloud-python,Google Cloud Storage,Google Cloud Python,我想使用python客户端在欧洲的GCS中创建一个bucket from google.cloud import storage 实例化客户机 新bucket的名称 创建新的存储桶 这在美国创造了一个多地区的桶。如何将其更改为欧洲?创建桶的方法受到限制。对于更多参数,您需要创建一个bucket资源并调用其create()方法,如下所示: storage_client = storage.Client() bucket = storage_client.bucket('bucket-name')
from google.cloud import storage
实例化客户机
新bucket的名称
创建新的存储桶
这在美国创造了一个多地区的桶。如何将其更改为欧洲?创建桶的
方法受到限制。对于更多参数,您需要创建一个bucket资源并调用其create()
方法,如下所示:
storage_client = storage.Client()
bucket = storage_client.bucket('bucket-name')
bucket.create(location='EU')
Bucket.create还有一些其他属性,并且有文档记录:您可以尝试使用以下属性:
def create_bucket(bucket_name):
storage\u client=storage.client()
bucket=存储\客户端。创建\ bucket(bucket\名称,位置='EUROPE-WEST1')
打印(“Bucket{}created.format(Bucket.name))
bucket_name = 'my-new-bucket'
bucket = storage_client.create_bucket(bucket_name)
print('Bucket {} created.'.format(bucket.name))
storage_client = storage.Client()
bucket = storage_client.bucket('bucket-name')
bucket.create(location='EU')