2

So I'm busy at the moment trying to properly deploy my first dockerised application. It ran perfectly locally and yesterday with some help from someone here I was able to get it to run in the background on a nano instance on Amazon EC2, then log out of the instance and observe for at least a while that it was running perfectly, till I logged back in and stopped it.

I suspect however that it's a bit of a hack, he wrote:

Note that if the application process inside your container crashes the container will still stop. This is one reason for using an orchestrator such as AWS ECS to define a service that will attempt to always run a certain number of your tasks. ECS also helps with getting the docker container onto the instance and starting it for you in the background automatically.

So I've been furiously going through these tutorials for the ECS CLI installing stuff on the nano instance. As I read at what someone here wrote about the difference between EC2 and ECS am starting to suspect that 2 is the minimum number of instances to deploy properly.

Is this true? One to run the application and another to watch it running it?

If so I'll rent a second nano instance and try to put this ECS on it to watch the first one. Do I need a docker-compose.yml or what is the simplest way to accomplish this?

cardamom
  • 6,873
  • 11
  • 48
  • 102

1 Answers1

3

No, ECS is an AWS service that controls your containers on EC2 instances. It runs as an agent in a container on your existing EC2 instance, no extra instance required. The ECS service on AWS then contacts the agent container.

NHol
  • 2,045
  • 14
  • 28
  • Thanks, will be cheaper. After all my installing the other day I do notice when I type `docker images` into my instance, not only my app is listed but also `amazon/amazon-ecs-agent` `docker ps` also says `amazon/amazon-ecs-agent:latest` has been Up for 2 minutes and was created 3 minutes ago.. – cardamom Jun 07 '17 at 11:08