Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add ECS attributes to an instance using terraform

I heavily use ECS Attributes on our containerized infrastructure. I couldn't find terraform docs to achieve this. Do I need to execute aws cli commands manually to apply those attributes after creating the infrastructure?

like image 287
sith Avatar asked Aug 31 '25 22:08

sith


1 Answers

I'd recommend having the ECS agent set the ECS attributes if you need these.

You can do this by adding ECS_INSTANCE_ATTRIBUTES to the /etc/ecs/ecs.config file or passing them as an environment variable directly to the ECS agent on startup.

If you have a "base" ECS AMI (either one you rolled your own or the Amazon Linux AMI) then you probably just want to use user data to dynamically set this from Terraform.

like image 171
ydaetskcoR Avatar answered Sep 03 '25 13:09

ydaetskcoR