xiaohongshu
xiaohongshu
infrastructure-cost-estimation
Help you discover how much you spend on AWS/GCP/Azure. This rulebook guides practitioners through proper cloud cost calculations, systematic resource discovery (via IaC analysis and live environment enumeration), authoritative pricing research and analysis/estimation.
Full skill instructions
MANDATORY: Always exclude credits, promotional offers, and discounts to get TRUE infrastructure cost. Report:
Credits are temporary and mask real costs. Always plan for post-credit expenses.
CRITICAL: Always use the most recent complete months for analysis:
CRITICAL: Use these exact CLI commands to exclude credits and get true infrastructure costs:
# Exclude all credits and promotional charges
aws ce get-cost-and-usage \
--time-period Start=YYYY-MM-01,End=YYYY-MM-01 \
--granularity MONTHLY \
--metrics "BlendedCost" \
--filter '{
"Not": {
"Dimensions": {
"Key": "RECORD_TYPE",
"Values": ["Credit", "Refund", "SavingsPlanNegation", "DiscountedUsage"]
}
}
}' \
--group-by Type=DIMENSION,Key=SERVICE
Create query file exclude-credits.json:
{
"type": "Usage",
"timeframe": "Custom",
"timePeriod": {
"from": "YYYY-MM-01T00:00:00.000Z",
"to": "YYYY-MM-01T00:00:00.000Z"
},
"dataset": {
"granularity": "Monthly",
"filter": {
"not": {
"dimensions": {
"name": "ChargeType",
"operator": "In",
"values": ["Credit", "Refund", "RoundingAdjustment"]
}
}
},
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [{"type": "Dimension", "name": "ServiceName"}]
}
}
Execute with:
az rest --method POST \
--url "https://management.azure.com/subscriptions/$(az account show --query id -o tsv)/providers/Microsoft.CostManagement/query?api-version=2023-11-01" \
--body @exclude-credits.json
Note: Google Cloud requires BigQuery queries. No direct CLI credit filtering available.
# First, execute BigQuery to exclude promotional credits
bq query --use_legacy_sql=false '
SELECT
invoice.month,
service.description,
SUM(cost) as gross_cost_no_credits
FROM `PROJECT-ID.DATASET.gcp_billing_export_v1_BILLING-ACCOUNT-ID`
WHERE invoice.month IN ("YYYYMM", "YYYYMM", "YYYYMM")
GROUP BY invoice.month, service.description
ORDER BY gross_cost_no_credits DESC;'
Key Filter Parameters by Provider:
AWS: Cost Explorer, Pricing Calculator, Budgets, Cost & Usage Reports, Billing Dashboard Azure: Cost Management + Billing, Pricing Calculator, Advisor, Resource Graph
Google Cloud: Cloud Billing, Pricing Calculator, Asset Inventory, Recommender
Methods: IaC analysis, live environment queries, API enumeration Categories: Compute, storage, networking, platform services, security, monitoring, development, data services Coverage: All environments, regions, scaling policies, shared resources
Requirements:
def analyze_credit_impact(billing_data, analysis_period="recent_months"):
"""
Analyze credit impact for recent complete months
Calculate recent months dynamically based on current date
"""
from datetime import datetime, timedelta
# Determine current date and calculate recent complete months
current_date = datetime.now()
current_month = current_date.month
current_year = current_date.year
# Calculate the last 3 complete months
recent_months = []
for i in range(3):
month_offset = i + 1
if current_month - month_offset <= 0:
month = 12 + (current_month - month_offset)
year = current_year - 1
else:
month = current_month - month_offset
year = current_year
recent_months.append((year, month))
recent_months.reverse() # Put in chronological order
# Filter billing data to recent complete months
recent_billing_data = [
charge for charge in billing_data
if (charge['date'].year, charge['date'].month) in recent_months
]
analysis = {
'analysis_period': f"Recent 3 complete months: {recent_months[0][1]}/{recent_months[0][0]} - {recent_months[2][1]}/{recent_months[2][0]}",
'gross_monthly_cost': sum(
charge['amount'] for charge in recent_billing_data
if charge['type'] in ['Usage', 'Tax', 'Fee']
) / 3, # Average over 3 months
'net_monthly_cost': sum(charge['amount'] for charge in recent_billing_data) / 3,
'total_credits_applied': 0,
'credit_sustainability': 'TEMPORARY - Assume all credits expire'
}
analysis['total_credits_applied'] = (
analysis['gross_monthly_cost'] - analysis['net_monthly_cost']
)
return analysis
def calculate_monthly_costs(resources, pricing_data):
HOURS_PER_MONTH = 730
total_cost = 0
cost_breakdown = {}
for service_name, service_config in resources.items():
service_cost = 0
# Fixed costs (standard hourly rates)
if 'instances' in service_config:
hourly_rate = pricing_data[service_name]['standard_hourly_rate']
instance_count = service_config['instances']
service_cost += hourly_rate * instance_count * HOURS_PER_MONTH
# Usage-based costs (standard rates)
if 'usage_metrics' in service_config:
for metric, usage in service_config['usage_metrics'].items():
unit_cost = pricing_data[service_name]['standard_usage'][metric]
service_cost += usage * unit_cost
cost_breakdown[service_name] = round(service_cost, 2)
total_cost += service_cost
return {
'total_monthly_cost': round(total_cost, 2),
'service_breakdown': cost_breakdown
}
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience