Skip to content

create_group

create_group(
    name: CreateGroupName,
    *,
    config_overrides: Optional[ResourceGroupsClientConfig] = None,
    description: Optional[Description] = None,
    resource_query: Optional[ResourceQuery] = None,
    tags: Optional[Tags] = None,
    configuration: Optional[GroupConfigurationList] = None,
    criticality: Optional[Criticality] = None,
    owner: Optional[Owner] = None,
    display_name: Optional[DisplayName] = None,
) -> CreateGroupOutput

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

Parameters:

  • name (CreateGroupName) –

    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 AWS, aws, or any other possible capitalization; these are reserved. A resource group name must be unique within each Amazon Web Services Region in your Amazon Web Services account.

  • description (Optional[Description], default: None ) –

    The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces.

  • resource_query (Optional[ResourceQuery], default: None ) –

    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 ResourceQuery or a Configuration, but not both.

  • tags (Optional[Tags], default: None ) –

    The tags to add to the group. A tag is key-value pair string.

  • configuration (Optional[GroupConfigurationList], default: None ) –

    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 Configuration or a ResourceQuery, but not both.

  • criticality (Optional[Criticality], default: None ) –

    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.

  • owner (Optional[Owner], default: None ) –

    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.

  • display_name (Optional[DisplayName], default: None ) –

    The name of the application group, which you can change at any time.

Raises:

Source code in docs_src/capo_resource_groups/_services/resource_groups.py
def create_group(
    self,
    name: "capo_resource_groups.types.create_group_name.CreateGroupName",
    *,
    config_overrides: Optional[ResourceGroupsClientConfig] = None,
    description: Optional[
        "capo_resource_groups.types.description.Description"
    ] = None,
    resource_query: Optional[
        "capo_resource_groups.types.resource_query.ResourceQuery"
    ] = None,
    tags: Optional["capo_resource_groups.types.tags.Tags"] = None,
    configuration: Optional[
        "capo_resource_groups.types.group_configuration_list.GroupConfigurationList"
    ] = None,
    criticality: Optional[
        "capo_resource_groups.types.criticality.Criticality"
    ] = None,
    owner: Optional["capo_resource_groups.types.owner.Owner"] = None,
    display_name: Optional[
        "capo_resource_groups.types.display_name.DisplayName"
    ] = None,
) -> "capo_resource_groups.types.create_group_output.CreateGroupOutput":
    """<p>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 <a href="https://docs.aws.amazon.com/ARG/latest/userguide/getting_started-query.html">Build queries and groups in Resource Groups</a> in the <i>Resource Groups User Guide</i>. For more information about service-linked groups and service configurations, see <a href="https://docs.aws.amazon.com/ARG/latest/APIReference/about-slg.html">Service configurations for Resource Groups</a>.</p> <p> <b>Minimum permissions</b> </p> <p>To run this command, you must have the following permissions:</p> <ul> <li> <p> <code>resource-groups:CreateGroup</code> </p> </li> </ul>

    Args:
        name: <p>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 <code>AWS</code>, <code>aws</code>, or any other possible capitalization; these are reserved. A resource group name must be unique within each Amazon Web Services Region in your Amazon Web Services account.</p>
        description: <p>The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces.</p>
        resource_query: <p>The resource query that determines which Amazon Web Services resources are members of this group. For more information about resource queries, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html#gettingstarted-query-cli-tag">Create a tag-based group in Resource Groups</a>. </p> <note> <p>A resource group can contain either a <code>ResourceQuery</code> or a <code>Configuration</code>, but not both.</p> </note>
        tags: <p>The tags to add to the group. A tag is key-value pair string.</p>
        configuration: <p>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 <a>GroupConfigurationItem</a> elements. For details about the syntax of service configurations, see <a href="https://docs.aws.amazon.com/ARG/latest/APIReference/about-slg.html">Service configurations for Resource Groups</a>.</p> <note> <p>A resource group can contain either a <code>Configuration</code> or a <code>ResourceQuery</code>, but not both.</p> </note>
        criticality: <p>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.</p>
        owner: <p>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. </p>
        display_name: <p>The name of the application group, which you can change at any time. </p>

    Raises:
        capo_resource_groups.errors.bad_request_exception.BadRequestException: <p>The request includes one or more parameters that violate validation rules.</p>
        capo_resource_groups.errors.forbidden_exception.ForbiddenException: <p>The caller isn't authorized to make the request. Check permissions.</p>
        capo_resource_groups.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal error occurred while processing the request. Try again later.</p>
        capo_resource_groups.errors.method_not_allowed_exception.MethodNotAllowedException: <p>The request uses an HTTP method that isn't allowed for the specified resource.</p>
        capo_resource_groups.errors.too_many_requests_exception.TooManyRequestsException: <p>You've exceeded throttling limits by making too many requests in a period of time.</p>
        capo_resource_groups.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_resource_groups.types.create_group_input.CreateGroupInput]",
    ) -> OperationResponse[
        "capo_resource_groups.types.create_group_output.CreateGroupOutput"
    ]:
        import capo_resource_groups._operations.ardi.create_group

        output, http_response = (
            capo_resource_groups._operations.ardi.create_group.create_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGroup")
    )
    input_: capo_resource_groups.types.create_group_input.CreateGroupInput = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if resource_query is not None:
        input_["resource_query"] = resource_query
    if tags is not None:
        input_["tags"] = tags
    if configuration is not None:
        input_["configuration"] = configuration
    if criticality is not None:
        input_["criticality"] = criticality
    if owner is not None:
        input_["owner"] = owner
    if display_name is not None:
        input_["display_name"] = display_name

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output