- NAME
-
- gcloud storage buckets create - create buckets for storing objects
- SYNOPSIS
-
-
gcloud storage buckets create
URL
[URL
…] [--additional-headers
=HEADER
=VALUE
] [--default-encryption-key
=DEFAULT_ENCRYPTION_KEY
,-k
DEFAULT_ENCRYPTION_KEY
] [--default-storage-class
=DEFAULT_STORAGE_CLASS
,-c
DEFAULT_STORAGE_CLASS
,-s
DEFAULT_STORAGE_CLASS
] [--enable-hierarchical-namespace
] [--enable-per-object-retention
] [--location
=LOCATION
,-l
LOCATION
] [--[no-]pap
,--[no-]public-access-prevention
] [--placement
=[REGION
,…]] [--recovery-point-objective
=SETTING
,--rpo
=SETTING
] [--retention-period
=RETENTION_PERIOD
] [--soft-delete-duration
=SOFT_DELETE_DURATION
] [--[no-]uniform-bucket-level-access
,-b
] [--autoclass-terminal-storage-class
=AUTOCLASS_TERMINAL_STORAGE_CLASS
--[no-]enable-autoclass
] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
- Create new buckets.
- EXAMPLES
-
The following command creates 2 Cloud Storage buckets, one named
and a second bucket namedmy-bucket
:my-other-bucket
gcloud storage buckets create gs://my-bucket gs://my-other-bucket
The following command creates a bucket with the
default storage class in thenearline
location:asia
gcloud storage buckets create gs://my-bucket --default-storage-class=nearline --location=asia
- POSITIONAL ARGUMENTS
-
URL
[URL
…]- The URLs of the buckets to create.
- FLAGS
-
--additional-headers
=HEADER
=VALUE
-
Includes arbitrary headers in storage API calls. Accepts a comma separated list
of key=value pairs, e.g.
header1=value1,header2=value2
. Overrides the defaultstorage/additional_headers
property value for this command invocation. --default-encryption-key
=DEFAULT_ENCRYPTION_KEY
,-k
DEFAULT_ENCRYPTION_KEY
-
Set the default KMS key using the full path to the key, which has the following
form:
.projects/[project-id]/locations/[location]/keyRings/[key-ring]/cryptoKeys/[my-key]
--default-storage-class
=DEFAULT_STORAGE_CLASS
,-c
DEFAULT_STORAGE_CLASS
,-s
DEFAULT_STORAGE_CLASS
- Default storage class for the bucket. If not specified, the default storage class used by Cloud Storage is "Standard".
--enable-hierarchical-namespace
- Enable hierarchical namespace for the bucket. To use this flag, you must also use --uniform-bucket-level-access
--enable-per-object-retention
- Enables each object in the bucket to have its own retention settings, which prevents deletion until stored for a specific length of time.
--location
=LOCATION
,-l
LOCATION
-
Location for the
bucket. If not specified, the location used by Cloud Storage is
. A bucket's location cannot be changed after creation.us
--[no-]pap
,--[no-]public-access-prevention
-
Sets public access prevention to "enforced". For details on how exactly public
access is blocked, see: http://cloud.google.com/storage/docs/public-access-prevention.
Use
--public-access-prevention
to enable and--no-public-access-prevention
to disable. --placement
=[REGION
,…]- A comma-separated list of regions that form the custom dual-region. Only regions within the same continent are or will ever be valid. Invalid location pairs (such as mixed-continent, or with unsupported regions) will return an error.
--recovery-point-objective
=SETTING
,--rpo
=SETTING
-
Sets the recovery
point objective of a bucket. This flag can only be used with multi-region
and dual-region buckets.
DEFAULT
option is valid for multi-region and dual-regions buckets.ASYNC_TURBO
option is only valid for dual-region buckets. If unspecified when the bucket is created, it defaults toDEFAULT
for dual-region and multi-region buckets. For more information, see replication in Cloud Storage.SETTING
must be one of:ASYNC_TURBO
,DEFAULT
. --retention-period
=RETENTION_PERIOD
-
Minimum retention
period for objects stored in the bucket, for example
. Objects added to the bucket cannot be deleted until they've been stored for the specified length of time. Default is no retention period. Only available for Cloud Storage using the JSON API.--retention-period=1Y1M1D5S
--soft-delete-duration
=SOFT_DELETE_DURATION
-
Duration to retain soft-deleted objects. For example, "2w1d" is two weeks and
one day. The presence of this flag creates a bucket with a soft delete policy
enabled, meaning deleted objects can be restored if requested within the
inputted duration. See
gcloud topic datetimes
for more information on the duration format. --[no-]uniform-bucket-level-access
,-b
-
Turns on uniform bucket-level access setting. Default is False. Use
--uniform-bucket-level-access
to enable and--no-uniform-bucket-level-access
to disable.
- AUTOCLASS FLAGS
-
--autoclass-terminal-storage-class
=AUTOCLASS_TERMINAL_STORAGE_CLASS
- The storage class that objects in the bucket eventually transition to if they are not read for a certain length of time. Only valid if Autoclass is enabled.
--[no-]enable-autoclass
-
The Autoclass feature automatically selects the best storage class for objects
based on access patterns. Use
--enable-autoclass
to enable and--no-enable-autoclass
to disable.
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file
,--account
,--billing-project
,--configuration
,--flags-file
,--flatten
,--format
,--help
,--impersonate-service-account
,--log-http
,--project
,--quiet
,--trace-token
,--user-output-enabled
,--verbosity
.Run
$ gcloud help
for details. - NOTES
-
This variant is also available:
gcloud alpha storage buckets create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-10 UTC.