3

I'm trying to create an AWS auto-scaling group, and I want my instances to have a tag with Key=Name and Value=processor%i, where the "%i" is dynamically replaced with a 1, 2, 3, etc as the instances are added.

Is this possible? I can't find any documentation suggesting how to do this.

Cerin
  • 3,600
  • 19
  • 61
  • 79
  • I've never heard of this being a feature, or something anyone needed. I guess you'll have to write a lambda to do it, based on some unique information you can discover about instances. Depending on exactly what you're trying to find out (you haven't said what your aim is) you might be able to get some information from either CloudWatch or CloudTrail. – Tim Apr 22 '19 at 18:25
  • @Cerin how did you solve this ? – Damiox Jan 18 '20 at 18:47

1 Answers1

0

This isn't possible to have AWS do automatically and is pretty tricky to do reliably when coding a system yourself. You can either have a lifecyle hook trigger a lambda function, or have a userdata script run on boot to tag the instance.

There are two problems: 1) You need to keep track of the current counter somewhere 2) If multiple instances are starting at the same time, there may be a race condition where both try and get tagged the same

Shahad
  • 326
  • 1
  • 6