/cloud-skills:cloud-cost-anomaly-investigationfrom cloud-skills
Investigates unexpected cloud cost spikes by querying AWS Cost Explorer/CUR, Azure Cost Management, or GCP BigQuery billing export to isolate the specific resource, tag, and team responsible before a formal FinOps review.
Ships in cloud-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A cost anomaly alert or a finance Slack message ("why is spend up 30% this week?") starts a clock: the sooner the specific resource, tag, and owning team are identified, the cheaper and less politically charged the fix is. Left uninvestigated for a month, the same question turns into a formal FinOps review with executives in the room, and the trail (which engineer changed what, on which day) is much colder. This skill is the tactical, hours-not-weeks workflow for tracing a specific spike back to its cause — a runaway resource, a misconfigured autoscaler, a forgotten non-prod environment, a data-transfer surprise — using each provider's cost-explorer/billing-query tooling, so the on-call or platform engineer can hand finance an answer (and, ideally, a fix) inside the same week the alert fired. It assumes cost visibility (CUR, Cost Management, BigQuery export) is already enabled; if it isn't, that's the actual blocker — see cloud-cost-finops-optimization step 1 for standing that up first.
ce (Cost Explorer) commands or Athena over CUR
parquet files, az costmanagement CLI or the Cost Management portal,
bq query against the billing export dataset.cost-center/owner/environment/service) —
even partial — to attribute spend to a team; without it, the
investigation can identify the resource but not the owner, which is
usually the actually-needed answer. See
cloud-cost-finops-optimization
for closing tagging gaps.Establish the exact window and magnitude before looking for a cause. Don't start from "this month is high" — pin down the day the trend changed. AWS Cost Explorer via CLI, grouped by day and service, over the trailing 14 days:
aws ce get-cost-and-usage \
--time-period Start=2026-07-14,End=2026-07-28 \
--granularity DAILY \
--metrics "UnblendedCost" \
--group-by Type=DIMENSION,Key=SERVICE
Azure equivalent — daily actual cost by service name over the same window:
az costmanagement query \
--type ActualCost \
--timeframe Custom \
--time-period from=2026-07-14 to=2026-07-28 \
--dataset-granularity Daily \
--dataset-aggregation '{"totalCost":{"name":"Cost","function":"Sum"}}' \
--dataset-grouping name=ServiceName type=Dimension \
--scope "/subscriptions/<SUBSCRIPTION_ID>"
GCP equivalent — daily cost by service from the BigQuery billing export:
SELECT
DATE(usage_start_time) AS usage_day,
service.description AS service,
SUM(cost) AS daily_cost
FROM `<PROJECT_ID>.<BILLING_DATASET>.gcp_billing_export_v1_<BILLING_ACCOUNT_ID>`
WHERE usage_start_time BETWEEN TIMESTAMP("2026-07-14") AND TIMESTAMP("2026-07-28")
GROUP BY usage_day, service
ORDER BY usage_day, daily_cost DESC
Identify the specific day the daily run-rate stepped up (a step change, not a gradual ramp, points to a discrete event like a deploy or a misconfiguration; a gradual ramp points to organic growth or a slow leak like an unbounded log/storage accumulation).
Narrow from service to specific resource and tag. Re-run the same
query grouped by USAGE_TYPE/resource ID (AWS), by ResourceId
(Azure), or by sku.description/resource.name (GCP), filtered to
just the service and date range identified in step 1:
aws ce get-cost-and-usage \
--time-period Start=2026-07-20,End=2026-07-28 \
--granularity DAILY \
--metrics "UnblendedCost" \
--filter '{"Dimensions":{"Key":"SERVICE","Values":["Amazon Elastic Compute Cloud - Compute"]}}' \
--group-by Type=DIMENSION,Key=USAGE_TYPE
For AWS, if Cost Explorer's dimension granularity isn't enough to name
an individual resource, query CUR directly via Athena for
line_item_resource_id:
SELECT line_item_resource_id, line_item_usage_start_date, SUM(line_item_unblended_cost) AS cost
FROM cur_database.cur_table
WHERE line_item_usage_start_date BETWEEN TIMESTAMP '2026-07-20' AND TIMESTAMP '2026-07-28'
AND product_product_name = 'Amazon Elastic Compute Cloud'
GROUP BY line_item_resource_id, line_item_usage_start_date
ORDER BY cost DESC
LIMIT 20
For GCP, the BigQuery export includes resource.name and per-label
fields directly, so this step and step 1 can often be a single query
with tighter GROUP BY.
Attribute the resource to a tag/label and owning team. Group the
same query by cost-allocation tag (cost-center, team, owner,
environment):
aws ce get-cost-and-usage \
--time-period Start=2026-07-20,End=2026-07-28 \
--granularity DAILY \
--metrics "UnblendedCost" \
--group-by Type=TAG,Key=team
-- GCP: group by a resource label present in the billing export
SELECT
(SELECT value FROM UNNEST(labels) WHERE key = 'team') AS team,
SUM(cost) AS cost
FROM `<PROJECT_ID>.<BILLING_DATASET>.gcp_billing_export_v1_<BILLING_ACCOUNT_ID>`
WHERE usage_start_time BETWEEN TIMESTAMP("2026-07-20") AND TIMESTAMP("2026-07-28")
GROUP BY team
ORDER BY cost DESC
If the resource has no tag/label at all, that absence is a finding —
flag it for backfill per
cloud-cost-finops-optimization
step 2 even while the immediate investigation continues by other means
(resource-creation timestamp, VPC/subnet/resource-group ownership
convention, CloudTrail/Activity Log CreatedBy metadata).
Correlate the cost step-change with an actual event, not just a date. Cross-reference the day/hour identified in step 1 against:
aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=<resource-id>) for who/what
created or resized the resource.az monitor activity-log list --resource-group <RESOURCE_GROUP> --start-time 2026-07-19T00:00:00Z).gcloud logging read filtered to the resource
and time window).Distinguish "expected" from "mistake" before escalating, and say which explicitly in the write-up:
Act only after confirming true responsibility and intent, and prefer the least destructive fix that resolves the anomaly:
Warning: Do not delete or terminate a resource identified during a cost investigation without confirming with its owning team first, even if it looks clearly like a mistake (an idle non-prod instance, a forgotten test cluster) — the same symptom can also be a deliberately retained warm-standby DR resource (see disaster-recovery-and-backup-strategy) or an active but low-utilization workload with a non-obvious dependency. Cost urgency is not a reason to skip the confirmation step.
Close the loop with a short written finding, even for an internal Slack/ticket update: window, resource(s), tag/team, root cause (expected vs. mistake), and either the fix applied or the fix planned with an owner and date — this is what turns a one-off investigation into input the next formal FinOps review can build on instead of re-deriving.
If this is the second or third time the same team/service causes an anomaly, escalate beyond a one-off fix: recommend a budget alert/Cost Anomaly Detection monitor scoped to that team's cost-allocation tag (per cloud-cost-finops-optimization step 6) so the next occurrence is caught by monitoring, not by finance noticing the bill.
Symptom: The cost anomaly alert names a service (e.g. "Amazon EC2") but nobody can say which team or workload is responsible, and the investigation stalls waiting for someone to "look into it." Fix: Group the Cost Explorer/Cost Management/BigQuery query by cost-allocation tag, not just service, immediately (step 3) — if the resource has no tag, that's the actual finding to report (a tagging gap), and the resource-creation audit log (CloudTrail/Activity Log/Cloud Audit Logs) becomes the fallback attribution path rather than waiting on tags that don't exist.
Symptom: An engineer, under pressure to "fix the spike fast," terminates an EC2 instance/VM that looked idle, and it turns out to have been a pinned warm-standby DR replica or a batch job that only runs weekly. Fix: Never delete or stop a resource as part of a cost investigation without confirming its actual purpose with the owning team first — a low-recent-utilization resource is not the same as an unused one; hand off to orphaned-cloud-resource-cleanup's explicit non-use confirmation process instead of acting unilaterally during triage.
Symptom: The investigation concludes "spend went up because of EC2/Compute Engine/VMs" but a week later the same category spikes again for an unrelated reason. Fix: The finding stopped at the service level instead of the specific resource/tag/root-cause level, so nothing specific could be monitored going forward. Push every investigation down to a named resource and a named root cause (a specific autoscaling group's max size, a specific misconfigured retry loop), and set a scoped anomaly monitor on that dimension afterward.
Symptom: A spike traced to a runaway process turns out to be
driven by unexpectedly high data transfer/egress costs, not compute
or storage, and the investigation initially misses it because it only
looked at the top-line service breakdown.
Fix: Data transfer/network egress often appears as its own line
item or USAGE_TYPE (DataTransfer-Out-Bytes on AWS, Bandwidth on
Azure, Network SKUs on GCP) separate from the compute resource
generating it. Explicitly check network/data-transfer usage types in
step 2's group-by, not just compute/storage, especially when the
triggering service's own on-demand cost looks unremarkable but total
spend still jumped.
Symptom: By the time finance raises the question in a monthly review, the CloudTrail/Activity Log retention window has already rolled past the date of the actual change, and correlation in step 4 becomes guesswork. Fix: This is why the investigation needs to happen within days of the anomaly alert, not at month-end — extend default audit-log retention (CloudTrail to a long-retention S3 bucket, Activity Log to a Log Analytics workspace, Cloud Audit Logs export to BigQuery) so a slower-to-notice anomaly still has a change-history trail to correlate against.
Scenario: An AWS Cost Anomaly Detection alert fires: overall spend is tracking roughly 18% above the trailing-week baseline, three days into the current billing cycle.
USAGE_TYPE (step 2): the increase is almost entirely
BoxUsage:m5.4xlarge in eu-west-1, not spread across instance
types — pointing at a specific autoscaling group or fleet, not
general traffic growth.team cost-allocation tag (step 3): 95% of the new
m5.4xlarge spend carries team=search-indexing.search-indexing-workers had its
MaxSize changed from 10 to 60 two days ago via a Terraform apply,
timestamped an hour before the cost step-change began.search-indexing team lead (step 5): the change was
an accidental copy-paste in a Terraform PR meant to raise a different
ASG's max size for an unrelated load test; the search-indexing ASG's
actual autoscaling demand never required more than ~12 instances, so
the fleet scaled up to near the new (wrong) ceiling under normal load
and stayed there.MaxSize to 10 via the same Terraform-managed
pipeline (not a manual console click, to keep it in version control),
confirm the ASG scales back down within the hour, and post a written
finding in the team's channel: resource = search-indexing-workers
ASG, root cause = accidental MaxSize change in PR #482, fix =
reverted in PR #491, cost impact = roughly the 18% spike over the
two days it ran.team=search-indexing so the next runaway autoscaler
change is caught within hours instead of at the next billing-cycle
review.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin cloud-skills14 skills in this plugin
/aws-landing-zone-setupGuides designing and implementing a multi-account AWS landing zone using AWS Organizations, Control Tower, and Account Factory — including the account/OU hierarchy, Service Control Policies, centralized logging, and baseline guardrails. Use when a user asks to "set up a new AWS account structure", "design an AWS landing zone", "implement AWS Control Tower", "create OUs and SCPs", "bootstrap a multi-account AWS environment", or "onboard a new AWS account into our organization".
/azure-landing-zone-setupGuides designing and implementing an Azure landing zone using Management Groups, subscription democratization, Azure Policy, and the Cloud Adoption Framework (CAF) Landing Zone Accelerator pattern. Use when a user asks to "design an Azure landing zone", "set up Management Groups and subscriptions", "implement Azure Policy guardrails", "onboard a new Azure subscription", "structure our Azure tenant", or "migrate to the CAF enterprise-scale landing zone".
/cloud-access-request-and-iam-lifecycle-managementHandles the everyday operational request to grant, time-box, and later revoke a scoped IAM permission for a contractor, new hire, or a temporary need (e.g. "give the new contractor read-only S3 access for 30 days," "grant break-fix access to prod for this incident," "revoke Priya's access, she left the team," "why does this access request keep getting rejected") — including expiry enforcement and the audit trail a security review will ask for. Use for a single access grant/revoke transaction, not for designing the underlying IAM policy/role structure (see cloud-iam-hardening for that).
/cloud-cost-finops-optimizationGuides establishing cloud cost visibility and reducing spend across AWS, Azure, and GCP through tagging/labeling discipline, rightsizing, commitment-based discounts (Reserved Instances, Savings Plans, Committed Use Discounts), and FinOps showback/chargeback practices. Use when a user asks to "reduce our cloud bill", "set up cost allocation tags", "find idle/oversized resources", "decide between Reserved Instances and Savings Plans", "implement FinOps", "explain why cloud spend went up", or "build a cost dashboard per team".
/cloud-iam-hardeningGuides hardening identity and access management across AWS, Azure, and GCP — least-privilege policy design, eliminating long-lived credentials in favor of federation (OIDC/Workload Identity), break-glass access, and periodic access review. Use when a user asks to "reduce IAM permissions", "remove unused IAM roles", "set up federated/keyless access for CI/CD", "harden our cloud identity posture", "review who has admin access", "implement least privilege", or "get rid of long-lived access keys".
/cloud-native-storage-strategyGuides choosing and configuring cloud storage services — object storage (S3, Azure Blob, GCS), block storage, file storage, and lifecycle/ tiering policies — with encryption, access control, and cost-tiering best practices across AWS, Azure, and GCP. Use when a user asks to "design a storage architecture", "choose between object/block/file storage", "set up storage lifecycle/tiering policies", "encrypt data at rest", "prevent a storage bucket from being public", "reduce storage costs", or "pick a storage class for infrequently accessed data".
Other plugins' skills for the same job