Roman
Roman

Reputation: 9441

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. 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.

Upvotes: 3

Views: 1457

Answers (1)

Brandon Yarbrough
Brandon Yarbrough

Reputation: 38369

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

Upvotes: 6

Related Questions