gcloud alpha storage restore

NAME
gcloud alpha storage restore - restore one or more soft-deleted objects
SYNOPSIS
gcloud alpha storage restore[URLS …][--all-versions,-a][--async][--[no-]preserve-acl,-p][--read-paths-from-stdin,-I][--allow-overwrite--created-after-time=CREATED_AFTER_TIME--created-before-time=CREATED_BEFORE_TIME--deleted-after-time=DELETED_AFTER_TIME--deleted-before-time=DELETED_BEFORE_TIME][--if-generation-match=GENERATION--if-metageneration-match=METAGENERATION][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) The restore command restores soft-deleted resources:
gcloudalphastoragerestoreurl…
EXAMPLES
Restore soft-deleted version of bucket with generations:
gcloudalphastoragerestoregs://bucket#123

Restore several soft-deleted buckets with generations:

gcloudalphastoragerestoregs://bucket1#123gs://bucket2#456

Restore latest soft-deleted version of object in a bucket.

gcloudalphastoragerestoregs://bucket/file1.txt

Restore a specific soft-deleted version of object in a bucket by specifying thegeneration.

gcloudalphastoragerestoregs://bucket/file1.txt#123

Restore all soft-deleted versions of object in a bucket.

gcloudalphastoragerestoregs://bucket/file1.txt--all-versions

Restore several objects in a bucket (with or without generation):

gcloudalphastoragerestoregs://bucket/file1.txtgs://bucket/file2.txt#456

Restore the latest soft-deleted version of all text objects in a bucket:

gcloudalphastoragerestoregs://bucket/**.txt

Restore a list of objects read from stdin (with or without generation):

catlist-of-files.txt|gcloudalphastoragerestore--read-paths-from-stdin

Restore object with its original ACL policy:

gcloudalphastoragerestoregs://bucket/file1.txt--preserve-acl

Restore all objects in a bucket asynchronously:

gcloudalphastoragerestoregs://bucket/**--async

Restore all text files in a bucket asynchronously:

gcloudalphastoragerestoregs://bucket/**.txt--async

Restore objects created within a specific time range:

gcloudalphastoragerestoregs://bucket/**--async--created-after-time="2023-01-01T00:00:00Z"--created-before-time="2023-01-31T23:59:59Z"

Restore objects soft-deleted within a specific time range:

gcloudalphastoragerestoregs://bucket/**--async--deleted-after-time="2023-01-01T00:00:00Z"--deleted-before-time="2023-01-31T23:59:59Z"

Restore objects using a combination of creation and deletion time filters:

gcloudalphastoragerestoregs://bucket/**--async--allow-overwrite--created-after-time="2023-01-01T00:00:00Z"--deleted-after-time="2023-01-01T00:00:00Z"

This command filters the objects that were live at 2023-01-01T00:00:00Z and thensoft-deleted afterwards. This combination of filters is especially helpful ifthere is a period of erroneous overwrites. They allow you to go back to thepoint just before the overwrites began. You will also need to set the--allow-overwrite option to true.

POSITIONAL ARGUMENTS
[URLS …]
The url of objects to list.
FLAGS
SYNCHRONOUS RESTORE OPTIONS
--all-versions,-a
Restores all versions of soft-deleted objects.

This flag is only useful for buckets with [object versioning](https://cloud.google.com/storage/docs/object-versioning) enabled. In this case,the latest soft-deleted version will become live and the previous generationswill become noncurrent.

If versioning is disabled, the latest soft-deleted version will become live andprevious generations will be soft-deleted again.

This flag disables parallelism to preserve version order.

--async
Initiates an asynchronous bulk restore operation on the specified bucket.
--[no-]preserve-acl,-p
Preserves ACLs when copying in the cloud. This option is Cloud Storage-only, andyou need OWNER access to all copied objects. If all objects in the destinationbucket should have the same ACL, you can also set a default object ACL on thatbucket instead of using this flag. Preserving ACLs is the default behavior forupdating existing objects. Use--preserve-acl to enable and--no-preserve-acl to disable.
--read-paths-from-stdin,-I
Read the list of URLs from stdin.
BULK RESTORE OPTIONS
--allow-overwrite
If included, live objects will be overwritten. If versioning is enabled, thiswill result in a noncurrent object. If versioning is not enabled, this willresult in a soft-deleted object.
--created-after-time=CREATED_AFTER_TIME
Restores only the objects that were created after this time.
--created-before-time=CREATED_BEFORE_TIME
Restores only the objects that were created before this time.
--deleted-after-time=DELETED_AFTER_TIME
Restores only the objects that were soft-deleted after this time.
--deleted-before-time=DELETED_BEFORE_TIME
Restores only the objects that were soft-deleted before this time.
PRECONDITION FLAGS
--if-generation-match=GENERATION
Execute only if the generation matches the generation of the requested object.
--if-metageneration-match=METAGENERATION
Execute only if the metageneration matches the metageneration of the requestedobject.
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 command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. This variant is also available:
gcloudstoragerestore

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-21 UTC.