Sub topic 14
Cost and limits to plan for
This chapter assumes you can create parameters and secrets and read them from the CLI and an SDK. It covers what each service charges for, the quotas that constrain a design, and how throttling shows up in practice. Prices and quotas change, so the figures here are examples. Check the AWS pricing pages and the Service Quotas console before you commit to a design.
What you pay for
The two services bill in different ways. Parameter Store charges nothing for most use. Secrets Manager charges for every secret and every API call.
| Item | Parameter Store standard | Parameter Store advanced | Secrets Manager |
|---|---|---|---|
| Storage | Free | About $0.05 per parameter per month | About $0.40 per secret per month, prorated |
| API calls | Free at default throughput | About $0.05 per 10,000 calls | About $0.05 per 10,000 calls |
| Maximum value size | 4 KB | 8 KB | 64 KB |
| Maximum count per Region | 10,000 | 100,000 | 500,000 |
| Parameter policies (expiration, notification) | No | Yes | Not applicable |
Two other bills often surprise teams.
- KMS. An AWS managed key such as
alias/aws/ssmoraws/secretsmanagerhas no monthly fee. A customer managed key costs about $1 per month plus about $0.03 per 10,000 requests. Every decryption of a SecureString or a secret is a KMS request, so a high read rate raises the KMS line as well. - Rotation. Rotation runs in a Lambda function, so you pay Lambda invocation and duration charges. Each rotation also makes additional Secrets Manager and KMS calls.
Replicas count too. A secret replicated to two other Regions is billed as three secrets.
A worked estimate
Suppose a service has 200 secrets, and its containers fetch them at startup and on every request that needs a credential. The service makes 20 million GetSecretValue calls per month.
- Storage: 200 × $0.40 = $80.00
- API calls: 20,000,000 ÷ 10,000 × $0.05 = $100.00
- Total: $180.00 per month, before KMS
Most of that bill comes from the API calls, not the secrets. If you cache each secret in process for five minutes, the same service might make a few hundred thousand calls instead of 20 million. The API charge drops below $2 and the application also gets faster.
The script below turns that arithmetic into a reusable check. It uses only the standard library.
SECRET_PRICE = 0.40 # USD per secret per month
API_PRICE_PER_10K = 0.05 # USD per 10,000 API calls
ADVANCED_PARAM_PRICE = 0.05 # USD per advanced parameter per month
def secrets_manager_cost(secrets: int, api_calls: int, replicas: int = 0) -> float:
billed_secrets = secrets * (1 + replicas)
return billed_secrets * SECRET_PRICE + api_calls / 10_000 * API_PRICE_PER_10K
def parameter_store_cost(advanced_params: int, advanced_api_calls: int = 0) -> float:
return advanced_params * ADVANCED_PARAM_PRICE + advanced_api_calls / 10_000 * API_PRICE_PER_10K
if __name__ == "__main__":
print(f"No cache: ${secrets_manager_cost(200, 20_000_000):.2f}")
print(f"With cache: ${secrets_manager_cost(200, 300_000):.2f}")
print(f"500 advanced parameters: ${parameter_store_cost(500):.2f}")Running it prints $180.00 without caching, $95.00 with caching and $25.00 for the advanced parameters.
Parameter Store tiers and throughput
Parameter Store has two separate settings that people confuse.
- Tier is a property of each parameter: standard or advanced. Choose advanced when you need a value over 4 KB, more than 10,000 parameters, or parameter policies.
- Throughput is an account and Region setting. The default throughput for standard parameters is limited to tens of requests per second per API, such as
GetParameterandGetParametersByPath. You can raise it with a setting that charges per 10,000 interactions.
You can see and change both settings with the CLI.
aws ssm get-service-setting \
--setting-id arn:aws:ssm:us-east-1:111122223333:servicesetting/ssm/parameter-store/high-throughput-enabled
aws ssm update-service-setting \
--setting-id arn:aws:ssm:us-east-1:111122223333:servicesetting/ssm/parameter-store/high-throughput-enabled \
--setting-value trueA third setting, the default tier, controls what put-parameter creates when you do not pass --tier. Setting it to Intelligent-Tiering makes Parameter Store choose advanced only when a value or feature requires it. Without that setting, a value over 4 KB fails the write.
Size and count limits
Limits decide design choices more often than price does.
- Value size. A standard parameter holds 4 KB. A secret holds 64 KB. A certificate chain or a large JSON document can exceed 4 KB, which pushes you toward advanced parameters or Secrets Manager.
- Batch reads.
GetParametersaccepts at most 10 names per call.GetParametersByPathreturns at most 10 parameters per page, so a path with 200 parameters needs at least 20 calls. Use the SDK paginator and expect the call count to grow with the path. - Hierarchy depth. Parameter names can have up to 15 levels. A flat name with a prefix is easier to authorize with IAM anyway.
- Versions. Parameter Store keeps the last 100 versions of a parameter. Secrets Manager keeps up to about 100 versions of a secret, but only versions with a staging label are protected. Unlabeled versions older than 24 hours are removed first.
- Name reuse. A Secrets Manager secret scheduled for deletion keeps its name until the recovery window ends, which is 7 to 30 days. You cannot create a new secret with that name during the window. Infrastructure that deletes and recreates stacks often hits this.
Throttling and how it appears
When you exceed a quota the service returns an error. Parameter Store returns ThrottlingException. Secrets Manager returns ThrottlingException or TooManyRequestsException. KMS returns its own ThrottlingException, and this is the one people miss, because the error comes from a decrypt step that your code never called directly.
KMS cryptographic operations share a per-Region quota across all services in the account. A busy fleet that decrypts SecureString values on every request can exhaust that quota, and then unrelated workloads that use KMS also begin to fail.
The first defense is retry with backoff. The SDKs retry throttling errors by default, but you can raise the attempt count and switch to adaptive mode.
import boto3
from botocore.config import Config
config = Config(retries={"mode": "adaptive", "max_attempts": 10})
ssm = boto3.client("ssm", config=config)
secrets = boto3.client("secretsmanager", config=config)
paginator = ssm.get_paginator("get_parameters_by_path")
params = {}
for page in paginator.paginate(Path="/myapp/prod", Recursive=True, WithDecryption=True):
for p in page["Parameters"]:
params[p["Name"]] = p["Value"]
print(len(params), "parameters loaded")Retries only smooth out short bursts. A sustained overload needs fewer calls, which means caching, as the earlier chapter showed, or spreading startup times so that a whole fleet does not fetch at the same second.
Planning checklist
- Count the values you expect in each Region, and include replicas and per-environment copies. A multiplier of three environments and two Regions turns 100 secrets into 600 billed secrets.
- Put values that are not secret in Parameter Store standard. Reserve Secrets Manager for values that need rotation, large payloads, or replication.
- Group related credentials into one JSON secret. Ten secrets cost $4 per month, while one secret with ten keys costs $0.40. The trade-off is that a policy grants access to the whole document.
- Estimate API calls per instance per hour, then multiply by fleet size and any autoscaling peak.
- Request quota increases in the Service Quotas console before launch, because some increases take days.
Exercise
A team stores 40 database credentials as 40 separate secrets in Secrets Manager. Each one is replicated to one additional Region. Their app makes 5 million GetSecretValue calls per month across all secrets. Using $0.40 per secret and $0.05 per 10,000 calls, what is the monthly cost, and what one change would cut it most without losing rotation?
Show answer
Billed secrets are 40 × 2 = 80, so storage is 80 × $0.40 = $32.00. API calls are 5,000,000 ÷ 10,000 × $0.05 = $25.00. The total is $57.00 per month, before KMS. The largest single reduction is caching secrets in process, which can cut the $25 call charge to a few dollars. Grouping credentials only helps if they can share one rotation schedule and one access policy, so caching is the safer change.
Exercise
An application loads 300 parameters from /myapp/prod with GetParametersByPath at startup. During a deployment of 100 tasks at once, the logs show ThrottlingException. Name two causes and two fixes.
Show answer
Each task needs at least 30 paginated calls because a page holds at most 10 parameters, so 100 tasks make about 3,000 calls at nearly the same moment. If the values are SecureString, the decrypts also count against the shared KMS quota. Fixes: use adaptive retries with backoff and stagger task startup, or cache and reduce reads, for example by combining rarely changed values into fewer parameters. Enabling higher throughput or requesting a quota increase is the last step.