1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-12 07:58:28 +00:00
gcloud-help/gcloud/storage/buckets/create

159 lines
6.9 KiB
Text
Raw Normal View History

2022-09-14 09:28:28 +00:00
NAME
gcloud storage buckets create - create buckets for storing objects
SYNOPSIS
2023-07-26 10:48:49 +00:00
gcloud storage buckets create URL [URL ...]
[--additional-headers=HEADER=VALUE]
2022-09-14 09:28:28 +00:00
[--default-encryption-key=DEFAULT_ENCRYPTION_KEY,
-k DEFAULT_ENCRYPTION_KEY]
[--default-storage-class=DEFAULT_STORAGE_CLASS,
-c DEFAULT_STORAGE_CLASS, -s DEFAULT_STORAGE_CLASS]
2024-10-16 09:53:35 +00:00
[--enable-hierarchical-namespace] [--enable-per-object-retention]
2025-02-05 10:43:28 +00:00
[--lifecycle-file=LIFECYCLE_FILE] [--location=LOCATION, -l LOCATION]
2022-09-14 09:28:28 +00:00
[--[no-]pap, --[no-]public-access-prevention]
2024-11-20 10:03:22 +00:00
[--placement=[REGION,...]]
2023-01-19 00:56:33 +00:00
[--recovery-point-objective=SETTING, --rpo=SETTING]
2022-09-14 09:28:28 +00:00
[--retention-period=RETENTION_PERIOD]
2023-11-09 11:45:52 +00:00
[--soft-delete-duration=SOFT_DELETE_DURATION]
2023-11-01 10:29:29 +00:00
[--[no-]uniform-bucket-level-access, -b]
[--autoclass-terminal-storage-class=AUTOCLASS_TERMINAL_STORAGE_CLASS
--[no-]enable-autoclass] [GCLOUD_WIDE_FLAG ...]
2022-09-14 09:28:28 +00:00
DESCRIPTION
2023-07-26 10:48:49 +00:00
Create new buckets.
2022-09-14 09:28:28 +00:00
EXAMPLES
2023-07-26 10:48:49 +00:00
The following command creates 2 Cloud Storage buckets, one named my-bucket
and a second bucket named my-other-bucket:
2022-09-14 09:28:28 +00:00
2023-07-26 10:48:49 +00:00
$ gcloud storage buckets create gs://my-bucket gs://my-other-bucket
2022-09-14 09:28:28 +00:00
The following command creates a bucket with the nearline default storage
class (https://cloud.google.com/storage/docs/storage-classes) in the asia
location (https://cloud.google.com/storage/docs/locations):
$ gcloud storage buckets create gs://my-bucket \
--default-storage-class=nearline --location=asia
POSITIONAL ARGUMENTS
2023-07-26 10:48:49 +00:00
URL [URL ...]
The URLs of the buckets to create.
2022-09-14 09:28:28 +00:00
FLAGS
2023-01-19 00:56:33 +00:00
--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 default storage/additional_headers property value for
this command invocation.
2022-09-14 09:28:28 +00:00
--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
(https://cloud.google.com/storage/docs/storage-classes) for the bucket.
If not specified, the default storage class used by Cloud Storage is
"Standard".
2024-10-16 09:53:35 +00:00
--enable-hierarchical-namespace
Enable hierarchical namespace for the bucket. To use this flag, you
must also use --uniform-bucket-level-access
2023-11-15 11:42:54 +00:00
--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.
2025-02-05 10:43:28 +00:00
--lifecycle-file=LIFECYCLE_FILE
Sets the lifecycle management configuration on a bucket. For example,
The following lifecycle management configuration JSON document
specifies that all objects in this bucket that are more than 365 days
old are deleted automatically:
{
"rule":
[
{
"action": {"type": "Delete"},
"condition": {"age": 365}
}
]
}
2022-09-14 09:28:28 +00:00
--location=LOCATION, -l LOCATION
Location (https://cloud.google.com/storage/docs/locations) for the
bucket. If not specified, the location used by Cloud Storage is us. A
bucket's location cannot be changed after creation.
--[no-]pap, --[no-]public-access-prevention
Sets public access prevention to "enforced". For details on how exactly
public access is blocked, see:
2023-01-19 00:56:33 +00:00
http://cloud.google.com/storage/docs/public-access-prevention. Use
2022-09-14 09:28:28 +00:00
--public-access-prevention to enable and --no-public-access-prevention
to disable.
2024-11-20 10:03:22 +00:00
--placement=[REGION,...]
2024-12-11 10:18:23 +00:00
A comma-separated list of regions that form the custom dual-region
2024-09-11 09:52:17 +00:00
(https://cloud.google.com/storage/docs/locations#location-dr). 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.
2023-01-19 00:56:33 +00:00
--recovery-point-objective=SETTING, --rpo=SETTING
Sets the recovery point objective
(https://cloud.google.com/architecture/dr-scenarios-planning-guide#basics_of_dr_planning)
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 to
DEFAULT for dual-region and multi-region buckets. For more information,
2023-06-15 10:31:27 +00:00
see replication in Cloud Storage
(https://cloud.google.com/storage/docs/availability-durability#cross-region-redundancy).
SETTING must be one of: ASYNC_TURBO, DEFAULT.
2023-01-19 00:56:33 +00:00
2022-09-14 09:28:28 +00:00
--retention-period=RETENTION_PERIOD
Minimum retention period
(https://cloud.google.com/storage/docs/bucket-lock#retention-periods)
for objects stored in the bucket, for example
2025-04-30 11:00:00 +00:00
--retention-period=P1Y1M1DT5S. Objects added to the bucket cannot be
2022-09-14 09:28:28 +00:00
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.
2023-11-09 11:45:52 +00:00
--soft-delete-duration=SOFT_DELETE_DURATION
Duration to retain soft-deleted objects. For example, "2w1d" is two
2025-02-12 10:41:39 +00:00
weeks and one day. See gcloud topic datetimes for more information on
the duration format. Setting 0 will disable soft delete policy on the
bucket. Default is 7 days.
2023-11-09 11:45:52 +00:00
2022-09-14 09:28:28 +00:00
--[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.
2023-10-05 11:50:16 +00:00
AUTOCLASS FLAGS
2023-11-01 10:29:29 +00:00
--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.
2023-10-05 11:50:16 +00:00
--[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.
2022-09-14 09:28:28 +00:00
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