Bird
0
0

You want to tag an EC2 instance i-1234567890abcdef0 with Environment=Test in one AWS CLI command. Which command is correct?

hard📝 Application Q9 of 15
AWS - CLI
You want to tag an EC2 instance i-1234567890abcdef0 with Environment=Test in one AWS CLI command. Which command is correct?
Aaws ec2 create-tags --resources i-1234567890abcdef0 --tags Key=Environment,Value=Test
Baws ec2 create-tags --resources i-1234567890abcdef0 --tag-specifications 'ResourceType=instance,Tags=[{Key=Environment,Value=Test}]'
Caws ec2 create-tags --resources i-1234567890abcdef0 --add-tags Environment=Test
Daws ec2 create-tags --resources i-1234567890abcdef0 --tag Environment=Test
Step-by-Step Solution
Solution:
  1. Step 1: Understand tagging syntax for existing EC2 instances

    Tags are added to existing instances using the 'create-tags' command with '--tags Key=Value'.
  2. Step 2: Identify correct syntax for tagging

    aws ec2 create-tags --resources i-1234567890abcdef0 --tags Key=Environment,Value=Test uses the correct '--tags' format. Other options use invalid or unsupported flags.
  3. Final Answer:

    aws ec2 create-tags --resources i-1234567890abcdef0 --tags Key=Environment,Value=Test -> Option A
  4. Quick Check:

    Tag existing EC2 = create-tags --tags Key=Value [OK]
Quick Trick: Tag EC2 with create-tags --tags Key=Value [OK]
Common Mistakes:
  • Using --tag-specifications which is for run-instances
  • Using --add-tags or --tag which are invalid
  • Incorrect tag syntax without Key=Value structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes