Google Cloud Filestore Autoscale

Google Cloud Filestore Autoscale

Checks Filestore capacity and free space on Google Cloud and scales instances up for low headroom or down to cut cost, using configurable thresholds.

Skill files5 files

references/

SKILL.md242 lines
1
---
2
name: google-cloud-filestore-autoscale
3
metadata:
4
version: "1.0.3"
5
category: Storage
6
description: >-
7
Inspects Filestore capacity and utilization on Google Cloud, evaluates storage
8
scaling rules, and performs capacity autoscaling (scale UP for low free space
9
or scale DOWN for cost optimization). Use when monitoring Filestore instance
10
headroom, resizing instance shares, configuring automated growth/shrink
11
thresholds (custom thresholds apply globally across projects in session memory),
12
or preventing out-of-space outages. Don't use for Cloud Storage (GCS) buckets,
13
Persistent Disk block storage, or NetApp Volumes.
14
---
15
16
# Filestore Autoscale
17
18
This skill enables agents to inspect, evaluate, and modify Filestore
19
instance capacities across Google Cloud projects based on configured
20
thresholds.
21
22
## Prerequisites / IAM Requirements
23
24
Before an agent or user can execute this skill, their runtime Service Account
25
must possess the following IAM roles on the target project(s):
26
27
- **`roles/file.editor`** (Required for listing instances and triggering scale
28
up/down updates)
29
- **`roles/monitoring.viewer`** (Required for reading Cloud Monitoring
30
capacity metrics `used_bytes`)
31
- **`roles/mcp.toolUser`** (Required if utilizing backend Filestore MCP tools)
32
33
## Quick Start
34
35
1. Ensure `gcloud` is installed. See
36
[gcloud installation guide](https://cloud.google.com/sdk/docs/install) if
37
needed.
38
2. Enable essential APIs:
39
40
```bash
41
gcloud services enable file.googleapis.com monitoring.googleapis.com --quiet
42
```
43
3. Inspect fleet capacity and free space (see "Discovery & Read Operations"
44
below).
45
4. Evaluate against configured up/down capacity thresholds.
46
5. Scale target instances and apply attribution tags.
47
48
## Usage Attribution
49
50
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
51
MUST read and follow the instructions in
52
[Usage Attribution](references/attribution.md).
53
54
## Conceptual & Informational Queries (CRITICAL)
55
56
For purely conceptual, educational, or informational questions (e.g., "What are Filestore scaling limits?",
57
"Can Basic instances scale down?", "Explain Filestore Tiers"):
58
59
* **Rule**: **Answer immediately using your pre-trained knowledge and the matrix below.**
60
* **Constraint**: **Do not execute external tool calls or API requests** for basic knowledge questions.
61
62
## Handling "No-Command" Constraints (CRITICAL)
63
64
If the user prompt contains constraints like "Do not execute commands", "without executing", or "read-only":
65
66
* **Rule**: **Strictly avoid calling the `run_command` tool** to execute any
67
shell, `gcloud`, or code search (`cs`) commands (including read-only
68
list/describe commands).
69
* **Discovery**:
70
1. Whenever outputting or recommending a `gcloud` command (including when
71
evaluating instance values provided directly in the user prompt), read
72
[Usage Attribution](references/attribution.md) first so the command
73
includes the required attribution prefix; do not search for additional
74
unrelated files when instance tier, capacity, and utilization are
75
already in the prompt.
76
2. Otherwise, check if Filestore MCP tools (`list_instances`,
77
`get_instance`) are available and use them (these are API calls, not
78
command executions).
79
3. If MCP tools are not available, check
80
`references/instance-tiers-specs.md` for any mock instance definitions
81
or project details matching the request. (Do NOT run repository-wide
82
searches or attempt to read evaluation config files such as `EVAL.yaml`
83
or `EVAL.txtpb` during evaluation runs as access is restricted).
84
4. If no data can be found, explain the required steps and formulas, and
85
output the attributed `gcloud` terminal commands for the user to confirm
86
and run, without executing them yourself.
87
* **Mandatory User Confirmation Requirement**: Even when the user prompt asks not to execute commands or asks only for command syntax/recommendations, your response MUST STILL end with a clear question prompting the user for confirmation before executing any capacity resizing commands (e.g., *"Would you like me to proceed with scaling `[instance]` from [A] TiB to [B] TiB? Please confirm to execute."*).
88
89
## Tier & Capacity Limits Matrix
90
91
Filestore tiers enforce specific boundaries and behaviors. The skill must accept both modern UI names (`Basic`, `Zonal`, `Regional`) and legacy API enums interchangeably.
92
93
See `references/instance-tiers-specs.md` for the full Tier & Capacity Limits Matrix (Min/Max capacities, step increments).
94
95
**Critical Thresholds:**
96
97
- **Basic HDD / Basic SSD**: Can scale up, but **cannot scale down**.
98
- **Zonal / Regional**: Can scale down, but cannot shrink below their minimum
99
floor (100 GiB for Regional Small Band, 1 TiB for Zonal Small Band, or 10 TiB
100
for Large Band) AND cannot shrink below current `used_bytes`.
101
102
## Core Operational Workflow
103
104
### 1. Discovery & Read Operations
105
106
- **Step 1 (Fleet Discovery)**: Call the MCP tool
107
`list_instances(parent='projects/{project_id}/locations/-')` or CLI `gcloud
108
filestore instances list --project={project_id}` to discover all Filestore
109
instances in the target project. Read the `capacityGb` and `tier` directly
110
from the instances returned.
111
- **Step 2 (Single Bulk Utilization Metric Query)**: Immediately after
112
discovering instances, query the Cloud Monitoring API for the
113
`file.googleapis.com/nfs/server/used_bytes` metric across the entire project
114
in a single request (see `references/monitoring-metrics.md` for
115
runtime-specific options including GCP REST API, `gcloud`, `curl`, and MCP
116
tools).
117
118
**CRITICAL**: Make exactly ONE bulk metric request for the entire project.
119
**NEVER emit multiple per-instance queries or loops.** Do NOT filter by zone
120
or region.
121
122
- **Step 3 (Metric Extraction & Calculation)**:
123
124
- Match each instance's short name (or `resource.labels.instance_name` /
125
`metric.labels.instance_name`) in the returned `timeSeries` data to
126
extract its latest `int64Value` bytes.
127
- If an instance is not listed in `timeSeries` or has no points, default
128
its `used_bytes` to 0.
129
- Calculate `used_bytes_gb = used_bytes / (1024^3)`.
130
- Calculate `Free Space % = ((capacityGb - used_bytes_gb) / capacityGb) *
131
100`.
132
- NEVER leave `Used Bytes` or `Free Space %` as "N/A". Populate actual
133
numbers into the output summary table.
134
135
### 2. Autoscale Needed Matrix
136
137
The skill must categorize each evaluated instance into one of 5 definitive verdicts. On the initial analysis/fleet inspection run, the skill suggests the required scaling action with target capacity and update commands, and **prompts for user confirmation before executing any autoscale modifications**. State the value of the "Autoscale Needed" column clearly as one of the following:
138
139
- **Yes (Scale Up)**: Triggered when free space percentage is below the
140
scale-up safety threshold (< 15% free space remaining). The evaluation
141
response MUST explicitly state that the current free space percentage is
142
below the 15% scale-up safety threshold. Capacity must be increased by 10%
143
(default) or step-size minimum, rounded to the tier's step increment (1 GiB
144
for Regional Small Band [100 GiB-10,239 GiB] or Basic, 256 GiB for Zonal
145
Small Band [1-9.75 TiB] or Enterprise [1-10 TiB],
146
2.5 TiB for Large Band [10-100 TiB],
147
as specified in `references/instance-tiers-specs.md`), not exceeding the
148
maximum capacity. Always explicitly state the calculated target capacity in
149
**both TiB and GiB** (for example, for a 1 TiB [1024 GiB] Basic instance
150
increased by +10%, explicitly state `1.1 TiB` alongside its 1 GiB
151
step-aligned equivalent `1126 GiB` / `1127 GiB`). Suggest target capacity,
152
provide the attributed `gcloud`
153
update command, and MUST conclude the response with a clear question
154
prompting the user for confirmation to execute (e.g., *"Would you like me to
155
proceed with scaling `[instance]` from [A] TiB to [B] TiB? Please confirm to
156
execute."*).
157
- **Yes (Scale Down)**: Triggered when free space exceeds the scale-down
158
threshold (> 30% free space remaining) and the instance is eligible for
159
downscaling (Zonal or Regional / Enterprise tiers). Apply the default step
160
reduction of -10% of current capacity, aligned to the tier's step increment
161
(1 GiB for Regional Small Band [100 GiB-10,239 GiB], 256 GiB for Zonal
162
Small Band [1-9.75 TiB] or Enterprise [1-10 TiB],
163
2.5 TiB for Large Band [10-100 TiB],
164
as specified in `references/instance-tiers-specs.md`). For example, for a
165
2 TiB (2048 GiB) Enterprise / Zonal Small Band instance, rounding to the
166
256 GiB step yields a proposed target capacity of 1.75 TiB (1792 GiB, or
167
1.8 TiB). The response MUST explicitly verify that the proposed target
168
capacity (e.g. 1.75 TiB / 1792 GiB or 1.8 TiB) remains strictly above both
169
the tier's minimum capacity floor (100 GiB for Regional Small Band, 1 TiB
170
for Zonal Small Band / Enterprise, or 10 TiB for Large Band) and currently
171
used space (e.g. 0.9 TiB). Do NOT reduce directly to the floor in a single
172
step. Suggest target capacity, estimated cost savings, provide the
173
attributed `gcloud` update command, and prompt the user for confirmation to
174
execute.
175
- **No (Healthy)**: Triggered when the instance's free space is within the
176
optimal operating range (15% – 30%). No action required.
177
- **No (At min capacity limit)**: Triggered when free space is > 30%, but the
178
instance is already at the minimum allowed tier capacity floor (100 GiB for
179
Regional Small Band, 1 TiB for Zonal Small Band / Enterprise, or 10 TiB for
180
Large Band) or currently used space limit. No action can be taken.
181
- **No (Tier cannot scale down)**: Triggered when free space is > 30%, but the
182
instance is on a Basic tier (Basic HDD / Basic SSD) which does not support
183
downscaling. The agent must explicitly inform the user that scale-down is
184
not supported and suggest data migration instead. No action can be taken.
185
186
### Output Format
187
188
**Every status report, evaluation, or recommendation response MUST include a markdown table summarizing the evaluated instances.** Even if evaluating a single instance, format it as a table.
189
The table MUST contain the following columns:
190
191
* `Instance`
192
* `Service Tier`
193
* `Provisioned Capacity`
194
* `Used Bytes`
195
* `Free Space %`
196
* `Autoscale Needed` (MUST contain one of: `Yes (Scale Up)`, `Yes (Scale Down)`, `No (Healthy)`, `No (At min capacity limit)`, or `No (Tier cannot scale down)`)
197
198
Example standard output table:
199
200
```markdown
201
| Instance | Service Tier | Provisioned Capacity | Used Bytes | Free Space % | Autoscale Needed | Proposed Action |
202
|---|---|---|---|---|---|---|
203
| `[instance-name]` | REGIONAL | 2048 GiB | 900 GiB | 56.05% | Yes (Scale Down) | Scale down to 1792 GiB. `gcloud filestore instances update ...` |
204
```
205
206
### 3. Execution & Confirmation Workflow
207
208
1. **Analysis & Recommendation (First Run / Inspection)**:
209
- Calculate step-aligned target capacity adhering to tier ceilings, floors, and basic scale-up only rules.
210
- Present the summary table and proposed actions.
211
- **MANDATORY USER CONFIRMATION PROMPT**: Whenever recommending target capacity or providing a `gcloud filestore instances update` command, your response MUST explicitly include a clear question asking the user to confirm execution before any modifications are made (e.g. *"Would you like me to proceed with scaling `[instance]` from [A] TiB to [B] TiB? Please confirm to execute."*) to prevent accidental billing spikes or capacity exhaustion.
212
- **Do not execute autoscale commands without user confirmation.**
213
2. **Execution upon Confirmation**:
214
- Once the user confirms (e.g., "Yes, proceed with scaling", "Scale instance X"), execute the attributed `gcloud filestore instances update` command on the confirmed instance(s).
215
3. **Fallback**:
216
- If execution fails due to Prod mutation restrictions, output the failure reason and provide the user with the exact attributed `gcloud` command to run manually, reminding them to confirm before manual execution.
217
218
### Custom Thresholds
219
220
When the user configures or passes custom threshold values in prompts (e.g.
221
"Scale up if free space drops below 10% with a 20% step", or custom
222
max_threshold / up_increment):
223
224
1. **Global Session Memory Confirmation**: The response MUST accept and
225
acknowledge the custom thresholds and MUST explicitly confirm that custom
226
thresholds apply globally across projects in session memory, explicitly
227
mentioning the target project IDs evaluated or active in session memory to
228
prevent accidental cross-project misconfiguration.
229
2. **Configuration Summary**: The response MUST display the updated active
230
configuration summary showing all active thresholds and step increments.
231
3. **Preserve Overrides**: The response MUST NOT revert to default thresholds
232
(15% / 10%) when custom overrides are provided.
233
234
## Reference Directory
235
236
For progressive disclosure of deeper topics, consult the `references/` directory:
237
238
- [Usage Attribution](references/attribution.md)
239
- [Instance Tiers & Specs](references/instance-tiers-specs.md)
240
- [Monitoring Metrics Formulas](references/monitoring-metrics.md)
241
- [Troubleshooting & Errors](references/troubleshooting-errors.md)
242

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…