Sunday, June 11, 2017

Container definition and Workflow for ECS

Your containers will run on your EC2 instances.
 It only works on VPC

Container instance
A “container instance” can be any EC2 instance, running any distro (Amazon Linux, Ubuntu, CoreOS…)
It just needs two extra software components:
  • the Docker daemon,
  • the AWS ECS agent.

Cluster

That’s a pool of resources (i.e. of container instances).
A cluster starts being empty, and you can dynamically scale it up and down by adding and removing instances.
You can have mixed types of instances in here.
It’s a regional object, that can span multiple AZs.
Task definition:

Task definition

It’s an app definition in JSON. The format is conceptually similar to Fig, but not exactly quite like it.
I don’t know why they didn’t pick something more like Fig, or more like the Docker Compose project. It might be because almost everything else on AWS is in JSON, and they wanted to stick to that.

Task

A task is an instanciation of a task definition. In other words, that will be a group of related, running containers.
The workflow looks like this:
  1. Build image using Dockerfile/ECR.
  2. Push image to registry.(ECR- EC2 container registry)
  3. Create JSON file describing your task definition.
  4. Register this task definition with ECS.
  5. Make sure that your cluster has enough resources.
  6. Start a new task from the task definition.
      Use the CLI command start-task. You must then specify the cluster to use, the task definition, and the exact container instance on which to start it. It’s a bit like doing manual scheduling.
      Use the CLI command run-task. You must then specify the cluster, task definition, and an instance count. It will run ECS default resource scheduler (which is a random scheduler).
      Bring your own scheduler!


References:

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-install.html

Steps for ECS:
(https://jpetazzo.github.io/2015/01/14/amazon-docker-ecs-ec2-container-service/)

No comments:

Post a Comment