Trigger: Use when working with Google Cloud Google Cloud Storage — setup, configuration, and best practices.
Google Cloud Storage Basics
Google Cloud Storage (GCS) is a managed service for storing data as objects at
any scale. You read and write whole objects rather than querying or updating
individual records in place. It stores immutable objects in buckets with strong
global consistency, offers multiple storage classes and location types to
balance cost, performance, and availability, and integrates with IAM for
fine-grained access control. GCS serves workloads ranging from website content
and backups to data lakes and high-throughput AI/ML training.
Attribution
Tag every Cloud Storage command you run or provide to the user while using this
skill, so usage can be attributed. The tag identifies only the skill and its
version; it carries no user data.
Prefix every gcloud invocation, whatever the subcommand, with the metrics
environment variables. Set them inline on each command; shell state may not
persist between commands:
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
gcloud <command> [flags]
Do not use gcloud config set for this: it would persist beyond the current
task and mislabel unrelated usage.
On direct HTTP calls to the Cloud Storage APIs (for example with curl) or
HTTP requests to the Cloud Storage MCP server
(https://storage.googleapis.com/storage/mcp), set this exact User-Agent
header, verbatim — the collection pipeline parses the gcs-skills/<version>
and skill:<name> tokens, so any rewording breaks attribution:
User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)
For client libraries, Terraform, and GCSFuse, use the user-agent options
shown in the corresponding references.
Quick Start
If a Cloud Storage MCP server is connected, prefer its structured tools (such as
create_bucket, list_objects, read_object, and upload_object) over the
CLI and API commands below — see MCP Usage. Fall back
to gcloud storage and the JSON API when no MCP server is available.
Enable the Cloud Storage API:
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
gcloud services enable storage.googleapis.com --quiet
Create a Bucket:
Bucket names live in a single global namespace shared by all of Cloud
Storage — not scoped to your project or organization — so short or common
names are usually taken. If the location is omitted, the bucket defaults to
the US multi-region.
Using the gcloud CLI:
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
gcloud storage buckets create gs://my-bucket --location=us-central1
Using the JSON API:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
-H "Content-Type: application/json" \
-d '{"name": "my-bucket", "location": "US-CENTRAL1"}' \
"https://storage.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)"
Upload an Object:
Using the gcloud CLI:
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
gcloud storage cp ./my-file.txt gs://my-bucket
Using the JSON API:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
-H "Content-Type: text/plain" \
--data-binary @my-file.txt \
"https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=media&name=my-file.txt"
Download an Object:
Using the gcloud CLI:
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
gcloud storage cp gs://my-bucket/my-file.txt .
Using the JSON API:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
"https://storage.googleapis.com/storage/v1/b/my-bucket/o/my-file.txt?alt=media"
Reference Directory
Core Concepts: Buckets, objects, folders,
prefixes, bucket location types, and storage classes.
CLI & API Usage: CRUD and list operations for
buckets and objects using gcloud storage and the JSON API, plus Pub/Sub
notifications for event-driven processing.
Client Libraries: Using Google Cloud
client libraries for Python, Java, Node.js, and Go, with pointers to all
other supported languages.
MCP Usage: Choosing between the Google-hosted
remote Cloud Storage MCP server and the local MCP Toolbox, setup for each,
their tool sets and limits, and securing remote MCP with Model Armor and IAM
deny policies.
Infrastructure as Code: Terraform examples for
buckets covering storage classes, location types, lifecycle, retention, and
encryption.
Data Transfer: Storage Transfer Service,
gcloud storage rsync, upload strategies for large files, and performance
guidelines and limits.
Data Management: IAM roles, authentication
(including signed URLs and HMAC), access control, network security,
automated security assessment, data protection, and pricing and cost
optimization (lifecycle rules, Autoclass).
Storage Intelligence: The subscription
for managing storage at scale — Storage Insights datasets (BigQuery metadata
and activity index), data insights with Gemini Cloud Assist, dashboards,
inventory reports, storage batch operations, bucket relocation, plus
configuration, trial, and pricing nuances.
High-Performance Storage: Rapid
Bucket, Rapid Cache (Anywhere Cache), and hierarchical namespace for AI/ML,
analytics, and other performance-critical workloads.
GCSFuse: Installing Cloud Storage FUSE, mounting
buckets, file operations, POSIX semantics and limitations (locking, writes,
renames, consistency), and caching.
1---2name: google-cloud-storage-basics3description: **Trigger**: Use when working with Google Cloud Google Cloud Storage — setup, configuration, and best practices.4---56**Trigger**: Use when working with Google Cloud Google Cloud Storage — setup, configuration, and best practices.78# Google Cloud Storage Basics910Google Cloud Storage (GCS) is a managed service for storing data as objects at11any scale. You read and write whole objects rather than querying or updating12individual records in place. It stores immutable objects in buckets with strong13global consistency, offers multiple storage classes and location types to14balance cost, performance, and availability, and integrates with IAM for15fine-grained access control. GCS serves workloads ranging from website content16and backups to data lakes and high-throughput AI/ML training.1718## Attribution1920Tag every Cloud Storage command you run or provide to the user while using this21skill, so usage can be attributed. The tag identifies only the skill and its22version; it carries no user data.2324- Prefix every `gcloud` invocation, whatever the subcommand, with the metrics25 environment variables. Set them inline on each command; shell state may not26 persist between commands:2728 ```bash29 CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \30 gcloud <command> [flags]31 ```3233 Do not use `gcloud config set` for this: it would persist beyond the current34 task and mislabel unrelated usage.3536- On direct HTTP calls to the Cloud Storage APIs (for example with `curl`) or37 HTTP requests to the Cloud Storage MCP server38 (`https://storage.googleapis.com/storage/mcp`), set this exact User-Agent39 header, verbatim — the collection pipeline parses the `gcs-skills/<version>`40 and `skill:<name>` tokens, so any rewording breaks attribution:4142 ```43 User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)44 ```4546- For client libraries, Terraform, and GCSFuse, use the user-agent options47 shown in the corresponding references.4849## Quick Start5051If a Cloud Storage MCP server is connected, prefer its structured tools (such as52`create_bucket`, `list_objects`, `read_object`, and `upload_object`) over the53CLI and API commands below — see [MCP Usage](references/mcp-usage.md). Fall back54to `gcloud storage` and the JSON API when no MCP server is available.55561. **Enable the Cloud Storage API:**5758 ```bash59 CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \60 gcloud services enable storage.googleapis.com --quiet61 ```62632. **Create a Bucket:**6465 Bucket names live in a single global namespace shared by all of Cloud66 Storage — not scoped to your project or organization — so short or common67 names are usually taken. If the location is omitted, the bucket defaults to68 the `US` multi-region.6970 Using the gcloud CLI:7172 ```bash73 CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \74 gcloud storage buckets create gs://my-bucket --location=us-central175 ```7677 Using the JSON API:7879 ```bash80 curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \81 -H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \82 -H "Content-Type: application/json" \83 -d '{"name": "my-bucket", "location": "US-CENTRAL1"}' \84 "https://storage.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)"85 ```86873. **Upload an Object:**8889 Using the gcloud CLI:9091 ```bash92 CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \93 gcloud storage cp ./my-file.txt gs://my-bucket94 ```9596 Using the JSON API:9798 ```bash99 curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \100 -H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \101 -H "Content-Type: text/plain" \102 --data-binary @my-file.txt \103 "https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=media&name=my-file.txt"104 ```1051064. **Download an Object:**107108 Using the gcloud CLI:109110 ```bash111 CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \112 gcloud storage cp gs://my-bucket/my-file.txt .113 ```114115 Using the JSON API:116117 ```bash118 curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \119 -H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \120 "https://storage.googleapis.com/storage/v1/b/my-bucket/o/my-file.txt?alt=media"121 ```122123## Reference Directory124125- [Core Concepts](references/core-concepts.md): Buckets, objects, folders,126 prefixes, bucket location types, and storage classes.127128- [CLI & API Usage](references/cli-api-usage.md): CRUD and list operations for129 buckets and objects using `gcloud storage` and the JSON API, plus Pub/Sub130 notifications for event-driven processing.131132- [Client Libraries](references/client-library-usage.md): Using Google Cloud133 client libraries for Python, Java, Node.js, and Go, with pointers to all134 other supported languages.135136- [MCP Usage](references/mcp-usage.md): Choosing between the Google-hosted137 remote Cloud Storage MCP server and the local MCP Toolbox, setup for each,138 their tool sets and limits, and securing remote MCP with Model Armor and IAM139 deny policies.140141- [Infrastructure as Code](references/iac-usage.md): Terraform examples for142 buckets covering storage classes, location types, lifecycle, retention, and143 encryption.144145- [Data Transfer](references/data-transfer.md): Storage Transfer Service,146 `gcloud storage rsync`, upload strategies for large files, and performance147 guidelines and limits.148149- [Data Management](references/data-management.md): IAM roles, authentication150 (including signed URLs and HMAC), access control, network security,151 automated security assessment, data protection, and pricing and cost152 optimization (lifecycle rules, Autoclass).153154- [Storage Intelligence](references/storage-intelligence.md): The subscription155 for managing storage at scale — Storage Insights datasets (BigQuery metadata156 and activity index), data insights with Gemini Cloud Assist, dashboards,157 inventory reports, storage batch operations, bucket relocation, plus158 configuration, trial, and pricing nuances.159160- [High-Performance Storage](references/high-performance-storage.md): Rapid161 Bucket, Rapid Cache (Anywhere Cache), and hierarchical namespace for AI/ML,162 analytics, and other performance-critical workloads.163164- [GCSFuse](references/gcsfuse.md): Installing Cloud Storage FUSE, mounting165 buckets, file operations, POSIX semantics and limitations (locking, writes,166 renames, consistency), and caching.