vinod827
vinod827

Reputation: 1544

How to pass scripts during AWS ECS clusters provisioning?

I'm learning AWS ECS and able to run the task/containers using the ECS instances. But the problem is there are certain scripts that I was executing to the underlying EC2 instances (provisioned through ECS instances) manually after doing SSH (port 22) to them. Is there any better way which would automate this process of running the following scripts whenever the ECS cluster setup is done or whenever the autoscaling kicks-in:-

sudo sysctl -w vm.max_map_count=262144

Upvotes: 0

Views: 464

Answers (1)

Marcin
Marcin

Reputation: 238339

In your launch template (LT) or launch configuration (LC) for the autoscaling group of container instances, you can specify user_data. This is place where you can add your bootstrap code for the instances.

You are already probably using the user_data, as your instances need to be provided with ecs cluster name to which they belong. So you can create new LT/LC with the sysctl command to execute when the instances are launched by your autoscaling group.

Upvotes: 2

Related Questions