Group
Source:
src/AWS/ResourceGroups/Group.ts
An AWS Resource Groups group — a collection of AWS resources defined by a tag-based query, a CloudFormation stack query, or an attached service configuration.
Deleting a group never deletes its member resources; it only deletes the group structure.
Creating Groups
Section titled “Creating Groups”Tag-based Group
import * as ResourceGroups from "alchemy/AWS/ResourceGroups";
const group = yield* ResourceGroups.Group("EnvGroup", { description: "All resources tagged env=prod", resourceQuery: { type: "TAG_FILTERS_1_0", query: JSON.stringify({ ResourceTypeFilters: ["AWS::AllSupported"], TagFilters: [{ Key: "env", Values: ["prod"] }], }), },});CloudFormation Stack Group
const group = yield* ResourceGroups.Group("StackGroup", { resourceQuery: { type: "CLOUDFORMATION_STACK_1_0", query: JSON.stringify({ ResourceTypeFilters: ["AWS::AllSupported"], StackIdentifier: stackArn, }), },});Service Configurations
Section titled “Service Configurations”const pool = yield* ResourceGroups.Group("ReservationPool", { configuration: [ { type: "AWS::ResourceGroups::Generic", parameters: [ { name: "allowed-resource-types", values: ["AWS::EC2::CapacityReservation"], }, ], }, { type: "AWS::EC2::CapacityReservationPool" }, ],});Tagging
Section titled “Tagging”const group = yield* ResourceGroups.Group("TaggedGroup", { resourceQuery: { type: "TAG_FILTERS_1_0", query: JSON.stringify({ ResourceTypeFilters: ["AWS::AllSupported"], TagFilters: [{ Key: "team", Values: ["platform"] }], }), }, tags: { team: "platform" },});