Skip to content

Commit 21a52db

Browse files
authored
docs: Resource Groups Tagging API (#455)
1 parent ef9137d commit 21a52db

File tree

2 files changed

+100
-5
lines changed

2 files changed

+100
-5
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: "Resource Groups Tagging API"
3+
tags: ["Base"]
4+
description: Get started with Resource Groups Tagging API on LocalStack
5+
---
6+
7+
import FeatureCoverage from "../../../../components/feature-coverage/FeatureCoverage";
8+
9+
## Introduction
10+
11+
Resource Groups Tagging API helps you centrally manage tags across AWS resources.
12+
You can apply and remove tags for multiple resources at once, and query resources by tag keys and values.
13+
You can also query tagged resources by AWS service, by resource type within a service, or directly by specific resource ARNs.
14+
15+
LocalStack allows you to use the Resource Groups Tagging API in your local environment to test tagging workflows end-to-end.
16+
The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Resource Groups Tagging API's integration with LocalStack.
17+
18+
## Getting started
19+
20+
This guide is designed for users new to Resource Groups Tagging API and assumes basic knowledge of the AWS CLI and our [`awslocal`](https://github.com/localstack/awscli-local) wrapper script.
21+
22+
Start your LocalStack container using your preferred method.
23+
We will demonstrate how to create resources, tag them, and query them using the Resource Groups Tagging API.
24+
25+
### Create resources to tag
26+
27+
Create an S3 bucket and an SQS queue:
28+
29+
```bash
30+
BUCKET_NAME="rg-tagging-bucket"
31+
QUEUE_NAME="rg-tagging-queue"
32+
33+
awslocal s3api create-bucket --bucket "$BUCKET_NAME"
34+
QUEUE_URL=$(awslocal sqs create-queue --queue-name "$QUEUE_NAME" | jq -r '.QueueUrl')
35+
```
36+
37+
Retrieve the resource ARNs:
38+
39+
```bash
40+
BUCKET_ARN="arn:aws:s3:::$BUCKET_NAME"
41+
QUEUE_ARN=$(awslocal sqs get-queue-attributes \
42+
--queue-url "$QUEUE_URL" \
43+
--attribute-names QueueArn | jq -r '.Attributes.QueueArn')
44+
```
45+
46+
### Tag multiple resources
47+
48+
Use the [`TagResources`](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagResources.html) API to apply tags:
49+
50+
```bash
51+
awslocal resourcegroupstaggingapi tag-resources \
52+
--resource-arn-list "$BUCKET_ARN" "$QUEUE_ARN" \
53+
--tags '{"Environment":"dev","Team":"platform"}'
54+
```
55+
56+
### Query resources by tags
57+
58+
Use the [`GetResources`](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html) API to list resources with a specific tag:
59+
60+
```bash
61+
awslocal resourcegroupstaggingapi get-resources \
62+
--tag-filters Key=Environment,Values=dev
63+
```
64+
65+
You can also inspect available keys and values:
66+
67+
```bash
68+
awslocal resourcegroupstaggingapi get-tag-keys
69+
awslocal resourcegroupstaggingapi get-tag-values --key Environment
70+
```
71+
72+
### Remove tags from resources
73+
74+
Use the [`UntagResources`](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_UntagResources.html) API to remove one or more tag keys:
75+
76+
```bash
77+
awslocal resourcegroupstaggingapi untag-resources \
78+
--resource-arn-list "$BUCKET_ARN" "$QUEUE_ARN" \
79+
--tag-keys Team
80+
```
81+
82+
## Supported services
83+
84+
LocalStack's Resource Groups Tagging API supports tagging for the following services:
85+
86+
- [AWS Key Management Service (KMS)](/aws/services/kms/)
87+
- [Amazon S3](/aws/services/s3/)
88+
- [AWS Lambda](/aws/services/lambda/)
89+
- [Amazon Route 53](/aws/services/route53/)
90+
- [Amazon SNS](/aws/services/sns/)
91+
- [Amazon SQS](/aws/services/sqs/)
92+
- [Amazon OpenSearch Service](/aws/services/opensearch/)
93+
- [AWS Elastic Beanstalk](/aws/services/elasticbeanstalk/)
94+
- [Amazon EC2](/aws/services/ec2/)
95+
96+
## API Coverage
97+
98+
<FeatureCoverage service="resourcegroupstaggingapi" client:load />

src/content/docs/aws/services/resource-groups.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Resource Groups in AWS provide two types of queries that developers can use to b
1515
With Tag-based queries, developers can organize resources based on common attributes or characteristics, while CloudFormation stack-based queries allow developers to group resources that are deployed together as part of a CloudFormation stack.
1616

1717
LocalStack allows you to use the Resource Groups APIs in your local environment to group and categorize resources based on criteria such as tags, resource types, regions, or custom attributes.
18-
The supported APIs are available on the API coverage section for [Resource Groups](#api-coverage) and [Resource Groups Tagging API](#api-coverage-resource-groups-tagging-api), which provides information on the extent of Resource Group's integration with LocalStack.
18+
The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Resource Group's integration with LocalStack.
19+
For tag-centric operations across AWS resources, see the [Resource Groups Tagging API](/aws/services/resource-groups-tagging-api/) guide.
1920

2021
## Getting Started
2122

@@ -76,7 +77,3 @@ awslocal resource-groups delete-group \
7677
## API Coverage
7778

7879
<FeatureCoverage service="resource-groups" client:load />
79-
80-
## API Coverage (Resource Groups Tagging API)
81-
82-
<FeatureCoverage service="resourcegroupstaggingapi" client:load />

0 commit comments

Comments
 (0)