A simplification to get ECS Services up and running, without having to think about the details.
This module helps you get up and running with an ECS Service. It sets up your service, and links it with VPCs, load balancers, monitoring, and more.
The examples folder is the home of example usages of this module. These are the examples you can find there.
- Simple
-
The minimum usage of this module.
- On Prem
-
Run your service directly in an on-prem datacenter using ECS Anywhere.
- Autoscaling
-
A simple service using autoscaling to handle increased load.
- Autoscaling with custom metrics
-
A service using autoscaling to handle increased load based on custom metrics.
These are the arguments that can not be expressed by the terraform module
These arguments are where you specify everything ECS needs to know about your container and how to run it.
Both use the same format, but application_container
will automatically be set as an essential container, while sidecar_container
will not be set as essential.
Name | Description | Required | Default |
---|---|---|---|
|
The name of the container, must be unique. |
yes |
n/a |
|
The image (and tag) of the container to run |
yes |
n/a |
|
A command to run on the container |
no |
null |
|
If the container is essential for the service |
no |
|
|
A map of environment variables |
no |
Empty map |
|
A map of secrets |
no |
Empty map |
|
A port to expose from the container. |
depends (required for |
null |
|
The application layer protocol for the exposed port. |
depends (required for |
null |
|
Container health checks. Not to be confused with LB health checks. |
no |
null |
|
The number of CPU units reserved for this container. |
no |
null |
|
The max amount of memory that the specific container can consume. |
no |
null |
|
A soft memory limit, that ECS will do best effort to follow when memory is lacking for the service. |
no |
null |
|
Configure any other options for container definitions |
no |
None (Though log_configuration is automatically configured for CloudWatch) |
|
A list of placement constraints for the service. Not valid for FARGATE launch_type. SEE: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html and https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#placement_constraints |
no |
[] |
These are health checks that will be executed by the loadbalancer.
The different platforms are quite similar, but some considerations have to be taken.
You must make sure that the following arguments are present:
-
lb_listeners
-
private_subnet_ids
-
vpc_id
Please keep the considerations from AWS in mind. Only use ECS Anywhere if it is really neccessary. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-anywhere.html#ecs-anywhere-considerations
Main things to note:
-
There is no VPC networking
-
No loadbalancers
A guide is available if you were previously using terraform-aws-ecs-fargate
or terraform-aws-ecs-anywhere
.
Go check out the documentation about moving from old modules!