Vintner

Cost Estimation

How the platform estimates infrastructure costs in real-time and via Infracost analysis.

Cost Estimation

The platform provides two layers of cost estimation: a real-time cost sidebar during vine configuration, and a post-plan Infracost analysis for precise per-resource costs.

Cost Estimation

Cost Sidebar (Real-Time)

The cost sidebar appears on the right side of the Plant a Vine form. As the user configures infrastructure, the estimated monthly cost updates immediately.

How Pricing Works

  1. When a region is selected, the fetchPrices(region) action fetches pricing from the AWS Pricing API
  2. Prices are cached in the Zustand store with a 24-hour TTL
  3. Each component contributes a cost line item

Pricing Sources

The getRegionPrices(region) server action fetches:

ResourcePricing KeySource
EKS control planeFixed $0.10/hourHardcoded
EC2 instancesPer instance typeAWS Pricing API (on-demand, Linux, shared tenancy)
NAT Gateway$0.048/hourAWS Pricing API
Aurora ACU$0.14/ACU-hourAWS Pricing API
ElastiCache nodesPer node typeAWS Pricing API
WAF web ACL~$5/monthHardcoded
Secrets$0.40/secret/monthHardcoded

Cost Calculation

Monthly cost = Σ (hourly_rate × 730 hours/month)

Per component:

  • Cluster: EKS control plane ($73/mo) + node_desired_size × average_instance_rate × 730
  • NAT Gateway: $0.048 × count × 730 (single = 1, HA = AZ count)
  • Database: min_capacity × ACU_rate × 730 per instance
  • Cache: node_rate × num_cache_nodes × 730 per cache
  • WAF: $5 per enabled WAF option
  • Secrets: $0.40 per secret
  • NoSQL/Queues/Topics: $0 (usage-based, not estimable from config)

Fallback Pricing

If the AWS Pricing API call fails (network error, rate limit), hardcoded fallback rates are used:

const FALLBACK_EC2: Record<string, number> = {
  't3.medium': 0.0416,
  't3.large': 0.0832,
  'm5a.large': 0.086,
  // ...
};

Infracost Analysis (Post-Plan)

After a Tendril runs terraform plan, it optionally runs Infracost for a precise cost breakdown based on the actual Terraform resources.

How It Works

Terraform plan completes

The Tendril generates a plan JSON via terraform show -json plan.tfplan.

Infracost analyzes the plan

If an INFRACOST_API_KEY is configured, the Tendril runs:

infracost breakdown --path plan.json --format json

Cost data stored

The Infracost output is parsed and stored in the job's execution_metadata.cost_breakdown field.

UI displays breakdown

The Plan tab in the vine detail page shows per-resource costs and a total monthly estimate.

Why Both?

Cost SidebarInfracost
WhenDuring form editingAfter plan generation
SpeedInstantRequires plan job
AccuracyApproximate (simple formulas)Precise (analyzes actual Terraform resources)
ScopeMajor cost drivers onlyEvery resource in the plan
Use caseQuick feedback while configuringFinal review before apply

The sidebar gives instant feedback to guide decisions. Infracost gives the precise number for sign-off before deploying.

On this page