DEV Community

Cover image for New ECS Instance registration with ECS cluster Using CMD and Console
vaibhavi_shah for AWS Community ASEAN

Posted on

New ECS Instance registration with ECS cluster Using CMD and Console

Amazon ECS makes it easy to deploy, manage, and scale Docker containers running applications, services, and batch processes. Amazon ECS places containers across your cluster based on your resource needs and is integrated with familiar features like Elastic Load Balancing, EC2 security groups, EBS volumes and IAM roles

Step-1: Go to the ecs service and click on the cluster.

Createe cluster

Step-2: select the create cluster option and select Ec2 linux + networking

Select clster type

Step-3: configure the details as below

Configure the cluster

Step-4: Cluster is createed as below.

Cluster is created succesfully

Step-5: Go to the view cluster.

Cluster is created

Step-6: Go to the ECS-Instances

As per the ECS configuration, Auto scalling group is created and one ECS instance is launched from Autoscalling group.

ECS-instance created

Step-7: Move to the Launch configuration of autoscalling group.

ECS launch configuaration

Step-8: Under the details tab view the userdata script.

Userdata script

Variable ECS_CLUSTER attach the ecs-instance to the define cluster.

Step-9: ssh into the created instance

SSH using private key

Step-10: View ecs.config file for the configuration. Path for file is /etc/ecs/ecs.config

ecs.config

It is very useful when we work with multi cluster environment.

These is done by docker agent.

For verify these follow the below steps.

Step-11: Run the Docker ps command which gives the whole information.

docker ps

Registration details can be also find from docker log as below.

Step-12: Docker Log

Command for docker log

docker logs container-id

Docker log

Top comments (2)

Collapse
 
raphael_jambalos profile image
Raphael Jambalos

Hi Havi! Interesting experiment on ECS! I actually used to do this all the time back on my previous employer. I go on to do the command docker exec -it /bin/bash so I can enter the bash shell of my containers. I did this so I can gain console access to the task so I can run rails console on them and do my data requests.

Collapse
 
brianreinhold profile image
brianreinhold

Fails at step 6. There are no ESC instances