IBM Cloud Docs
Scenario: Estimating costs of a Code Engine App with a IBM Cloudant Database and Observability Tools

Scenario: Estimating costs of a Code Engine App with a IBM Cloudant Database and Observability Tools

Assume that you deployed your web application on to IBM Cloud® Code Engine. The IBM Cloud® Code Engine uses several services that are provided by IBM Cloud® including a database, logging and monitoring. You can learn how the actual cost of your application is calculated in this example.

With IBM Cloud® Code Engine you pay for only the memory and CPU needed to run your application, and any incoming HTTP calls. It includes scaling to 0, if your application doesn't receive any traffic for a span of time. For example, assume a production application, which is always running, and the application has the following specifications:

  • The application is configured with 1 vCPU and 4 GB of memory (default for apps and jobs).
  • The application receives 5 million HTTP requests in 30 days.
  • The application uses a IBM Cloudant Standard plan with:
  • 150 GB of data storage (130 GB over the zero-cost 20 GB)
    • 1,000 lookups per second
    • 500 writes per second
    • 50 queries per second
  • The application uses IBM Cloud Logs Standard plan for log storage and search.
    • The application needs 7 days of fast search
    • The logs are retained in for 3 months in IBM Cloud
  • The application uses IBM Cloud Monitoring for performance metrics.
    • Only platform-metrics from Code Engine and IBM Cloudant are needed

Code Engine includes a zero-cost tier, and IBM Cloudant Standard plan includes 20 GB of zero-cost storage so you can experiment before you commit.

The prices that are used in this example are in US currency and do not reflect current prices or include any discounts or promo codes. For the most up-to-date prices, see Code Engine pricing, IBM Cloudant pricing, IBM Cloud Logs pricing, and IBM Cloud Monitoring pricing.

Pricing scenario

The following table provides an example of estimated pricing for running an application in Code Engine that uses IBM Cloudant Standard plan as a data store, along with IBM Cloud Logs and IBM Cloud Monitoring. IBM Cloud is also needed to query log data older than 7 days. The scenario assumes the following usage pattern:

Estimated costs for a Code Engine application with IBM Cloudant Standard plan, IBM Cloud Logs, and IBM Cloud Monitoring
Description Quantity Rate Cost
Code Engine - vCPU seconds 2,492,000 $0.00003431 $85.50
Code Engine - GB seconds 10,168,000 $0.00000356 $36.20
Code Engine - Requests 4,900,000 $0.538 per million $2.64
SubTotal $124.34
IBM Cloudant - GB 130 $1.00 per GB $130.00
IBM Cloudant - Lookups/second 10 $0.25 per 100 Lookups/second $2.50
IBM Cloudant - Writes/second 10 $0.50 per 50 Write/second $5.00
IBM Cloudant - Queries/second 10 $5.00 per 5 Query/second $50.00
SubTotal $187.50
IBM Cloud Logs - 7 days 5 GB $1.20 per GB $6.00
SubTotal $6.00
IBM Cloud Monitoring - Time-series Metrics 110 $0.08 per metric $8.80
SubTotal $8.80
IBM Cloud - Storage capacity 15 GB $0.0230 per GB/month $0.36
IBM Cloud - Public outbound bandwidth 15 GB $0.0000 per GB (within allowance) $0.00
IBM Cloud - Class A requests 15,000 $0.0000 per 1,000 (within allowance) $0.00
IBM Cloud - Class B requests 150,000 $0.0000 per 10,000 (within allowance) $0.00
SubTotal $0.36
Total $327.00

Calculation details

Code Engine Calculation details

The following calculations include the Code Engine zero-cost tier allocations, which include:

  • 100,000 vCPU seconds per month
  • 200,000 GB seconds of memory per month
  • 100,000 HTTP requests per month

vCPU

1 vCPU * 24 hours * 30 days * 3600 seconds = 2,592,000 vCPU seconds
Free tier: 100,000 vCPU seconds
Billable: 2,592,000 - 100,000 = 2,492,000 vCPU seconds
2,492,000 * $0.00003431 = $85.50

Memory

4 GB * 24 hours * 30 days * 3600 seconds = 10,368,000 GB seconds
Free tier: 200,000 GB seconds
Billable: 10,368,000 - 200,000 = 10,168,000 GB seconds
10,168,000 * $0.00000356 = $36.20

HTTP Requests

5,000,000 requests total
Free tier: 100,000 requests
Billable: 5,000,000 - 100,000 = 4,900,000 requests
4,900,000 * ($0.538 / 1,000,000) = $2.64

IBM Cloudant Calculation details

In this scenario, we are using 150 GB of storage but with 20 GB of free data storage, we pay for the extra 130 GB. The lookups, writes, and queries are charged based on the provisioned capacity in their respective increments. For more detailed information about IBM Cloudant pricing, see IBM Cloudant Pricing.

Standard plan - Data

150 GB total, 20 GB free, 130 GB charged
130 GB * $1.00 per GB = $130.00

Standard plan - Lookups

1,000 Lookups/second / 100 Lookups/second = 10 units
10 * $0.25 per 100 Lookups/second = $2.50

Standard plan - Writes

500 Writes/second / 50 Writes/second = 10 units
10 * $0.50 per 50 Writes/second = $5.00

Standard plan - Queries

50 Queries/second / 5 Queries/second = 10 units
10 * $5.00 per 5 Queries/second = $50.00

IBM Cloud Logs Calculation details

IBM Cloud Logs supports tiering of your log data to help optimize your logging costs while still being able to search and analyze applications log data. In this scenario, log data is stored in the initial default of 7-day retention in Priority Insights. After 7-days, the log data will be queried from IBM Cloud at the IBM Cloud rates. It is assumed that logs are retained for 3 months in IBM Cloud.

Estimated Monthly log volume: 1 KB per request * 5,000,000 requests/month * 1 months = 5 GB

Standard plan - Priority insights - 7 days:

5 GB * $1.20 per GB = $6.00

IBM Cloud Calculation details

Standard plan (us-south)

3 months of logs: 1 KB per request * 5,000,000 requests/month * 3 months = 15 GB

Storage capacity: 15 GB * $0.0230 per GB/month = $0.36

Public outbound bandwidth: Allowance: 100% of storage in GB = 15 GB Actual usage: 15 GB 15 GB ≤ 15 GB allowance, so no additional charge

Class A requests (write operations)

Allowance: 100 x storage in GB = 100 x 15 = 1500 requests Actual usage: Assuming that a file writes every 10 min; 43800 minutes/month / 10 minutes = 4380 4,380 > 1500 allowance, but the charge applies for 1,000 requests Billable requests: 4,380 - 1,500 = 2880 2880 * ($0.0052 / 1,000) = $0.014976 (rounded to $0.01 due to small amount)

Class B requests (read operations)

Allowance: 1000 x storage in GB = 1000 x 15 = 15,000 requests Actual usage: Assume that 3 files are read. For every file that is written in a month, 4,380 * 3 = 13140 13,140 < 15,000 allowance, but the charge applies for 10,000 requests Billable requests: Less than the allowance, so no charge

Total IBM Cloud Object Storage cost: $0.36 + $0.00 + $0.01 + $0.00 = $0.37

IBM Cloud Monitoring Calculation details

Monitoring of Code Engine and IBM Cloudant is enabled by using platform metrics. Platform metrics IBM Cloud Monitoring are charged by using the tiered pricing based on the number of time-series hours metrics. For more examples on billing, see Billing samples.

For platform metrics IBM Cloud Monitoring charges based on the number of time-series metrics:

time-series metrics: $0.08 USD per metric

In this scenario, assume 110 time-series metrics (50 for Code Engine and 60 for IBM Cloudant).

Time-series Metrics

Code Engine and IBM Cloudant provide various platform metrics to monitor your applications. The number of time-series depends on the cardinality, or number of unique time series associated with a metric. In this scenario, we are assuming 60 time-series for Code Engine and 50 time-series for IBM Cloudant.

Code Engine: 60 time-series/month
IBM Cloudant: 50 time-series/month
Total: 110 time-series/month * 730 hours/month = 
110 * $0.08 per metric = $8.80

Conclusion

This pricing scenario provides an estimate of the costs that are associated with running a Code Engine application that uses IBM Cloudant, IBM Cloud Logs, and IBM Cloud Monitoring provided by IBM Cloud®. The total estimated cost for this scenario is $327.00 USD per month.

The actual costs may vary based on your specific usage patterns, data volumes, and configuration choices.

To get a more accurate estimate tailored to your specific needs, you can use the IBM Cloud cost estimator. You can input your expected usage for various services and the tool provides a customized cost estimate based on current pricing.

By carefully estimating your costs and by using the available tools, you can make informed decisions about your cloud resource usage and optimize your spending on the IBM Cloud® platform.