0
votes

Is it possible to launch containers using ECS on existing set of running EC2 instances. I could not find any such documentation for the same. On AWS Console, I see an option to either create clusters which provisions new EC2 instances in ECS cluster or to use Fargate. After creating a task, when I attempt to launch the task, it only provides options of clusters which were created through ECS console.

I have already have a few running EC2 instances in my account. Is it possible to use them? Can I have say a tomcat webserver running on ec2 instance and use the same instance to launch an ECS task (assuming the instance is powerful enough)?

1

1 Answers

1
votes

When you launch an ECS Cluster, it asks you for AMI ID and that AMI ID is not the normal AMI which we use to create EC2, it is ECS optimized AMI. The Amazon ECS-optimized AMI comes prepackaged with the ECS container agent, Docker agent, and the ecs-init upstart service.

These EC2 instances which get created with ECS, automatically register itself to the cluster so you need not do any manual activity.

So I believe if you want to use your own EC2 instances then try installing docker agent, ECS agent and update the file (/etc/ecs/ecs.config) which contains the cluster info. It seems a lot of manual work and I'm not sure whether it will work or not as I haven't done it myself but you can give it a try.

Otherwise, just use ECS and everything is taken care.