简体   繁体   English

google.cloud storage python api在指定位置创建存储桶

[英]google.cloud storage python api create bucket in specified location

I would like to create a bucket in the EU location in google cloud storage. 我想在谷歌云存储的EU位置创建一个存储桶。 How do I set that? 我该怎么设置? The docs don't mention anything. 文档没有提到任何内容。

from google.cloud import storage
client = storage.Client(project=project_id)
client.create_bucket(bucket_name)

Creates a bucket in the US location by default. 默认情况下,在US位置创建一个存储桶。

bucket = Bucket(client, name='bucketname')
bucket.location = 'eu'
bucket.create()

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

相关问题 无法在 python 脚本中使用 google.cloud(存储) - Unable to use google.cloud (storage) from within a python script Apache Beam Jupyter Notebook:ImportError: cannot import name 'storage' from 'google.cloud'(未知位置) - Apache Beam Jupyter Notebook: ImportError: cannot import name 'storage' from 'google.cloud' (unknown location) google.cloud在哪个python库中? - In what python library is google.cloud? 从 google.cloud 导入存储失败:ImportError: No module named google.cloud - from google.cloud import storage fails: ImportError: No module named google.cloud ImportError 无法从“google.cloud”(未知位置)导入“langauge” - ImportError cannot import 'langauge' from 'google.cloud' (unknown location) 使用 Python 将文件上传到 Google Cloud Storage Bucket 子目录 - Upload File to Google Cloud Storage Bucket Sub Directory using Python 从 Google Cloud Function (Python) 将新文件写入 Google Cloud Storage 存储桶 - Writing a new file to a Google Cloud Storage bucket from a Google Cloud Function (Python) 无法从“google.cloud”(未知位置)导入名称“dataproc_v1” - cannot import name 'dataproc_v1' from 'google.cloud' (unknown location) python和谷歌云存储 - python and google cloud storage 云存储python客户端无法检索存储桶 - Cloud Storage python client fails to retrieve bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM