I use an open-source server application running on Docker Compose. It has a few services, including PostgreSQL DB and Redis.
How can I best deploy this application to AWS in full IaC with Terraform?
ecs-cli
ecs-cli
now supports sending docker compose
configs in Amazon ECS.
However, I do not think it could be integrated with the Terraform workflow (which is maybe not a big fuss). What I know for sure is that ecs-cli
is not supported in CloudFormation, as per this issue, still open at this time. So I assume it cannot easily be added to Terraform either.
docker-compose.yml
file, translate it to kubectl
YAML.But that is not fully IaC yet. And you have to retranslate your config each time the docker-compose changes in the source repository. And it sounds like a lot of work.
helm
provider to install the application with Helm on the cluster.I read Kompose can automagically translate a Docker Compose configuration to a k8s configuration, but they don't appear to be ported on AWS, not to talk about Terraform.
docker-compose.yml
. And the Docker images.systemctl
service.That would kind of hurt: long builds, difficult monitoring, no scaling.
master
tells you what is deployed.The Docker Compose CLI enables developers to use native Docker commands to run applications in Amazon Elastic Container Service (ECS) when building cloud-native applications.
Who knows, ecs-cli-v2
might be better integrated with CloudFormation and/or Terraform.
As mentioned in the question. Probably the best solution, albeit requiring a (little) effort to parametrize Helm.
See also: Getting started with Helm.
Docker Swarm now accepts inputs from a docker-compose.yml
file. The template can be found and configured here. Once configured, it may be integrated to a Terraform infrastructure.
This (3-year old) tutorial explains how to use Docker Swarm mode on AWS.
To launch the container, if necessary (not fully investigated, feedback is welcome), you could use Terraform's local-exec
. This way you can SSH into the master node and run docker stack deploy
and other similar commands, while still having all written down in IaC style.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With