2

We're running an Elastic Beanstalk Multi-container Docker environment on Amazon Linux 1, which has been deprecated and needs to be migrated to Amazon Linux 2.

The documentation presents two options for doing so:

As far as I understand, they recommend the first option, because the ECS platform it is more similar to the current platform on AL1.

I'm wondering, however, what the practical differences between those two options are. What even is the role of ECS in this, what advantages does it have over pure Docker?

On ECS, we deploy with a Dockerrun.aws.json, which we generate from a docker-compose.yml with container-transform. This works, but it would be nice if we could skip that transformation. With the second option, without ECS, would it be possible to deploy a docker-compose.yml file directly?

We use a single instance, without a load-balancer (but want to keep the option open for the future).

Has anyone done this migration, with either option, and can provide some insights about the process?


I asked this question last year, and it didn't get any answers or upvotes, so it was deleted by the community bot. I'm posting it again, because I have to do the migration now, and I was advised to do so.

In the meantime, Amazon Linux 2023 has been released, but the question remains basically the same (Docker platform or ECS platform?).

1 Answers1

0

I'm in the process of doing the migration now, and can share what I have learned so far.

With the release of Amazon Linux 2023, they have also updated the documentation. I have found the following to be most relevant to make a decision:

The Docker platform branches

The Elastic Beanstalk Docker platform supports the following platform branches: Docker running Amazon Linux 2 and Docker running AL2023

Elastic Beanstalk deploys Docker container(s) and source code to EC2 instances and manages them. These platform branches offer multi-container support. You can use the Docker Compose tool to simplify your application configuration, testing, and deployment. For more information about this platform branch, see Using the Docker platform branch.

ECS running on Amazon Linux 2 and ECS running on AL2023

We provide this branch for customers who need a migration path to AL2023/AL2 from the retired platform branch Multi-container Docker running on (Amazon Linux AMI). The latest platform branches support all of the features from the retired platform branch. No changes to the source code are required. For more information, see Migrating Multi-container Docker running on Amazon Linux to ECS on Amazon Linux 2023. If you don't have an Elastic Beanstalk environment running on an ECS based platform branch, we recommend you use the platform branch, Docker Running on 64bit AL2023. This offers a simpler approach and requires less resources.

This platform branch uses Amazon ECS to coordinate a deployment of multiple Docker containers to an Amazon ECS cluster in an Elastic Beanstalk environment. The ECS cluster contains EC2 instances that host Docker containers. To accomplish this deployment orchestration, Elastic Beanstalk creates an ECS Task definition which also includes a Container definition. The instances in the environment each run the same set of containers, which are defined in a Dockerrun.aws.jsonv2 file. For more information, see Using the Amazon ECS platform branch.

Source

Emphasis mine. To summarize: The ECS platform offers an easier migration, but the Docker platform is simpler and uses less resources.

Since we have to update the configuration anyway, it seems like a good idea to migrate to the Docker platform even when that is more work, because I prefer to use a "simpler approach" that "uses less resources". It is also more familiar to work with docker-compose directly than with ECS tasks.

Before, we used to transform a docker-compose file to a Dockerrun.aws.json with container-transform. On the Docker platform, this step isn't needed anymore, and we can instead deploy the docker compose directly.

I had to add the following options to the docker-compose.yml file, for each container:

  • mem_limit
  • env_file: .env
  • restart: no for containers that were essential: false in the Dockerrun.aws.json

No other changes were necessary in the deployment artifact. We now bundle the docker-compose.yml together with the .ebextensions, like we did before with the Dockerrun.aws.json.