Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we use custom AMI for the creation of ECS cluster?

I have created a custom AMI that has certain softwares and scripts preloaded in it.

  • Can I use this AMI for the ECS Cluster?
  • I do not see any option to add AMI while creating a cluster
like image 230
Roshan Chhetri Avatar asked Feb 22 '18 04:02

Roshan Chhetri


2 Answers

Yes, you can. You need to ensure that the EC2 instances are running the ECS Agent.

To attach EC2 instances (using any AMI) to an ECS cluster, we just need to pass the corresponding cluster name to ECS_CLUSTER variable.

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

like image 123
Sai Prasad Avatar answered Oct 12 '22 11:10

Sai Prasad


For your instance to be available on the cluster, you will have to create the default cluster.

if you have a custom ecs cluster, you can set the cluster name using the userdata section.

The ecs agent expects the cluster name inside the ecs.config file available at /etc/ecs/ecs.config.

You can set it up at instance boot up using userdata script

#!/bin/bash
echo ECS_CLUSTER={cluster_name} >> /etc/ecs/ecs.config

That instance shuld IAM role ecsinstance

like image 2
Ashok Reddy Avatar answered Oct 12 '22 13:10

Ashok Reddy