Skip to content

feat(aws): add support for aws_sagemaker_endpoint_configuration#3567

Open
muhammadahmed-01 wants to merge 34 commits into
infracost:masterfrom
muhammadahmed-01:feat/add_sagemake_endpoint_configuration
Open

feat(aws): add support for aws_sagemaker_endpoint_configuration#3567
muhammadahmed-01 wants to merge 34 commits into
infracost:masterfrom
muhammadahmed-01:feat/add_sagemake_endpoint_configuration

Conversation

@muhammadahmed-01

@muhammadahmed-01 muhammadahmed-01 commented May 7, 2026

Copy link
Copy Markdown

Objective:

Add support for AWS SageMaker Endpoint Configuration pricing. Fixes #2733.

Pricing details:

Overview

This PR adds comprehensive cost estimation for aws_sagemaker_endpoint_configuration resources, covering both serverless and provisioned instance-based inference endpoints.

Supported Components

Serverless Inference:

  • Compute Duration: Charged per second based on memory allocation and inference duration

    • Usage parameter: monthly_inference_duration_secs
  • Provisioned Concurrency - Warm: Charged for maintaining warm container instances

    • Usage parameter: monthly_provisioned_concurrency_usage_secs
    • Represents readiness cost for provisioned concurrency
  • Provisioned Concurrency - Execution: Charged for actual inference execution on provisioned capacity

    • Usage parameter: monthly_provisioned_concurrency_inference_duration_secs
    • Scaled by variant memory allocation
  • Data Transfer (In/Out): Per-GB charges for data processed through endpoints

    • Usage parameters: monthly_data_processed_in_gb, monthly_data_processed_out_gb
    • Separate billing for inbound and outbound traffic

Provisioned Instances:

  • Instance Hours: Hourly instance charges for dedicated inference capacity

    • Usage parameter: instance_hrs (defaults to 730 hours/month)
  • General Purpose Storage: Prorated storage for model artifacts and code

    • Usage parameter: storage_days (defaults to 30)
    • Formula: (storage_gb × storage_days) / 30
  • Data Transfer (In/Out): Same as serverless variant

Shadow Variants

Shadow variants are billed identically to production variants, enabling cost estimation for A/B testing and gradual traffic migration scenarios.

Multiple Variants

Endpoint configurations with multiple variants accurately reflect combined costs across all variants.

Test Coverage

  • Golden file testing with 5 endpoint configuration scenarios:
    • Instance-based endpoints with multiple variants
    • Serverless endpoints (basic and with provisioned concurrency)
    • Multiple serverless variants with different memory sizes
    • Shadow variant configuration

Usage File Example

aws_sagemaker_endpoint_configuration.my_serverless_config:
    instance_hrs: 100
    monthly_inference_duration_secs: 500000
    monthly_provisioned_concurrency_usage_secs: 200000
    monthly_provisioned_concurrency_inference_duration_secs: 100000
    monthly_data_processed_in_gb: 20
    monthly_data_processed_out_gb: 10
    storage_days: 15

Status:

  • Generated the resource files
  • Updated the internal/resources file
  • Updated the internal/provider/terraform/.../resources file
  • Added usage parameters to infracost-usage-example.yml
  • Added test cases without usage-file
  • Added test cases with usage-file
  • Compared test case output to cloud cost calculator
  • Created a PR to update "Supported Resources" in the docs

Issues:

None

@muhammadahmed-01 muhammadahmed-01 changed the title Feat/add sagemake endpoint configuration feat(aws): add support for aws_sagemaker_endpoint_configuration May 7, 2026
@muhammadahmed-01 muhammadahmed-01 marked this pull request as draft May 8, 2026 07:52
@muhammadahmed-01

Copy link
Copy Markdown
Author

Hi @aliscott,

I've opened this PR to provide a proper implementation for aws_sagemaker_endpoint_configuration.

I appreciate your feedback on the previous attempt. I had to step away for a while due to personal reasons, but I’ve now completed a total manual overhaul of the logic to ensure it meets Infracost’s quality standards.

A few points on the manual refinement in this version:

  • Architectural Consistency: I used the lambda_function implementation as a structural reference to ensure consistency in how we handle usage-based compute.
  • Deep-Dive Pricing Mapping: I manually mapped the logic for both Serverless (including Provisioned Concurrency) and Provisioned Instances. I specifically ensured that Shadow Variants are captured, as they contribute to the bottom line but are often overlooked in basic estimations.
  • Calculator Validation: Every test case in the golden files has been manually cross-referenced against the AWS Sagemaker AI pricing page to ensure accuracy across various memory and instance configurations.
  • Guideline Compliance: I have performed a thorough pass against the contributing.md and resource adding and resource mapping guidelines.

I'm back on this now and committed to seeing this through to completion. I'd appreciate a fresh look whenever you have a moment.

@muhammadahmed-01 muhammadahmed-01 marked this pull request as ready for review May 8, 2026 12:13
@muhammadahmed-01

Copy link
Copy Markdown
Author

Hey @aliscott, did you get a chance to review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for AWS Sagemaker Endpoint Resources

1 participant