How to change new instance tag Name when auto scaling?

0 votes

I've created a new Alarm on my AWS account based on a Metric that I also have created. I use this alarm to auto scale. When launching new instances I'm using User Data field to set up this new instance. The problem I'm facing is that I cannot modify the tags of this new instance. If I don't change that, all the new instances will have the same name which won't work with my current setup.

Is it possible to solve that?

Oct 29, 2018 in AWS by datageek
• 3,040 points
57 views

1 answer to this question.

0 votes

You can set up a new Name tag for the instance in its own user data script using AWS CLI tools and the instance metadata. It would look like this:

aws ec2 create-tags \ --resources $(curl -s http://169.254.169.254/latest/meta-data/instance-id) \ --tag Key=Name,Value=MyNewNiceName \ --region=us-east-1

answered Oct 29, 2018 by Archana
• 5,560 points

Related Questions In AWS

0 votes
1 answer

How to auto-scale MYSQL database in AWS EC2 instance?

You could always use the Amazon RDS ...READ MORE

answered Aug 24, 2018 in AWS by Archana
• 4,090 points
525 views
0 votes
1 answer

How to create new stack using create-change-set in AWS Cloudformation

The type of change set operation. To ...READ MORE

answered Sep 18, 2018 in AWS by Priyaj
• 56,920 points
489 views
0 votes
1 answer

How to change the instance type in AWS?

Using the AWS Console. You can follow ...READ MORE

answered Mar 26 in AWS by Esha
26 views
0 votes
3 answers
0 votes
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link  https://aws.amazon.com/certificate-manager/faqs/ You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 56,920 points
89 views
0 votes
1 answer

How to set up a SPF(Sender Policy Framework) for AWS EC2 instance?

Setting up a SPF record is pretty ...READ MORE

answered Aug 16, 2018 in AWS by Archana
• 4,090 points
249 views
0 votes
1 answer

How to Use hypen as key name in dynamo db mapper

It seems you cannot have a column ...READ MORE

answered Aug 22, 2018 in AWS by Priyaj
• 56,920 points
173 views
0 votes
1 answer
0 votes
1 answer

How to allocate IP address in VPC to RDS instance?

The instance will already have an IP ...READ MORE

answered Oct 31, 2018 in AWS by Archana
• 5,560 points
283 views