Adding and removing files in bucket using cloud SDK.

  • date 18th March, 2021 |
  • by Prwatech |
  • 0 Comments

gsutil commands for Cloud Storage objects

 

Google Cloud Storage provides a powerful and scalable object storage solution for storing and managing various types of data in the cloud. One of the primary tools for interacting with Cloud Storage objects is the Google Cloud SDK’s gsutil command-line tool. This introduction provides an overview of common gsutil commands used for managing Cloud Storage objects.

With gsutil, users can perform a wide range of operations on Cloud Storage objects, including uploading and downloading files, copying objects between buckets, setting access control permissions, and managing object metadata.

For uploading files to Cloud Storage, the gsutil cp command is used, allowing users to copy files from local storage to Cloud Storage buckets or between Cloud Storage buckets. Similarly, the gsutil rsync command enables efficient synchronization of local directories with Cloud Storage buckets.

When it comes to managing object metadata and permissions, gsutil provides commands such as acl, label, and metadata for setting access control lists (ACLs), adding custom metadata, and modifying object attributes.

Prerequisites

Hardware : GCP

Google Account

We can add and remove files in GCP bucket using cloud SDK. It is much suitable when we are using the cloud console in our local machine.

Open cloud SDK

To copy file from local machine to bucket

$       gsutil cp <file-path> /<filename-with-extension> gs://<bucket-name>

Using cloud SDK

To copy file from bucket to local machine

$       gsutil cp gs://<bucket-name>/<file-name> <destination-path>/<filename-with-extension>

Using cloud Shell

To copy file from one bucket to another bucket

$       gsutil cp gs://<bucket-1-name>/<file-name-with-extension> gs://<bucket-2-name->/<filename with extension>

Using cloud shell

gsutil commands for Cloud Storage objects

 

0
0

Quick Support

image image