Some of the services that AWS provides could help us drastically reduce the time needed for application configuration, maintenance and deployment.
Most of our existing and upcoming applications:
- Use a frontend static website written in Angular/TypeScript and a dockerized backend written in Django/Python
- Are not optimized for serverless computing
- Make use of a PostgreSQL database
- Route 53 - Domain Name System (DNS)
- CloudFront - Content Delivery Network (CDN)
- Simple Storage Service (S3) - File storage service
- Elastic Compute Cloud (EC2) - Virtual machine service
- Elastic Load Balancing (ELB) - Load balancing service
- Elastic Container Registry (ECR) - Container storage service
- Relational Database Service (RDS) - Managed relational database service
- Elastic Container Service (ECS) - Container orchestration service
- Secrets Manager - Credential manager
See attached image
Route 53 will resolve the IPs of Load Balancer and static websites provided by CloudFront
CloudFront will serve the static websites stored in S3 buckets.
Statics websites will be stored in S3 buckets, each site in each own separate bucket.
Deployment will be done through GitHub Actions
The Load Balancer will be the access gateway to the EC2 virtual machines and the dockerized backends stored in them.
It will be managed by ECS, so no manual configuration is needed for networking, ports etc.
We will create an ECS cluster to hold all the backends.
For reduced cost, the cluster can be comprised of only one EC2 instance, same as before.
The docker images can be uploaded and stored to ECR to be easily used by ECS. This will be done through GitHub Actions.
It's not really a good idea to maintain a Postgres database by ourselves in a docker container. Making bakups is hard, error-prone and data loss might be disastrous. A managed RDS instance with automated backups and updates is the best way to go. All the instances can connect to it and have their own database there.
The Elastic Container Service is has 3 parts:
- Cluster: A collection of virtual machines where containers can be run
- Tasks: Definition of containers that need to run.
- Service: Actually running and maintaining a task definition
ECS can also create a Load Balancer that links all the containers created by the running services.
Basically every Traefik configuration, docker network management, Docker compose manual ups and downs can be managed through a few clicks in the user interface.
All the credentials will be stored in the Secrets Manager and the applications will have access to them through docker environment variables.
Easier maintenance and configuration comes at a price. It should be worth it though.
- An RDS managed instance can be reserved for 3 years and paid upfront, which will drastically reduce the cost.
- For EC2 instances you pay based on the time it's running.
- For the Load Balancer we pay a bit for keeping it running and also for how much traffic we get.
- Secrets manager is very cheap and can be replaced with Parameter Store which is free.
- ECS is free, only paying for the resources we create.
There are the rest of the costs that we already have, like CloudFront, Route 53, ECR where we pay for how much we store and same for S3.
Monthly estimates can be calculated using the AWS Pricing Calculator