group_resources

group_resources(**kwargs)

Adds the specified resources to the specified group.

Warning

You can use this operation with only resource groups that are configured with the following types:

  • AWS::EC2::HostManagement
  • AWS::EC2::CapacityReservationPool

Other resource group type and resource types aren't currently supported by this operation.

Minimum permissions

To run this command, you must have the following permissions:

  • resource-groups:GroupResources

See also: AWS API Documentation

Request Syntax

response = client.group_resources(
    Group='string',
    ResourceArns=[
        'string',
    ]
)
Parameters
  • Group (string) --

    [REQUIRED]

    The name or the ARN of the resource group to add resources to.

  • ResourceArns (list) --

    [REQUIRED]

    The list of ARNs of the resources to be added to the group.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'Succeeded': [
        'string',
    ],
    'Failed': [
        {
            'ResourceArn': 'string',
            'ErrorMessage': 'string',
            'ErrorCode': 'string'
        },
    ],
    'Pending': [
        {
            'ResourceArn': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Succeeded (list) --

      A list of ARNs of the resources that this operation successfully added to the group.

      • (string) --
    • Failed (list) --

      A list of ARNs of any resources that this operation failed to add to the group.

      • (dict) --

        A resource that failed to be added to or removed from a group.

        • ResourceArn (string) --

          The ARN of the resource that failed to be added or removed.

        • ErrorMessage (string) --

          The error message text associated with the failure.

        • ErrorCode (string) --

          The error code associated with the failure.

    • Pending (list) --

      A list of ARNs of any resources that this operation is still in the process adding to the group. These pending additions continue asynchronously. You can check the status of pending additions by using the ListGroupResources operation, and checking the Resources array in the response and the Status field of each object in that array.

      • (dict) --

        A structure that identifies a resource that is currently pending addition to the group as a member. Adding a resource to a resource group happens asynchronously as a background task and this one isn't completed yet.

        • ResourceArn (string) --

          The Amazon resource name (ARN) of the resource that's in a pending state.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException