Build queries and groups in AWS Resource Groups
Topics
Types of resource group queries
In AWS Resource Groups, a query is the foundation of a group. You can base a resource group on one of two types of queries.
- Tag-based
-
Tag-based queries include lists of resources that are specified in the following format
AWS::
, and tags. Tags are keys that help identify and sort your resources in your organization. Optionally, tags include values for keys.service
::resource
For a tag-based query, you also specify the tags that are shared by the resources that you want to be members of the group. For example, if you want to create a resource group that has all of the Amazon EC2 instances and Amazon S3 buckets that you are using to run the testing stage of an application, and you have instances and buckets that are tagged this way, choose the
AWS::EC2::Instance
andAWS::S3::Bucket
resource types from the drop-down list, and then specify the tag keyStage
, with a tag value ofTest
. - AWS CloudFormation stack-based
-
In an AWS CloudFormation stack-based query, you choose an AWS CloudFormation stack in your account in the current region, and then choose resource types in the stack that you want to be in the group. You can base your query on only one AWS CloudFormation stack. Resource Groups supports queries based on AWS CloudFormation stacks that have one of the following statuses.
Important Only resources that are directly created as part of the stack in the query are included in the resource group. Resources created later by members of the group do not become members of the group. For example, if an auto-scaling group is created by AWS CloudFormation as part of the stack, then that auto-scaling group is a member of the group. However, an Amazon EC2 instance created by that auto-scaling group as part of its operation is not a member of the AWS CloudFormation stack-based resource group.
If you create a group based on an AWS CloudFormation stack, and the stack's status changes to one that is no longer supported as a basis for a group query, such as
DELETE_COMPLETE
, the group still exists, but it has no member resources.-
CREATE_COMPLETE
-
CREATE_IN_PROGRESS
-
DELETE_IN_PROGRESS
-
DELETE_FAILED
-
REVIEW_IN_PROGRESS
-
ROLLBACK_IN_PROGRESS
-
ROLLBACK_FAILED
-
UPDATE_IN_PROGRESS
-
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS
-
UPDATE_COMPLETE
-
UPDATE_ROLLBACK_IN_PROGRESS
-
UPDATE_ROLLBACK_FAILED
-
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS
-
UPDATE_ROLLBACK_COMPLETE
-
After you have created a resource group, you can perform tasks on the resources in the group.
Build a tag-based query and create a group
The following procedures show you how to build a tag-based query and use it to create a resource group.
Create an AWS CloudFormation stack-based group
The following procedures show you how to build a stack-based query and use it to create a resource group.