introduction
The way we build, ship and run applications has been revolutionized by Containers. They are a lightweight, portable, consistent environment for your code; they help move workloads between development, testing and production (how do you use containers in the cloud), but how is container running on top of popular managed services such as AWS ECS (Fargate) and Google Cloud Run?
what are containers?
This means that your app runs the same everywhere, from your laptop to the cloud; popular container runtimes include Docker and containerd.
Benefits:
- Portability across environments
- Fast startup and scaling
- Isolation and security
- Efficient resource usage
running containers on aws ecs (fargate)
what is ecs?
A fully managed container orchestration service is Amazon Elastic Container Service (ECS) which allows you to run Docker containers on a cluster of EC2 instances or on AWS Fargate, based on the serverless compute engine for containers.
why fargate?
A Fargate provides you with containers without managing servers. You define your container specs and AWS is provisioning, scaling & patching infrastructure; Aws manages provisional, and patches of the infrastructure (e.g.
Key Features:
- No server management
- Per-second billing
- Integrated with AWS networking and IAM
- Supports autoscaling
example: deploying a container on ecs fargate with terraform
A simplified example of Terraform is below to deploy a containerized app on ECS Fargate using an easy-to-use model for deployment in the framework, called The Below.
| |
Note: You need to set up VPC, subnets, and security groups separately. This example assumes you have a public subnet available.
running containers on google cloud run
what is cloud run?
It is a fully managed compute platform that scales your stateless containers automatically, called Google Cloud Run, which only charges for the resources you use and doesn’t need to manage servers or clusters.
Key Features:
- Serverless: No infrastructure management
- Autoscaling to zero
- HTTP(s) endpoints out of the box
- Integrated with Google IAM and VPC
example: deploying a container on cloud run with terraform
For instance, an example of a Terraform (Terror) model to deploy s container to Cloud Run is below.
| |
Note: This example makes the service public. For private services, use IAM to restrict access.
conclusion
Both AWS ECS (Fargate) and Google Cloud Run make it easy to run containers in the cloud without managing servers; Ec Fargate is a great platform for complex workloads that need deep Aw services and event-driven apps, while Cloud runs well with Cloudrun which has been recommended for stateless web services or event driven apps. With Terraform you can automate and version-control your infrastructure for both platforms using Amazon’s service provider Trafford on top of an array of stacking systems like CCP via its Web Services as well as Tvr