- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateGroupCommand
Creates a resource group with the specified name and description. You can optionally include either a resource query or a service configuration. For more information about constructing a resource query, see Build queries and groups in Resource Groups in the Resource Groups User Guide. For more information about service-linked groups and service configurations, see Service configurations for Resource Groups .
Minimum permissions
To run this command, you must have the following permissions:
-
resource-groups:CreateGroup
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ResourceGroupsClient, CreateGroupCommand } from "@aws-sdk/client-resource-groups"; // ES Modules import
// const { ResourceGroupsClient, CreateGroupCommand } = require("@aws-sdk/client-resource-groups"); // CommonJS import
const client = new ResourceGroupsClient(config);
const input = { // CreateGroupInput
Name: "STRING_VALUE", // required
Description: "STRING_VALUE",
ResourceQuery: { // ResourceQuery
Type: "TAG_FILTERS_1_0" || "CLOUDFORMATION_STACK_1_0", // required
Query: "STRING_VALUE", // required
},
Tags: { // Tags
"<keys>": "STRING_VALUE",
},
Configuration: [ // GroupConfigurationList
{ // GroupConfigurationItem
Type: "STRING_VALUE", // required
Parameters: [ // GroupParameterList
{ // GroupConfigurationParameter
Name: "STRING_VALUE", // required
Values: [ // GroupConfigurationParameterValueList
"STRING_VALUE",
],
},
],
},
],
Criticality: Number("int"),
Owner: "STRING_VALUE",
DisplayName: "STRING_VALUE",
};
const command = new CreateGroupCommand(input);
const response = await client.send(command);
// { // CreateGroupOutput
// Group: { // Group
// GroupArn: "STRING_VALUE", // required
// Name: "STRING_VALUE", // required
// Description: "STRING_VALUE",
// Criticality: Number("int"),
// Owner: "STRING_VALUE",
// DisplayName: "STRING_VALUE",
// ApplicationTag: { // ApplicationTag
// "<keys>": "STRING_VALUE",
// },
// },
// ResourceQuery: { // ResourceQuery
// Type: "TAG_FILTERS_1_0" || "CLOUDFORMATION_STACK_1_0", // required
// Query: "STRING_VALUE", // required
// },
// Tags: { // Tags
// "<keys>": "STRING_VALUE",
// },
// GroupConfiguration: { // GroupConfiguration
// Configuration: [ // GroupConfigurationList
// { // GroupConfigurationItem
// Type: "STRING_VALUE", // required
// Parameters: [ // GroupParameterList
// { // GroupConfigurationParameter
// Name: "STRING_VALUE", // required
// Values: [ // GroupConfigurationParameterValueList
// "STRING_VALUE",
// ],
// },
// ],
// },
// ],
// ProposedConfiguration: [
// {
// Type: "STRING_VALUE", // required
// Parameters: [
// {
// Name: "STRING_VALUE", // required
// Values: [
// "STRING_VALUE",
// ],
// },
// ],
// },
// ],
// Status: "UPDATING" || "UPDATE_COMPLETE" || "UPDATE_FAILED",
// FailureReason: "STRING_VALUE",
// },
// };
CreateGroupCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
Name Required | string | undefined | The name of the group, which is the identifier of the group in other operations. You can't change the name of a resource group after you create it. A resource group name can consist of letters, numbers, hyphens, periods, and underscores. The name cannot start with |
Configuration | GroupConfigurationItem[] | undefined | A configuration associates the resource group with an Amazon Web Services service and specifies how the service can interact with the resources in the group. A configuration is an array of GroupConfigurationItem elements. For details about the syntax of service configurations, see Service configurations for Resource Groups . A resource group can contain either a |
Criticality | number | undefined | The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical. |
Description | string | undefined | The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces. |
DisplayName | string | undefined | The name of the application group, which you can change at any time. |
Owner | string | undefined | A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization. |
ResourceQuery | ResourceQuery | undefined | The resource query that determines which Amazon Web Services resources are members of this group. For more information about resource queries, see Create a tag-based group in Resource Groups . A resource group can contain either a |
Tags | Record<string, string> | undefined | The tags to add to the group. A tag is key-value pair string. |
CreateGroupCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Group | Group | undefined | The description of the resource group. |
GroupConfiguration | GroupConfiguration | undefined | The service configuration associated with the resource group. For details about the syntax of a service configuration, see Service configurations for Resource Groups . |
ResourceQuery | ResourceQuery | undefined | The resource query associated with the group. For more information about resource queries, see Create a tag-based group in Resource Groups . |
Tags | Record<string, string> | undefined | The tags associated with the group. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
BadRequestException | client | The request includes one or more parameters that violate validation rules. |
ForbiddenException | client | The caller isn't authorized to make the request. Check permissions. |
InternalServerErrorException | server | An internal error occurred while processing the request. Try again later. |
MethodNotAllowedException | client | The request uses an HTTP method that isn't allowed for the specified resource. |
TooManyRequestsException | client | You've exceeded throttling limits by making too many requests in a period of time. |
ResourceGroupsServiceException | Base exception class for all service exceptions from ResourceGroups service. |