Skip to content

Instantly share code, notes, and snippets.

@DavidWells
Created February 13, 2025 21:57
Show Gist options
  • Save DavidWells/5dd7b3e4649ec78979f9fbe69ade8dc9 to your computer and use it in GitHub Desktop.
Save DavidWells/5dd7b3e4649ec78979f9fbe69ade8dc9 to your computer and use it in GitHub Desktop.

Resource Costs Prompt

You are an expert AWS Billing consultant. You are to

Below is a list of resources in this CloudFormation stack. Please provide me with their associated costs.

Please output the response with Fixed costs first (For example KMS key costs $1 per month per key), then Variable costs (for example requests to S3 cost $0.01 per 1000 requests).

If any Fixed Monthly Costs are present, please provide the total monthly cost for all Fixed Monthly Costs.

If any Variable Costs are present, please provide some scenarios for how much they might cost. When calculating the scenarios, MAKE SURE to use the correct pricing for the resource (for example, $0.20 per 1M requests for Lambda). Also make sure to include the free tier in your calculations of the scenarios. For any resource that can have on demand billing, assume that is billing mode (For example DynamoDB on demand billing is $0.25 per 1M requests).

At the bottom of your response add the total fixed and estimated variable costs in bold.

Highlight high cost impact resources and suggest optimizations and or alternative approaches.

Here are the resources and their counts:

  • 10 instances of AWS::ApiGateway::Method
  • 8 instances of AWS::Lambda::Permission
  • 5 instances of AWS::ApiGateway::Resource
  • 4 instances of AWS::IAM::Role
  • 4 instances of AWS::Lambda::Function
  • 1 instance of AWS::ApiGateway::RestApi
  • 1 instance of AWS::ApiGateway::Deployment
  • 1 instance of AWS::ApiGateway::Stage
  • 1 instance of AWS::Cognito::UserPool
  • 1 instance of AWS::Cognito::UserPoolClient

And below are a guesstimate of costs. Use these as a gut check.

Guesstimate of costs

Below are results from infracost CLI.

This is not raw infrastructure data, but pre-calculated cost estimates:

Project: main

 Name                                                    Monthly Qty  Unit                        Monthly Cost   
                                                                                                                 
 aws_api_gateway_rest_api.auth_service_rest_api                                                                  
 └─ Requests (first 333M)                        Monthly cost depends on usage: $3.50 per 1M requests            
                                                                                                                 
 aws_lambda_function.confirm_function                                                                            
 ├─ Requests                                     Monthly cost depends on usage: $0.20 per 1M requests            
 ├─ Ephemeral storage                            Monthly cost depends on usage: $0.0000000309 per GB-seconds     
 └─ Duration (first 6B)                          Monthly cost depends on usage: $0.0000166667 per GB-seconds     
                                                                                                                 
 aws_lambda_function.signin_function                                                                             
 ├─ Requests                                     Monthly cost depends on usage: $0.20 per 1M requests            
 ├─ Ephemeral storage                            Monthly cost depends on usage: $0.0000000309 per GB-seconds     
 └─ Duration (first 6B)                          Monthly cost depends on usage: $0.0000166667 per GB-seconds     
                                                                                                                 
 aws_lambda_function.signout_function                                                                            
 ├─ Requests                                     Monthly cost depends on usage: $0.20 per 1M requests            
 ├─ Ephemeral storage                            Monthly cost depends on usage: $0.0000000309 per GB-seconds     
 └─ Duration (first 6B)                          Monthly cost depends on usage: $0.0000166667 per GB-seconds     
                                                                                                                 
 aws_lambda_function.signup_function                                                                             
 ├─ Requests                                     Monthly cost depends on usage: $0.20 per 1M requests            
 ├─ Ephemeral storage                            Monthly cost depends on usage: $0.0000000309 per GB-seconds     
 └─ Duration (first 6B)                          Monthly cost depends on usage: $0.0000166667 per GB-seconds     
                                                                                                                 
 OVERALL TOTAL                                                                                          $0.00 

*Usage costs can be estimated by updating Infracost Cloud settings, see docs for other options.

──────────────────────────────────
36 cloud resources were detected:
∙ 5 were estimated
∙ 30 were free
∙ 1 is not supported yet, see https://infracost.io/requested-resources:
  ∙ 1 x aws_cognito_user_pool

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Project                                            ┃ Baseline cost ┃ Usage cost* ┃ Total cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━┫
┃ main                                               ┃         $0.00 ┃           - ┃      $0.00 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━┛

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