content/operate/rc/api/examples/dryrun-cost-estimates.md
When you change your subscriptions and databases, you also change the cost of your deployment. With a dry-run request, you can evaluate the impact and obtain a new cost estimate before you deploy these changes:
API operations that support dry-run requests accept the dryRun boolean parameter in the JSON request body.
For example, the JSON body of a create subscription request body can include "dryRun": true:
{
"name": "DryRun Cost evaluation subscription",
"dryRun": true,
"paymentMethodId": 8240,
"cloudProviders": [
{
"cloudAccountId": 16424,
"regions": [
{
"region": "us-east-1",
"networking": {
"deploymentCIDR": "10.0.0.0/24"
}
}
]
}
],
"databases": [
{
"name": "database-a",
"memoryLimitInGb": 0.1
}
]
}
Dry-run requests behave like regular requests except that no changes are made to existing resources. A dry-run request produces a cost evaluation report for the subscription.
| API Operation | "dryRun": false (default) | "dryRun": true |
|---|---|---|
| Create subscription | Create a subscription | Returns a cost evaluation report of the planned subscription |
| Create database | Creates a new database in the subscription | Returns a cost evaluation report for the relevant subscription |
| Update database | Changes the specified database | Returns a cost evaluation report and evaluates whether the relevant subscription requires additional resources based on the database modification |
This section demonstrates a complete example of a create subscription dry-run request and response.
Here is an example of the pricing request body:
{
"name": "DryRun Cost evaluation subscription",
"dryRun": true,
"paymentMethodId": 8240,
"cloudProviders": [
{
"cloudAccountId": 16424,
"regions": [
{
"region": "us-east-1",
"networking": {
"deploymentCIDR": "10.0.0.0/24"
}
}
]
}
],
"databases": [
{
"name": "database-a",
"throughputMeasurement": {
"by": "operations-per-second",
"value": 1000
},
"memoryLimitInGb": 0.1
, "quantity": 3
},
{
"name": "database-b",
"throughputMeasurement": {
"by": "operations-per-second",
"value": 1000
},
"replication": false
,"memoryLimitInGb": 0.1
},
{
"name": "database-c",
"throughputMeasurement": {
"by": "operations-per-second",
"value": 1000
},
"replication": true
,"memoryLimitInGb": 5
},
{
"name": "database-d",
"throughputMeasurement": {
"by": "operations-per-second",
"value": 10000
},
"replication": false
,"memoryLimitInGb": 12
},
{
"name": "database-e",
"throughputMeasurement": {
"by": "operations-per-second",
"value": 25000
},
"replication": true
,"memoryLimitInGb": 25
} ]
}
"dryRun": true parameterdatabase-a, database-b, database-c, etc.Here is an example of the pricing response section for the above create subscription dry-run request:
{
"response": {
"resource": {
"pricing": [
{
"databaseName": "database-a",
"type": "Shards",
"typeDetails": "micro",
"quantity": 6,
"quantityMeasurement": "shards",
"pricePerUnit": 0.027,
"priceCurrency": "USD",
"pricePeriod": "hour"
},
{
"databaseName": "database-b",
"type": "Shards",
"typeDetails": "micro",
"quantity": 1,
"quantityMeasurement": "shards",
"pricePerUnit": 0.027,
"priceCurrency": "USD",
"pricePeriod": "hour"
},
{
"databaseName": "database-c",
"type": "Shards",
"typeDetails": "high-throughput",
"quantity": 2,
"quantityMeasurement": "shards",
"pricePerUnit": 0.124,
"priceCurrency": "USD",
"pricePeriod": "hour"
},
{
"databaseName": "database-d",
"type": "Shards",
"typeDetails": "small",
"quantity": 1,
"quantityMeasurement": "shards",
"pricePerUnit": 0.156,
"priceCurrency": "USD",
"pricePeriod": "hour"
},
{
"databaseName": "database-e",
"type": "Shards",
"typeDetails": "large",
"quantity": 2,
"quantityMeasurement": "shards",
"pricePerUnit": 0.293,
"priceCurrency": "USD",
"pricePeriod": "hour"
},
{
"type": "EBS Volume",
"quantity": 345,
"quantityMeasurement": "GB"
},
{
"type": "r5.xlarge",
"quantity": 3,
"quantityMeasurement": "instances"
}
]
}
}
}
{{<note>}}Some of the response content was omitted for brevity.{{</note>}}
pricing array contains an element for each database, containing the database name and cost evaluation related to that databasepricePerUnit (where unit is a shard of the specific type), priceCurrency, and pricePeriodpricePerUnit * quantitycloudAccountId = 1 in the create subscription request) - The cost evaluation response includes a MinimumPrice element. This indicates the minimal hourly cost of the entire subscription. This minimum price will be charged if the sum of all shards for all the subscription's databases is less than the specified minimum priceThe Get subscriptions and Get subscription by id JSON response contains an element named subscriptionPricing that details the latest calculated cost of a subscription, grouped by shard type for all the databases in the subscription.