Resource Groups Tagging API
Introduction
Section titled “Introduction”Resource Groups Tagging API helps you centrally manage tags across AWS resources. You can apply and remove tags for multiple resources at once, and query resources by tag keys and values.
LocalStack allows you to use the Resource Groups Tagging API in your local environment to test tagging workflows end-to-end. The supported APIs are available on our API Coverage section, which provides information on the extent of Resource Groups Tagging API’s integration with LocalStack.
Getting started
Section titled “Getting started”This guide is designed for users new to Resource Groups Tagging API and assumes basic knowledge of the AWS CLI and our awslocal wrapper script.
Start your LocalStack container using your preferred method. We will demonstrate how to create resources, tag them, and query them using the Resource Groups Tagging API.
Create resources to tag
Section titled “Create resources to tag”Create an S3 bucket and an SQS queue:
BUCKET_NAME="rg-tagging-bucket"QUEUE_NAME="rg-tagging-queue"
awslocal s3api create-bucket --bucket "$BUCKET_NAME"QUEUE_URL=$(awslocal sqs create-queue --queue-name "$QUEUE_NAME" | jq -r '.QueueUrl')Retrieve the resource ARNs:
BUCKET_ARN="arn:aws:s3:::$BUCKET_NAME"QUEUE_ARN=$(awslocal sqs get-queue-attributes \ --queue-url "$QUEUE_URL" \ --attribute-names QueueArn | jq -r '.Attributes.QueueArn')Tag multiple resources
Section titled “Tag multiple resources”Use the TagResources API to apply tags:
awslocal resourcegroupstaggingapi tag-resources \ --resource-arn-list "$BUCKET_ARN" "$QUEUE_ARN" \ --tags '{"Environment":"dev","Team":"platform"}'Query resources by tags
Section titled “Query resources by tags”Use the GetResources API to list resources with a specific tag:
awslocal resourcegroupstaggingapi get-resources \ --tag-filters Key=Environment,Values=devYou can also inspect available keys and values:
awslocal resourcegroupstaggingapi get-tag-keysawslocal resourcegroupstaggingapi get-tag-values --key EnvironmentRemove tags from resources
Section titled “Remove tags from resources”Use the UntagResources API to remove one or more tag keys:
awslocal resourcegroupstaggingapi untag-resources \ --resource-arn-list "$BUCKET_ARN" "$QUEUE_ARN" \ --tag-keys TeamSupported services
Section titled “Supported services”LocalStack’s Resource Groups Tagging API supports tagging for the following services:
- AWS Key Management Service (KMS)
- Amazon S3
- AWS Lambda
- Amazon Route 53
- Amazon SNS
- Amazon SQS
- Amazon OpenSearch Service
- AWS Elastic Beanstalk
- Amazon ECS
- Amazon EC2
API Coverage
Section titled “API Coverage”| Operation ▲ | Implemented ▼ | Image | Verified on Kubernetes |
|---|