This tutorial covers setting up an ECS-integrated Elastigroup using Elastigroup’s Managed Containers Service (MCS). You can also import an existing ECS cluster – this action will fetch all the data needed in order to create a new ECS cluster on Elastigroup based on the configuration of the imported ECS cluster.

Prerequisites: Create an ECS IAM Role
  1. Before the Amazon ECS agent can register container instance into a cluster, the agent must have IAM Role with appropriate account credentials.
  2. If you haven’t done this already, here’s how to create an ECS IAM Role.
    1. Navigate to your IAM console
    2. Go to – Roles.
    3. Create a new Role and name it “ECS-ContainerInstance”
    4. Under “AWS Service Roles” choose: “Amazon EC2 Role for EC2 Container Service”
    5. Attach the policy and create the Role.
    6. On the Elastigroup setup, you should specify the newly created IAM Role under “Launch Specification”
Step 1: Select Your ECS Optimized AMI
  1. Enter the Elastigroup Creation Wizard and select ECS.
  2. Amazon ECS provides ECS Optimized AMIs which contain an Amazon ECS agent that automatically registers new instances to your desired ECS cluster. In the Compute tab under Launch Specifications enter the ID of your preferred ECS Optimized AMI.
Step 2: Set IP configuration for your Elastigroup instances

In order to register to your ECS cluster each instance in your Elastigroup needs to be associated with a public ip.

  1. Under the Compute tab go to Additional Configurations.
  2. Under Public IP choose one of the following:
  • Associate public IP
  • Subnet default
Step 3: Configure the new ECS cluster

By default, your container instances will launch into your default cluster. If you want to launch into a different cluster, use the following script for the User Data field in the Additional Configurations section of the Compute tab, replacing CLUSTER_NAME with the name of your desired cluster.



echo ECS_CLUSTER=CLUSTER_NAME >> /etc/ecs/ecs.config




Import-Module ECSTools

Initialize-ECSAgent -Cluster CLUSTER_NAME -EnableTaskIAMRole -LoggingDrivers '["json-file","awslogs"]'



Step 4: Set the ECS integration
  • In the Compute tab, under the Integrations section, select ECS and provide your Cluster Name.
  • Continue with the Creation Wizard and create your Elastigroup.


What’s Next
  • Now that you have created an ECS-integrated Elastigroup, utilize the ECS Auto-Scaler to efficiently and automatically scale your cluster.