logo
Expand description

AWS Resource Groups

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

A resource that failed to be added to or removed from a 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.

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.

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.

A parameter for a group configuration item. For details about group service configuration syntax, see Service configurations for resource groups.

A filter collection that you can use to restrict the results from a List operation to only those you want to include.

The unique identifiers for a resource group.

A mapping of a query attached to a resource group that determines the AWS resources that are members of the group.

A structure returned by the ListGroupResources operation that contains identity and group membership status information for one of the resources in the group.

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.

A two-part error structure that can occur in ListGroupResources or SearchResources 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. A QueryError occurrence does not necessarily mean that AWS Resource Groups could not complete the operation, but the resulting group might have no member resources.

A filter name and value pair that is used to obtain more specific results from a list of resources.

A client for the Resource Groups API.

A structure that contains the ARN of a resource and its resource type.

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 or resource_type2.

  • The resource must have a tag Key1 with a value of either ValueA or ValueB.

  • The resource must have a tag Key2 with a value of either ValueC or ValueD.

{ "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 of Test.

{ "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 of Prod.

{ "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" } }

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.

Enums

Errors returned by CreateGroup

Errors returned by DeleteGroup

Errors returned by GetGroupConfiguration

Errors returned by GetGroup

Errors returned by GetGroupQuery

Errors returned by GetTags

Errors returned by GroupResources

Errors returned by ListGroupResources

Errors returned by ListGroups

Errors returned by PutGroupConfiguration

Errors returned by SearchResources

Errors returned by Tag

Errors returned by UngroupResources

Errors returned by Untag

Errors returned by UpdateGroup

Errors returned by UpdateGroupQuery

Traits

Trait representing the capabilities of the Resource Groups API. Resource Groups clients implement this trait.