opción
HogarHogar Skill Infraestructura de la nube aws-billing-and-cost-management

aws-billing-and-cost-management

aws/agent-toolkit-for-aws aws/agent-toolkit-for-aws

Analice los costos de AWS, encuentre formas de ahorrar, gestione presupuestos, evalúe los planes de ahorro e instancias reservadas, ajuste el tamaño adecuado de EC2/Lambda/RDS/EBS mediante Compute Optimizer, consulte las tarifas de los servicios, realice búsquedas en CUR con Athena, detecte anomalías en los costos, limite los costos a las vistas de facturación y supervise el uso de la capa gratuita. Se activa ante: la factura de AWS, el análisis de costos, la reducción de gastos, los planes de ahorro, las instancias reservadas, el ajuste de tamaño, las alertas de presupuesto, la optimización de costos, las tarifas, la capa gratuita, las anomalías en los costos, CUR, las auditorías de costos y las vistas de facturación.

...Expandir todo
16
Tiempo actualizado 25 de agosto de 2026

Acerca de aws-billing-and-cost-management

Analiza, optimiza y gestiona los costos de AWS, integrando conocimientos especializados provenientes de los productos de gestión de costos de AWS, incluyendo problemas comunes, patrones correctos de uso de API y flujos de trabajo de optimización. Se utiliza para analizar tendencias de gastos y costos, configurar alertas de presupuesto, evaluar planes de ahorro e instancias reservadas, ajustar el tamaño adecuado de recursos como EC2, Lambda, RDS y EBS mediante Compute Optimizer, consultar precios de servicios, realizar auditorías de costos o investigar picos repentinos, consultar datos CUR con Athena, limitar el análisis a una vista de facturación y verificar el uso de la capa gratuita. Los conceptos clave abarcan Cost Explorer, Presupuestos, Vistas de Facturación, Compute Optimizer, el Cost Optimization Hub, planes de ahorro e instancias reservadas, así como CUR 2.0 consultado a través de Athena. El servidor AWS MCP es la configuración recomendada para ejecuciones en entorno aislado y registro de auditorías, pero los comandos también funcionan con cualquier agente que cuente con acceso estándar a AWS CLI.

Se destacan dos reglas cruciales. Es necesario determinar la fecha actual con una herramienta antes de realizar cualquier llamada a Cost Explorer, Presupuestos o planes de ahorro, ya que los modelos suelen usar por defecto los años de los datos de entrenamiento y analizan información obsoleta. Los cálculos numéricos como sumas, promedios, porcentajes, comparaciones y conteos nunca deben realizarse mediante razonamientos en la respuesta, sino siempre con un script o herramienta de cálculo, ya que el cálculo matemático realizado por LLMs sobre datos de costos es poco fiable.

Una guía de decisiones dirige cada pregunta hacia la herramienta y el archivo de referencia adecuados, mientras que una sección dedicada a tareas comunes proporciona comandos concretos. Los costos por servicio se analizan con aws ce get-cost-and-usage, agrupándolos por SERVICE, utilizando como valor predeterminado UnblendedCost, excluyendo créditos y reembolsos mediante el filtro RECORD_TYPE y considerando la fecha de finalización como fecha exclusiva. Compute Optimizer requiere activación previa ejecutando aws compute-optimizer update-enrollment-status con el estado Active. La sección sobre Vistas de Facturación explica cómo limitar los datos de costos a una parte específica de la facturación añadiendo --billing-view-arn a las llamadas compatibles, lista las vistas de facturación con aws billing list-billing-views (se requiere el permiso billing:ListBillingViews) y muestra cómo incluir BillingViewArn en un archivo JSON de presupuesto, además de proporcionar una tabla que indica qué APIs de Cost Explorer sí y cuáles no admiten el ARN de vista de facturación. Una tabla de solución de problemas relaciona errores como ValidationException por usar una clave de dimensión incorrecta, resultados filtrados vacíos, AccessDenied al acceder a datos por hora y la exigencia de ejecutar las llamadas a Presupuestos en us-east-1, con las soluciones correspondientes.

Preguntas frecuentes

¿Por qué debo verificar la fecha actual antes de realizar llamadas a las API de costos?

Los LLMs suelen usar como referencia fechas de sus datos de entrenamiento en lugar de la fecha actual real, lo que genera análisis basados en información obsoleta que, aunque parecen correctos, en realidad son erróneos. Es necesario utilizar una herramienta para determinar la fecha actual antes de realizar cualquier llamada a Cost Explorer, Presupuestos o planes de ahorro.

¿Cómo deben realizarse los cálculos numéricos sobre datos de costos?

Nunca mediante razonamientos en la respuesta. Las sumas, promedios, porcentajes, comparaciones, conteos y valores mínimos o máximos siempre deben calcularse con un script o herramienta de cálculo, como un script en Python que muestre el resultado, ya que el cálculo matemático realizado por LLMs sobre datos de costos es poco fiable.

¿Cómo limito el análisis de costos a una vista de facturación específica?

Añada --billing-view-arn a las llamadas API compatibles y descubra las vistas disponibles con aws billing list-billing-views (se requiere el permiso billing:ListBillingViews). Las llamadas compatibles incluyen ce get-cost-and-usage y get-cost-forecast, mientras que las llamadas relacionadas con reservas e planes de ahorro no lo admiten.

¿Qué configuración requiere Compute Optimizer?

Requiere activación previa ejecutando aws compute-optimizer update-enrollment-status con el estado Active. Sin esta activación, las llamadas fallan con el error de que la cuenta no está registrada.

¿Por qué podría fallar una llamada a la API de Presupuestos fuera de us-east-1?

La API de Presupuestos requiere la región us-east-1. La solución recomendada es configurar la región para las llamadas a Presupuestos en us-east-1.

Todos los archivos

16 archivosreferences/cost-explorer.md7.3 KBVerreferencias/cost-audit.md3.2 KBVerreferencias/cur-athena.md7.0 KBVerreferencias/deterministic-calculations.md2.5 KBVerreferencias/ebs-optimization.md2.7 KBVerreferencias/ec2-rightsizing.md3.2 KBVerreferencias/pricing-lookup.md3.8 KBVerreferencias/rds-optimization.md1.8 KBVerreferencias/service-optimization.md2.9 KBVerSKILL.md8.8 KBVerreferencias/budgets.md2.3 KBVerreferencias/cost-optimization-hub.md7.1 KBVerreferencias/free-tier.md1.6 KBVerreferencias/reserved-instances.md2.3 KBVerreferencias/lambda-optimization.md2.1 KBVerreferencias/savings-plans.md3.3 KBVer

Ver en GitHub

Overview

Analyze, optimize, and manage AWS costs. This skill encodes domain expertise from AWS's cost management products — gotchas, correct API usage patterns, and optimization workflows that models frequently get wrong.

Usage

Use this skill when:

  • Analyzing AWS spending, cost trends, or cost breakdowns
  • Setting up or managing budget alerts
  • Evaluating Savings Plans or Reserved Instance purchases
  • Right-sizing EC2, Lambda, RDS, or EBS resources
  • Looking up AWS service pricing
  • Running cost audits or investigating cost spikes
  • Querying CUR data with Athena
  • Scoping cost analysis to a specific billing view
  • Checking Free Tier usage

Core Concepts

  • Cost Explorer — query cost/usage data by service, account, tag, or time range
  • Budgets — set spending thresholds with alerts; supports billing view scoping
  • Billing Views — scope cost data to a subset of billing (custom view, billing group, or primary)
  • Compute Optimizer — right-sizing recommendations for EC2, Lambda, EBS, RDS
  • Cost Optimization Hub — aggregated savings recommendations across services
  • Savings Plans / Reserved Instances — commitment-based discounts
  • CUR 2.0 — detailed line-item billing data queryable via Athena

Recommended setup: Use the AWS MCP server for sandboxed execution, audit logging, and enterprise controls. See: https://docs.aws.amazon.com/aws-mcp/

Without AWS MCP: All commands use standard AWS CLI syntax and work with any agent that has CLI access.

Critical Rule: Always Check the Current Date

Before making ANY Cost Explorer, Budgets, or Savings Plans API call, you MUST determine the current date. Use a tool to get the current date and time — do NOT assume or guess the year. LLMs frequently default to dates from their training data instead of the actual current date, producing analyses of stale data that appear correct but are completely wrong.

Critical Rule: Deterministic Calculations

You MUST NEVER perform numerical calculations (sums, averages, percentages, comparisons, counts, min/max) by reasoning in your response. LLM arithmetic is unreliable and produces wrong answers on cost data.

You MUST ALWAYS use a script or calculator tool for any math on data returned from API calls. Write a Python script that performs the calculation and prints the result. If the AWS MCP server's run_script tool is available, use it. Otherwise, run the script locally.

Read references/deterministic-calculations.md for patterns and examples.

Decision Guide

QuestionToolReference
What am I spending? Where are costs going up?Cost Explorerreferences/cost-explorer.md
How much does a service cost?Price List APIreferences/pricing-lookup.md
Where can I save money? (start here)Cost Optimization Hubreferences/cost-optimization-hub.md
Should I buy Savings Plans?CE SP Recommendationsreferences/savings-plans.md
Should I buy Reserved Instances?CE RI Recommendationsreferences/reserved-instances.md
Deep-dive on a specific EC2/Lambda/EBS/RDS rec?Compute Optimizerreferences/ec2-rightsizing.md, references/lambda-optimization.md, references/rds-optimization.md, references/ebs-optimization.md
How do I set up budget alerts?Budgetsreferences/budgets.md
What's causing a cost spike?Cost Anomaly Detectionreferences/cost-explorer.md
Am I within Free Tier?Free Tier APIreferences/free-tier.md
How do I reduce my bill?Cost Audit workflowreferences/cost-audit.md
How do I query detailed billing data?CUR 2.0 + Athenareferences/cur-athena.md
How do I optimize specific services?Per-service patternsreferences/service-optimization.md
How do I scope costs to a billing view?Billing ViewsSee Billing Views below

Common Tasks

Analyze costs by service

aws ce get-cost-and-usage \  --time-period Start=2026-03-01,End=2026-04-01 \  --granularity MONTHLY \  --metrics UnblendedCost \  --group-by Type=DIMENSION,Key=SERVICE

Default to UnblendedCost. Exclude Credits/Refunds with --filter '{"Not":{"Dimensions":{"Key":"RECORD_TYPE","Values":["Credit","Refund"]}}}'. End date is exclusive.

Run a cost audit

Read references/cost-audit.md for the full 7-step workflow: top cost drivers → month-over-month comparison → optimization recommendations → idle resources → commitment coverage → per-service quick wins → report.

Get right-sizing recommendations

Compute Optimizer requires opt-in first: aws compute-optimizer update-enrollment-status --status Active. Then read references/ec2-rightsizing.md for EC2 or the relevant resource-specific reference.

Look up service pricing

Read references/pricing-lookup.md for service codes and attribute filters. Common trap: Price List API service codes differ from Cost Explorer service names.

Billing Views

A billing view scopes cost and usage data to a specific slice of an account's billing (e.g., a billing group, custom view, or the default primary view). When the user wants to analyze costs through a particular billing view, add --billing-view-arn to supported API calls.

Discover available billing views

aws billing list-billing-views \  --billing-view-types PRIMARY CUSTOM BILLING_GROUP

Requires billing:ListBillingViews permission.

Use a billing view with Cost Explorer

aws ce get-cost-and-usage \  --time-period Start=2026-03-01,End=2026-04-01 \  --granularity MONTHLY \  --metrics UnblendedCost \  --group-by Type=DIMENSION,Key=SERVICE \  --billing-view-arn arn:aws:billing::ACCOUNT_ID:billingview/BILLING_VIEW_ID

Create a budget scoped to a billing view

In the --budget JSON, include the BillingViewArn field:

aws budgets create-budget --account-id ACCOUNT_ID \  --budget '{    "BudgetName": "TeamX-Monthly",    "BudgetLimit": {"Amount": "1000", "Unit": "USD"},    "TimeUnit": "MONTHLY",    "BudgetType": "COST",    "BillingViewArn": "arn:aws:billing::ACCOUNT_ID:billingview/BILLING_VIEW_ID"  }'

API support for --billing-view-arn

Supports --billing-view-arnDoes NOT support it
ce get-cost-and-usagece get-reservation-coverage
ce get-cost-and-usage-with-resourcesce get-reservation-utilization
ce get-cost-forecastce get-savings-plans-coverage
ce get-usage-forecastce get-savings-plans-utilization
ce get-dimension-values
ce get-tags
ce get-cost-comparison-drivers
budgets create-budget (in budget JSON)

Troubleshooting

ErrorCauseFix
ValidationException on Cost ExplorerWrong dimension key (e.g., CHARGE_TYPE instead of RECORD_TYPE)Use RECORD_TYPE for charge type filtering
Empty results with filterFilter value doesn't match exactlyCall GetDimensionValues first to get valid values
AccessDeniedException on hourly dataHourly granularity not enabledEnable in Cost Explorer preferences
Account not registered on Compute OptimizerNot opted inRun update-enrollment-status --status Active
Budgets API fails outside us-east-1Budgets requires us-east-1Set --region us-east-1
Cost Explorer Total empty with GroupByBy design — totals excluded when groupingMake separate call without GroupBy, or sum grouped results using a script
AccessDeniedException on list-billing-viewsMissing permissionUser needs billing:ListBillingViews permissions
ValidationException with --billing-view-arnAPI doesn't support billing views, or malformed ARNCheck the API support table above; ARN format is arn:aws:billing::ACCOUNT_ID:billingview/VIEW_ID
Budget shows UNHEALTHY health statusBilling view access revoked or view deletedCheck HealthStatus.StatusReason in describe-budget output; ensure billing:GetBillingViewData is granted

Additional Resources

  • AWS Cost Management User Guide: https://docs.aws.amazon.com/cost-management/
  • AWS Pricing Calculator: https://calculator.aws/
  • Compute Optimizer User Guide: https://docs.aws.amazon.com/compute-optimizer/
  • Well-Architected Cost Optimization Pillar: https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/

Todos los archivos

0 archivos

Instalar aws-billing-and-cost-management

Descargue y extraiga los archivos de habilidades a su directorio .claude/skills/.

Descargar ZIP

Clona el repositorio y copia los archivos de la habilidad a tu proyecto.

git clone https://github.com/aws/agent-toolkit-for-aws/blob/main/skills/core-skills/aws-billing-and-cost-management/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

Copiar Copiar
Configuración rápida: Copie la carpeta de habilidades a .claude/skills; Claude detectará automáticamente dicha carpeta y la utilizará.

Habilidades relacionadas

Cloudflare Manager
Tiempo actualizado 29 de junio de 2026
pinecone
Tiempo actualizado 29 de junio de 2026
azure-setup-guide
Tiempo actualizado 29 de junio de 2026
sentry-architecture-variants
Tiempo actualizado 29 de junio de 2026
OR