Expand description
AWS Resource Groups lets you organize AWS resources such as Amazon EC2 instances, Amazon Relational Database Service databases, and Amazon S3 buckets into groups using criteria that you define as tags. A resource group is a collection of resources that match the resource types specified in a query, and share one or more tags or portions of tags. You can create a group of resources based on their roles in your cloud infrastructure, lifecycle stages, regions, application layers, or virtually any criteria. Resource Groups enable you to automate management tasks, such as those in AWS Systems Manager Automation documents, on tag-related resources in AWS Systems Manager. Groups of tagged resources also let you quickly view a custom console in AWS Systems Manager that shows AWS Config compliance and other monitoring data about member resources.
To create a resource group, build a resource query, and specify tags that identify the criteria that members of the group have in common. Tags are key-value pairs.
For more information about Resource Groups, see the AWS Resource Groups User Guide.
AWS Resource Groups uses a REST-compliant API that you can use to perform the following types of operations.
-
Create, Read, Update, and Delete (CRUD) operations on resource groups and resource query entities
-
Applying, editing, and removing tags from resource groups
-
Resolving resource group member ARNs so they can be returned as search results
-
Getting data about resources that are members of a group
-
Searching AWS resources based on a resource query
If you’re using the service, you’re probably looking for ResourceGroupsClient and ResourceGroups.
Structs§
- Create
Group Input - Create
Group Output - Delete
Group Input - Delete
Group Output - Failed
Resource A resource that failed to be added to or removed from a group.
- GetGroup
Configuration Input - GetGroup
Configuration Output - GetGroup
Input - GetGroup
Output - GetGroup
Query Input - GetGroup
Query Output - GetTags
Input - GetTags
Output - Group
A resource group that contains AWS resources. You can assign resources to the group by associating either of the following elements with the group:
-
ResourceQuery - Use a resource query to specify a set of tag keys and values. All resources in the same AWS Region and AWS account that have those keys with the same values are included in the group. You can add a resource query when you create the group, or later by using the PutGroupConfiguration operation.
-
GroupConfiguration - Use a service configuration to associate the group with an AWS service. The configuration specifies which resource types can be included in the group.
-
- Group
Configuration A service configuration associated with a resource group. The configuration options are determined by the AWS service that defines the
Type
, and specifies which resources can be included in the group. You can add a service configuration when you create the group by using CreateGroup, or later by using the PutGroupConfiguration operation. For details about group service configuration syntax, see Service configurations for resource groups.- Group
Configuration Item An item in a group configuration. A group service configuration can have one or more items. For details about group service configuration syntax, see Service configurations for resource groups.
- Group
Configuration Parameter A parameter for a group configuration item. For details about group service configuration syntax, see Service configurations for resource groups.
- Group
Filter A filter collection that you can use to restrict the results from a
List
operation to only those you want to include.- Group
Identifier The unique identifiers for a resource group.
- Group
Query A mapping of a query attached to a resource group that determines the AWS resources that are members of the group.
- Group
Resources Input - Group
Resources Output - List
Group Resources Input - List
Group Resources Item A structure returned by the ListGroupResources operation that contains identity and group membership status information for one of the resources in the group.
- List
Group Resources Output - List
Groups Input - List
Groups Output - Pending
Resource A structure that identifies a resource that is currently pending addition to the group as a member. Adding a resource to a resource group happens asynchronously as a background task and this one isn't completed yet.
- PutGroup
Configuration Input - PutGroup
Configuration Output - Query
Error A two-part error structure that can occur in
ListGroupResources
orSearchResources
operations on CloudFormation stack-based queries. The error occurs if the CloudFormation stack on which the query is based either does not exist, or has a status that renders the stack inactive. AQueryError
occurrence does not necessarily mean that AWS Resource Groups could not complete the operation, but the resulting group might have no member resources.- Resource
Filter A filter name and value pair that is used to obtain more specific results from a list of resources.
- Resource
Groups Client - A client for the Resource Groups API.
- Resource
Identifier A structure that contains the ARN of a resource and its resource type.
- Resource
Query The query that is used to define a resource group or a search for resources. A query specifies both a query type and a query string as a JSON object. See the examples section for example JSON strings.
The examples that follow are shown as standard JSON strings. If you include such a string as a parameter to the AWS CLI or an SDK API, you might need to 'escape' the string into a single line. For example, see the Quoting strings in the AWS CLI User Guide.
Example 1
The following generic example shows a resource query JSON string that includes only resources that meet the following criteria:
-
The resource type must be either
resource_type1
orresource_type2
. -
The resource must have a tag
Key1
with a value of eitherValueA
orValueB
. -
The resource must have a tag
Key2
with a value of eitherValueC
orValueD
.
{ "Type": "TAG_FILTERS_1_0", "Query": { "ResourceTypeFilters": [ "resource_type1", "resource_type2"], "TagFilters": [ { "Key": "Key1", "Values": ["ValueA","ValueB"] }, { "Key":"Key2", "Values":["ValueC","ValueD"] } ] } }
This has the equivalent "shortcut" syntax of the following:
{ "Type": "TAG_FILTERS_1_0", "Query": { "ResourceTypeFilters": [ "resource_type1", "resource_type2"], "TagFilters": [ { "Key1": ["ValueA","ValueB"] }, { "Key2": ["ValueC","ValueD"] } ] } }
Example 2
The following example shows a resource query JSON string that includes only Amazon EC2 instances that are tagged
Stage
with a value ofTest
.{ "Type": "TAG_FILTERS_1_0", "Query": "{ "ResourceTypeFilters": "AWS::EC2::Instance", "TagFilters": { "Stage": "Test" } } }
Example 3
The following example shows a resource query JSON string that includes resource of any supported type as long as it is tagged
Stage
with a value ofProd
.{ "Type": "TAG_FILTERS_1_0", "Query": { "ResourceTypeFilters": "AWS::AllSupported", "TagFilters": { "Stage": "Prod" } } }
Example 4
The following example shows a resource query JSON string that includes only Amazon EC2 instances and Amazon S3 buckets that are part of the specified AWS CloudFormation stack.
{ "Type": "CLOUDFORMATION_STACK_1_0", "Query": { "ResourceTypeFilters": [ "AWS::EC2::Instance", "AWS::S3::Bucket" ], "StackIdentifier": "arn:aws:cloudformation:us-west-2:123456789012:stack/AWStestuseraccount/fb0d5000-aba8-00e8-aa9e-50d5cEXAMPLE" } }
-
- Resource
Status A structure that identifies the current group membership status for a resource. Adding a resource to a resource group is performed asynchronously as a background task. A
PENDING
status indicates, for this resource, that the process isn't completed yet.- Search
Resources Input - Search
Resources Output - TagInput
- TagOutput
- Ungroup
Resources Input - Ungroup
Resources Output - Untag
Input - Untag
Output - Update
Group Input - Update
Group Output - Update
Group Query Input - Update
Group Query Output
Enums§
- Create
Group Error - Errors returned by CreateGroup
- Delete
Group Error - Errors returned by DeleteGroup
- GetGroup
Configuration Error - Errors returned by GetGroupConfiguration
- GetGroup
Error - Errors returned by GetGroup
- GetGroup
Query Error - Errors returned by GetGroupQuery
- GetTags
Error - Errors returned by GetTags
- Group
Resources Error - Errors returned by GroupResources
- List
Group Resources Error - Errors returned by ListGroupResources
- List
Groups Error - Errors returned by ListGroups
- PutGroup
Configuration Error - Errors returned by PutGroupConfiguration
- Search
Resources Error - Errors returned by SearchResources
- TagError
- Errors returned by Tag
- Ungroup
Resources Error - Errors returned by UngroupResources
- Untag
Error - Errors returned by Untag
- Update
Group Error - Errors returned by UpdateGroup
- Update
Group Query Error - Errors returned by UpdateGroupQuery
Traits§
- Resource
Groups - Trait representing the capabilities of the Resource Groups API. Resource Groups clients implement this trait.