Closed willroberts closed 2 months ago
For staging, EC2 Spot instance are a suitable replacement for RDS and ElastiCache.
AWS API Gateway may be a suitable ALB replacement for both staging and production, with costs under $2/mo. API Gateway can route traffic to ECS workloads via Cloud Map: https://aws.amazon.com/cloud-map/
More thoughts on this:
t4g.micro
instance), but we'd benefit from the added instance anyway for things like graceful deployments.Postgres via RDS advantages:
Postgres via ECS advantages:
Once a long-term plan for Postgres is in place, we can declare a "stable" environment with no data loss, e.g. promoting staging.duelyst.org to play.duelyst.org for a more general launch.
We moved from ElastiCache to Redis on ECS in #225.
AWS docs for ECS persistence: https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/storage-dockervolumes.html
Example using the rexray/ebs
Docker plugin in ECS services: https://aws.amazon.com/blogs/compute/amazon-ecs-and-docker-volume-drivers-amazon-ebs/
The ECS + EBS stuff is outdated and generally does not work. For example, the rexray/ebs
plugin hasn't been updated since 2019, and it fails on EC2 instances as a result of a change to the instance metadata API (see multiple open issues regarding rexray.sock
connection failures). Going to stick with RDS instead.
Postgres can also run on regular EC2 without ECS:
t4g.micro
is $6.13/mot4g.micro
is $1.84/moAn on-demand DB with one backup would cost $8.73/mo. A spot DB with one backup would cost $4.44/mo.
We could start with Spot, and increase to on-demand if needed? Might need some stop+start automation when Spot instances are reclaimed.
Summary
The AWS Free Tier for ALB, RDS, and ElastiCache is limited to 12 months. After this time, they cost the following amounts:
ElastiCache: $11.68/mo (cache.t4g.micro, on-demand)migrated to ECS for $0.90/moWe can find cheaper alternatives for the staging environment.
Note: Our usage of ECS, EC2, S3, CloudFront, KMS, and SSM Parameter Store are not subject to Free Tier expiration. They're either always free, or cost mitigation work has already been done. These will continue to total $6/mo.