This page gives no prices. AWS prices differ by region (ap-south-2 is not always the same as ap-south-1) and change over time. Use the AWS Pricing Calculator with the values on this page, and let KIMS's cloud team confirm the figures against their own discounts.
#Who does what
| Task | Usually done by | What our engineer needs |
|---|---|---|
| Budget, cost alerts, cost allocation tags | KIMS's cloud team | Nothing, but tag resources the way they ask |
| Raising a service quota | KIMS's cloud team (account owner) | Tell them which quota and the number, from the tables below |
| Checking the limits below before go-live | Our engineer | Read access in the account |
#What drives the cost
| Item | What KIMS v2 uses | What makes it grow | Where it is set |
|---|---|---|---|
| RDS PostgreSQL | One instance per environment: db.m6g.large production, db.t4g.medium UAT, gp3 50 GB with storage autoscaling, 14 days of backups |
Multi-AZ (roughly doubles the instance cost), a larger class, storage growth, backups kept beyond the free amount (equal to the database's size), snapshots kept by hand | RDS PostgreSQL |
| EKS | KIMS's existing cluster; KIMS v2 adds a few pods (CMS, worker, cron jobs, the migrate Job) | Usually nothing new for the control plane. Node capacity if the pods' requests need more nodes | EKS |
| NAT gateway | Pods and the Jenkins agent reach S3, STS, Google, ECR and npm through it if the subnets are private | Data through NAT is charged per GB. Image pulls and S3 traffic are the big ones. The S3 gateway endpoint takes S3 traffic off NAT at no charge | Networking |
| Application Load Balancer | One ALB for the CMS ingress (or a shared ALB through an ingress group, if KIMS uses one) | Hourly charge plus load balancer capacity units; the CMS has few users, so traffic is small | EKS |
| CloudFront | One distribution per environment | Data out to visitors and requests; the price class (the one chosen excludes South America and Oceania edges); WAF if enabled | CloudFront |
| CloudFront invalidations | About 14 wildcard paths per site build (three languages) | The first 1,000 paths each month are free across the account, then a charge per path. A wildcard counts as one path. About 70 site builds a month stay inside the free amount | CloudFront |
| CloudFront Functions | One viewer-request function, runs on every request | Charged per invocation | |
| CloudFront KeyValueStore (later) | One store for redirects | Charged per read by the function, and per API call by the site build | |
| S3 | Assets bucket (versioned) and website bucket (versioned) | Storage of originals, derived images and old versions; the expire-old-versions lifecycle rule keeps the old versions from growing for ever; requests |
S3 buckets |
| ECR | One repository kims/kims-v2 |
Storage of images; the lifecycle policy keeps the newest 50 tagged images | ECR |
| ACM | Two public certificates | Public certificates used with CloudFront and ALB carry no charge, unless exportable certificates are chosen | Certificates |
| CloudWatch Logs | Container logs, if the cluster ships them; CloudFront logs if turned on | Log ingestion and retention | KIMS's cluster set-up |
Ask KIMS's cloud team whether they want cost allocation tags on every KIMS v2 resource (for example project=kims-v2, environment=production). Adding tags at creation is far easier than finding the resources later.
#Limits that can stop the deployment
#CloudFront
| Limit | Value | Where KIMS v2 meets it |
|---|---|---|
| Function code size | 10 KB | viewer-request-redirects.js is far below it |
| Function memory | 2 MB | |
| Functions per account | 100 | One or two functions |
| KeyValueStores per function | 1 | One store, for redirects |
| KeyValueStore key size | 512 bytes | The old path |
| KeyValueStore value size | 1 KB | {"to": "...", "status": 301} |
| KeyValueStore total size | 5 MB | Thousands of redirects fit |
| KeyValueStore update call | 50 keys or 3 MB | The site build sends batches of 50 |
| Origin access controls per account | 100 | One per environment |
| Alternate domain names per distribution | 100 | One or two |
| Invalidation paths in progress | 3,000 at a time, 15 wildcard paths in progress at a time | About 14 wildcards per build, so two builds close together can hit the wildcard limit; the build retries three times and then records a warning, never a failure |
#Other services
| Service | Limit | Note |
|---|---|---|
RDS max_connections |
Set by the instance's memory (a formula in the default parameter group) | The CMS, the worker and the cron jobs each hold a connection pool. A small class with many pods can run out. Check with SHOW max_connections; in the psql check and compare with the pods' pool sizes |
| RDS instances per account | Default quota 40 | |
| ACM certificates | Default quota 2,500 per region | |
| ECR repositories | Default quota 100,000 per region | |
| S3 buckets | Default quota 10,000 per account | |
| EKS access entries | Default quota per cluster | One for the agent role |
| IAM inline policy size | 10,240 characters per role (all inline policies together) | The policies on IAM are well inside it |
| ELB ALBs per region, target groups | Default quotas | Only matters if KIMS's account is already close |
#Check a quota
The Service Quotas console shows the account's current value. Service Quotas > AWS services > the service (for example Amazon CloudFront) > search the quota name. The Applied account-level quota value column is what counts.
The same with the CLI (CloudFront quotas live in us-east-1):
aws service-quotas list-service-quotas --service-code cloudfront --region us-east-1 \
--query "Quotas[?contains(QuotaName, 'invalidation') || contains(QuotaName, 'KeyValueStore') || contains(QuotaName, 'origin access control')].[QuotaName,Value]" --output table
aws service-quotas list-service-quotas --service-code rds --region ap-south-2 \
--query "Quotas[?contains(QuotaName, 'DB instances')].[QuotaName,Value]" --output tableaws service-quotas list-service-quotas --service-code cloudfront --region us-east-1 \
--query "Quotas[?contains(QuotaName, 'invalidation') || contains(QuotaName, 'KeyValueStore') || contains(QuotaName, 'origin access control')].[QuotaName,Value]" --output table
aws service-quotas list-service-quotas --service-code rds --region ap-south-2 \
--query "Quotas[?contains(QuotaName, 'DB instances')].[QuotaName,Value]" --output tableaws service-quotas list-service-quotas --service-code cloudfront --region us-east-1 `
--query "Quotas[?contains(QuotaName, 'invalidation') || contains(QuotaName, 'KeyValueStore') || contains(QuotaName, 'origin access control')].[QuotaName,Value]" --output table
aws service-quotas list-service-quotas --service-code rds --region ap-south-2 `
--query "Quotas[?contains(QuotaName, 'DB instances')].[QuotaName,Value]" --output tableYou should see a table of quota names with their values. An empty table means the quota names differ from the filter: drop the --query and read the full list. Some fixed limits (function size, KeyValueStore sizes) are not adjustable and may not be listed; the CloudFront quotas page in Sources has them.
#Check the invalidation count this month
aws cloudfront list-invalidations --distribution-id <DISTRIBUTION_ID> \
--query "InvalidationList.Items[?CreateTime>='$(date -u +%Y-%m-01)'] | length(@)"aws cloudfront list-invalidations --distribution-id <DISTRIBUTION_ID> \
--query "InvalidationList.Items[?CreateTime>='$(date -u +%Y-%m-01)'] | length(@)"$MonthStart = (Get-Date).ToUniversalTime().ToString("yyyy-MM-01")
aws cloudfront list-invalidations --distribution-id <DISTRIBUTION_ID> `
--query "InvalidationList.Items[?CreateTime>='$MonthStart'] | length(@)"It prints the number of invalidations this month for that distribution. Multiply by about 14 for paths; add the other environment's distribution, since the free 1,000 paths are for the whole account.
#If it goes wrong
| What you see | Likely cause | What to do |
|---|---|---|
Site build warning create-invalidation attempt 3 failed with TooManyInvalidationsInProgress |
Two builds close together hit the wildcard-in-progress limit | Wait for the earlier invalidation to finish, then run the invalidation by hand (CloudFront) |
CMS or worker logs sorry, too many clients already |
RDS max_connections reached |
Fewer replicas, smaller pools, or a larger instance class; ask KIMS before resizing production |
LimitExceeded creating an OAC, function or store |
Account quota reached | KIMS's cloud team requests an increase in Service Quotas |
| The NAT line of the bill is large | S3 or ECR traffic through NAT | Add the S3 gateway endpoint; check the nodes pull images from ECR in the same region |
| The S3 storage line keeps growing | Old versions kept | Check the expire-old-versions lifecycle rule on both buckets (S3 buckets) |
#Sources
kims-v2/docs/ON-SITE-DEPLOYMENT.mdonmain(AWS set-up C and D)kims-v2/scripts/deploy/cache-rules.mjs,kims-v2/scripts/site-build/cloudfront.mjsonmain- https://calculator.aws/
- https://aws.amazon.com/cloudfront/pricing/
- https://aws.amazon.com/rds/postgresql/pricing/
- https://aws.amazon.com/vpc/pricing/
- https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
- https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PayingForInvalidation.html
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Limits.html
- https://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html
- https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html