I have created a custom AMI that has certain softwares and scripts preloaded in it.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With