Getting Started with Amazon ECS

STEP 1: Creating a Cluster

First step is creating a cluster. This can be done with CLI or Amazon Console. To do in CLI, run

create amazon ecs cluster

If you login to Amazon ECS console, you will see newly created cluster.

Amazon ECS cluster console

If you want to delete cluster, you can do with command line

STEP 2: Creating Task Definition

Task definition tell Amazon ECS what docker image to run. It is like a blue print of task, not actual task. Once as Task Definition is created, you create Task based on it.

Create a file “task-def.json” with following content.

Now run

You will see something like

Amazon ECS register task definition

You will see newly created Task Definition under Amazon AWS Console > ECS > Task Definitions.

Updating Task Definition

To change Task Definition, edit the JSON file. Run exactly same command used to register the task definition, it will update the Task Definition.

In our Task Definition, we used password for MySQL “password”, let change it to secure password, run the command again to update Task Definition.