1
---
2
name: google-cloud-storage-basics
3
description: >-
4
Stores, retrieves, and manages data as objects in Cloud Storage on Google
5
Cloud (also known colloquially as GCS) buckets. Use when you need to interact
6
with Cloud Storage — set up a Storage MCP server (remote or local Toolbox),
7
create or configure buckets, upload, download, stream, or transfer data,
8
organize objects with folders, generate signed URLs, control access (IAM,
9
ACLs, public access prevention), set storage classes (Standard, Nearline,
10
Coldline, Archive), manage lifecycle and cost, protect data (versioning,
11
CMEK, retention, Bucket Lock, holds, soft delete), host static websites,
12
trigger Pub/Sub notifications, mount buckets (gcsfuse), or optimize
13
performance. Covers gcloud storage / gsutil, JSON/XML APIs, client
14
libraries, Terraform, and Cloud Storage MCP servers. Don't use for generic
15
MCP setup that doesn't mention Cloud Storage, other MCP servers, block
16
storage (Persistent Disk), BigQuery, or databases (Cloud SQL, Spanner,
17
Bigtable, Firestore).
18
license: Apache-2.0
19
metadata:
20
version: "1.1.2"
21
publisher: google
22
tags: "gcs, storage, cloud-storage, buckets, objects"
23
category: Storage
24
support_tier: primary
25
---
26
27
# Cloud Storage Basics
28
29
Cloud Storage on Google Cloud is a managed service for storing data as
30
objects at any scale. You read and write whole objects rather than querying or
31
updating individual records in place. It stores immutable objects in buckets
32
with strong global consistency, offers multiple storage classes and location
33
types to balance cost, performance, and availability, and integrates with IAM
34
for fine-grained access control. Cloud Storage serves workloads ranging from
35
website content and backups to data lakes and high-throughput AI/ML training.
36
37
## Tool Execution Priority (MCP Toolbox First)
38
39
Follow this execution hierarchy whenever you perform or recommend Cloud Storage
40
bucket and object operations:
41
42
### 1. Priority 1 — Use `cloud-storage` MCP Tools When Connected
43
44
Before running `gcloud storage` or `curl` in a shell, check your available tools
45
for the `cloud-storage` MCP server (either the local
46
[MCP Toolbox](references/mcp-usage.md) or the Google-hosted remote Cloud Storage
47
MCP server). **Whenever a `cloud-storage` MCP tool covers the requested
48
operation, call the MCP tool directly instead of shelling out to `gcloud
49
storage` or `curl`.**
50
51
**Why MCP first:** MCP tools are built for agents. Each operation is a single
52
direct call, so it runs faster than starting a new `gcloud` command every time,
53
and it returns clean results instead of terminal output the agent has to
54
interpret. It also doesn't need the `gcloud` CLI installed and signed in. You
55
stay in control, too: you can approve or block each Cloud Storage tool
56
individually in your agent's settings.
57
58
Operation | Tool | Server
59
:--------------------- | :------------------------------------ | :-----
60
List buckets | `cloud-storage:list_buckets` | Both
61
Bucket metadata | `cloud-storage:get_bucket_metadata` | Both
62
Bucket IAM policy | `cloud-storage:get_bucket_iam_policy` | Local
63
Create a basic bucket | `cloud-storage:create_bucket` | Both
64
Delete an empty bucket | `cloud-storage:delete_bucket` | Both
65
List objects | `cloud-storage:list_objects` | Both
66
Object metadata | `cloud-storage:get_object_metadata` | Both
67
Read object content | `cloud-storage:read_object` | Both
68
Download to local file | `cloud-storage:download_object` | Local
69
Upload a local file | `cloud-storage:upload_object` | Local
70
Write text to object | `cloud-storage:write_object` | Local
71
Write text to object | `cloud-storage:write_text` | Remote
72
Copy an object | `cloud-storage:copy_object` | Local
73
Move / rename object | `cloud-storage:move_object` | Local
74
Delete an object | `cloud-storage:delete_object` | Both
75
76
**Server:** *Local* is the local MCP Toolbox (14 tools), *Remote* is the
77
Google-hosted remote server (9 tools), and *Both* means either server.
78
79
- `read_object` is capped at 8 MiB. On the Toolbox it reads UTF-8 text only
80
and rejects binary objects; the remote server also reads PDFs and images.
81
For binary or larger objects, use `download_object`.
82
- `upload_object` handles binary files and files larger than 8 MiB.
83
- For production or workload-specific buckets, route to
84
`google-cloud-storage-bucket-architect` before calling `create_bucket`.
85
86
> [!CAUTION]
87
>
88
> **Always stop and ask for explicit user confirmation before calling any MCP
89
> tool that deletes a bucket or object (`delete_bucket`, `delete_object`,
90
> `move_object`) or overwrites existing content (`write_object`, `write_text`,
91
> `upload_object`).**
92
93
### 2. Priority 2 — Fall Back to `gcloud storage` / JSON API
94
95
Immediately use `gcloud storage` (with the required attribution prefix below) or
96
the JSON API when:
97
98
1. **No `cloud-storage` MCP server is connected** in your environment, **or**
99
2. **The operation requires features outside the 14 MCP tools** — such as
100
configuring bucket lifecycle rules, soft delete, Uniform Bucket-Level Access
101
(UBLA), Public Access Prevention (PAP), CMEK encryption, retention policies,
102
CORS, `gcloud storage rsync`, signed URLs (`sign-url`), HMAC keys, Pub/Sub
103
notifications, hierarchical namespace (HNS) folders, IAM policy updates
104
(`add-iam-policy-binding`), or recursive bulk deletes (`rm --recursive`).
105
106
### 3. Gentle Recommendation When MCP Is Not Connected
107
108
When no `cloud-storage` MCP server is available in your environment (for example
109
when the skill was installed standalone without the plugin):
110
111
- **Never disrupt or delay the user's workflow.** Complete the requested task
112
immediately using `gcloud storage` or the API. Never pause or ask the user
113
to install the MCP server before answering.
114
- **Include a brief, one-line tip at the very end of your response ONLY when
115
all three conditions hold:**
116
1. No `cloud-storage` MCP tools are connected in the environment,
117
2. The task involved an interactive bucket or object operation that the
118
local MCP Toolbox natively handles (one of the 14 local Toolbox tools in
119
the table above), **and**
120
3. You have **not** already mentioned the MCP server earlier in the
121
conversation (**mention at most once per conversation**).
122
- **Never show the MCP tip** when the user asks for client-library code
123
(Python, Go, Node.js, Java), Terraform/IaC, conceptual questions, or
124
CLI-only features (`rsync`, `sign-url`, lifecycle policies, CMEK, IAM
125
updates) that MCP Toolbox does not cover.
126
- **Use this quiet, non-intrusive footnote format:**
127
128
> *Tip: To let me run these operations as structured tools without shell
129
> commands, install the
130
> [Google Cloud Storage plugin](https://github.com/GoogleCloudPlatform/google-cloud-storage-plugin)
131
> (it asks for your project ID), or
132
> [add the Cloud Storage MCP server](https://github.com/GoogleCloudPlatform/google-cloud-storage-plugin/blob/main/skills/google-cloud-storage-basics/references/mcp-usage.md)
133
> to your agent's MCP settings.*
134
135
## Attribution
136
137
Tag every Cloud Storage command you run or provide to the user while using this
138
skill, so usage can be attributed. The tag identifies only the skill and its
139
version; it carries no user data.
140
141
- Prefix every `gcloud` invocation, whatever the subcommand, with the metrics
142
environment variables. Set them inline on each command; shell state may not
143
persist between commands. Use this append form verbatim. It keeps any
144
attribution the host environment already set (for example an IDE plugin
145
tagging agent activity through the same variable) and adds the skill tag
146
after it, so neither value clobbers the other:
147
148
```bash
149
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
150
gcloud <command> [flags]
151
```
152
153
Do not use `gcloud config set` for this: it would persist beyond the current
154
task and mislabel unrelated usage.
155
156
- On direct HTTP calls to the Cloud Storage APIs (for example with `curl`) or
157
HTTP requests to the Cloud Storage MCP server
158
(`https://storage.googleapis.com/storage/mcp`), set this exact User-Agent
159
header, verbatim — the collection pipeline parses the `gcs-skills/<version>`
160
and `skill:<name>` tokens, so any rewording breaks attribution:
161
162
```
163
User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)
164
```
165
166
- For client libraries, Terraform, and Cloud Storage FUSE, use the
167
user-agent options shown in the corresponding references.
168
169
## Routing to Specialized Cloud Storage Skills
170
171
This skill covers everyday Cloud Storage tasks. For specialized tasks, use the
172
dedicated skills in this collection for better results. Check your available
173
skills and invoke the matching skill by name instead of improvising:
174
175
- **`google-cloud-storage-bucket-architect`**: Designing and creating a new
176
bucket for production workloads, including sensitive data, media or web
177
hosting, user-generated content (UGC) ingestion, archiving, compliance,
178
backups, logs, analytics, AI/ML, or application storage. The skill analyzes
179
the workload and designs a secure-by-default, cost-effective configuration
180
before creating the bucket. Use the Quick Start section below only for
181
temporary scratch buckets.
182
183
- **`google-cloud-storage-fuse`**: Advanced Cloud Storage FUSE tasks —
184
choosing between FUSE, native `gs://` access, and Filestore/Managed Lustre,
185
deploying tuned mounts on GKE, Compute Engine, or Cloud Run, sizing file,
186
stat, and list caches, tuning mount flags, ensuring safe ML checkpointing,
187
or diagnosing slow or expensive mounts. The
188
[Cloud Storage FUSE reference](references/gcsfuse.md) in this skill covers
189
only basic installation and mounting.
190
191
- **`google-cloud-storage-diagnostic`**: Troubleshooting 403 Permission Denied
192
errors and diagnosing IAM policy bindings, ACLs, uniform bucket-level access
193
(UBLA), or service agent misconfigurations. Ad hoc IAM or ACL changes can
194
grant unintended access or cause outages; route to this skill instead of
195
experimenting.
196
197
- **`gcs-security-assessment`**: Automated security posture assessment of
198
Cloud Storage resources in a project (see
199
[Data Management](references/data-management.md)).
200
201
If the matching skill is not installed, do not improvise. Provide the user with
202
this exact command to install it (substituting the skill name). Provide this
203
command verbatim even when the user's agent CLI (for example, the Antigravity
204
CLI) has its own plugin or extension manager; do not substitute a different
205
installation mechanism or repository. For security assessments specifically, do
206
not attempt a manual assessment. Availability after installing varies by agent,
207
so confirm the skill is loaded rather than assuming it, and say a restart may be
208
required.
209
210
```bash
211
npx skills add GoogleCloudPlatform/google-cloud-storage-plugin --skill <skill-name>
212
```
213
214
## Quick Start
215
216
To set up, configure, or choose between the Google-hosted remote Cloud Storage
217
MCP server (`https://storage.googleapis.com/storage/mcp`) and the local MCP
218
Toolbox (`cloud-storage`), read [MCP Usage](references/mcp-usage.md). When a
219
`cloud-storage` MCP server is connected, prefer its tools (see
220
[Tool Execution Priority](#tool-execution-priority-mcp-toolbox-first)).
221
222
`gcloud storage` output keys are snake_case, not JSON-API camelCase: project
223
`--format="json(soft_delete_policy,versioning_enabled,retention_policy)"`, never
224
`softDeletePolicy` or `versioning` (camelCase keys silently print null).
225
226
1. **Enable the Cloud Storage API:**
227
228
```bash
229
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
230
gcloud services enable storage.googleapis.com --quiet
231
```
232
233
2. **Create a Bucket:**
234
235
Bucket names live in a single global namespace shared by all of Cloud
236
Storage — not scoped to your project or organization — so short or common
237
names are usually taken. If the location is omitted, the bucket defaults to
238
the `US` multi-region.
239
240
For a production or workload-specific bucket, route to
241
`google-cloud-storage-bucket-architect` before creating a bucket (see
242
[Routing to Specialized Cloud Storage Skills](#routing-to-specialized-cloud-storage-skills)).
243
The options below create a basic default bucket.
244
245
Using MCP: call `cloud-storage:create_bucket` (for example with `name:
246
"my-bucket"` and `location: "us-central1"`).
247
248
Using the gcloud CLI:
249
250
```bash
251
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
252
gcloud storage buckets create gs://my-bucket --location=us-central1
253
```
254
255
Using the JSON API:
256
257
```bash
258
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
259
-H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
260
-H "Content-Type: application/json" \
261
-d '{"name": "my-bucket", "location": "US-CENTRAL1"}' \
262
"https://storage.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)"
263
```
264
265
3. **Upload an Object:**
266
267
Using MCP: call `cloud-storage:upload_object` to upload a local file
268
(including binary or large files), or `cloud-storage:write_object` (local
269
Toolbox) / `cloud-storage:write_text` (remote server) to write UTF-8 text
270
directly.
271
272
Using the gcloud CLI:
273
274
```bash
275
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
276
gcloud storage cp ./my-file.txt gs://my-bucket
277
```
278
279
Using the JSON API:
280
281
```bash
282
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
283
-H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
284
-H "Content-Type: text/plain" \
285
--data-binary @my-file.txt \
286
"https://storage.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=media&name=my-file.txt"
287
```
288
289
4. **Download or Read an Object:**
290
291
Using MCP: call `cloud-storage:read_object` to read UTF-8 text content (up
292
to 8 MiB), or `cloud-storage:download_object` (local Toolbox) to save an
293
object, including binary or larger files, to the local filesystem.
294
295
Using the gcloud CLI:
296
297
```bash
298
CLOUDSDK_METRICS_ENVIRONMENT="${CLOUDSDK_METRICS_ENVIRONMENT:+$CLOUDSDK_METRICS_ENVIRONMENT }gcs-skills gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
299
gcloud storage cp gs://my-bucket/my-file.txt .
300
```
301
302
Using the JSON API:
303
304
```bash
305
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
306
-H "User-Agent: gcs-skills/1.0 (skill:google-cloud-storage-basics)" \
307
"https://storage.googleapis.com/storage/v1/b/my-bucket/o/my-file.txt?alt=media"
308
```
309
310
## Reference Directory
311
312
- [Core Concepts](references/core-concepts.md): Buckets, objects, folders,
313
prefixes, bucket location types, and storage classes.
314
315
- [CLI & API Usage](references/cli-api-usage.md): CRUD and list operations for
316
buckets and objects using `gcloud storage` and the JSON API, plus Pub/Sub
317
notifications for event-driven processing.
318
319
- [Client Libraries](references/client-library-usage.md): Using Google Cloud
320
client libraries for Python, Java, Node.js, and Go, with pointers to all
321
other supported languages.
322
323
- [MCP Usage](references/mcp-usage.md): Choosing between the Google-hosted
324
remote Cloud Storage MCP server and the local MCP Toolbox, setup for each,
325
their tool sets and limits, and securing remote MCP with Model Armor and IAM
326
deny policies.
327
328
- [Infrastructure as Code](references/iac-usage.md): Terraform examples for
329
buckets covering storage classes, location types, lifecycle, retention, and
330
encryption.
331
332
- [Data Transfer](references/data-transfer.md): Storage Transfer Service,
333
`gcloud storage rsync`, upload strategies for large files, and performance
334
guidelines and limits.
335
336
- [Data Management](references/data-management.md): IAM roles, authentication
337
(including signed URLs and HMAC), access control, routing for 403 error
338
troubleshooting, network security, automated security assessment, data
339
protection, pricing and cost optimization (lifecycle rules, Autoclass), and
340
Cloud Audit Logs (enabling Data Access logs, exempting principals, and
341
estimating log volume and ingestion cost).
342
343
- [Storage Intelligence](references/storage-intelligence.md): The subscription
344
for managing storage at scale — Storage Insights datasets (BigQuery metadata
345
and activity index), data insights with Gemini Cloud Assist, dashboards,
346
inventory reports, storage batch operations, bucket relocation, plus
347
configuration, trial, and pricing nuances.
348
349
- [High-Performance Storage](references/high-performance-storage.md): Rapid
350
Bucket, Rapid Cache (Anywhere Cache), and hierarchical namespace for AI/ML,
351
analytics, and other performance-critical workloads.
352
353
- [Cloud Storage FUSE](references/gcsfuse.md): Installing Cloud Storage FUSE,
354
mounting buckets, file operations, POSIX semantics and limitations (locking,
355
writes, renames, consistency), and caching. For advanced tuning, deployment,
356
and diagnosis, route to the `google-cloud-storage-fuse` skill.
357