Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can add a tag to AWS VPC

Tags:

aws-cli

I am trying to add the tags to my existing VPC. I am trying to solve this problem using AWS cli for multiple VPC's. But could not find the appropriate command to add the tag using AWSCLI. Can someone please help. TIA.

like image 504
Sunil Poonia Avatar asked Sep 16 '25 04:09

Sunil Poonia


1 Answers

You can add tags to the existing resources using create-tags

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources. When you specify an existing tag key, the value is overwritten with the new value.

https://docs.aws.amazon.com/cli/latest/reference/ec2/create-tags.html

aws ec2 create-tags --resources vpc-1234567 --tags Key=Stack,Value=production 

Or multiple tags

aws ec2 create-tags \
    --resources vpc-1234567 i-1234567890abcdef0 \
    --tags Key=webserver,Value=   Key=stack,Value=Production

Make sure your default region is correct for VPC or add region to the cli command.

like image 180
Adiii Avatar answered Sep 17 '25 18:09

Adiii