CmdID / aws / aws resource-groups
aws resource-groups update-group-query
Updates the resource query of a group. AWS CLI reference
2 examples 3 options Its page in the AWS CLI reference
Examples
Example 1: To update the query for a tag-based resource group
The following update-group-query example updates the query attached to the specified tag-based resource group.
aws resource-groups update-group-query --group-name tbq-WebServer --resource-query '{"Type":"TAG_FILTERS_1_0", "Query":"{\"ResourceTypeFilters\":[\"AWS::EC2::Instance\"],\"TagFilters\":[{\"Key\":\"Name\", \"Values\":[\"WebServers\"]}]}"}'Identify--group-nameDon't use this parameter.--resource-queryThe resource query to determine which Amazon Web Services resources are members of this resource group.Its output
{
"GroupQuery": {
"GroupName": "tbq-WebServer",
"ResourceQuery": {
"Type": "TAG_FILTERS_1_0",
"Query": "{\"ResourceTypeFilters\":[\"AWS::EC2::Instance\"],\"TagFilters\":[{\"Key\":\"Name\", \"Values\":[\"WebServers\"]}]}"
}
}
}For more information, see Update Groups in the AWS Resource Groups User Guide.
Example 2: To update the query for a CloudFormation stack-based resource group
The following update-group-query example updates the query attached to the specified AWS CloudFormation stack-based resource group.
aws resource-groups update-group-query --group-name cbq-CFNstackgroup --resource-query '{"Type": "CLOUDFORMATION_STACK_1_0", "Query": "{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"StackIdentifier\":\"arn:aws:cloudformation:us-west-2:123456789012:stack/MyCFNStack/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\"}"}'Identify--group-nameDon't use this parameter.--resource-queryThe resource query to determine which Amazon Web Services resources are members of this resource group.Its output
{
"GroupQuery": {
"GroupName": "cbq-CFNstackgroup",
"ResourceQuery": {
"Type": "CLOUDFORMATION_STACK_1_0",
"Query": "{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"StackIdentifier\":\"arn:aws:cloudformation:us-west-2:123456789012:stack/MyCFNStack/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\"}"
}
}
}For more information, see Update Groups in the AWS Resource Groups User Guide.
Options
--group-nameDon't use this parameter.--groupThe name or the Amazon resource name (ARN) of the resource group to query.--resource-queryThe resource query to determine which Amazon Web Services resources are members of this resource group.