Inspector / Client / create_resource_group

create_resource_group#

Inspector.Client.create_resource_group(**kwargs)#

Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see CreateAssessmentTarget.

See also: AWS API Documentation

Request Syntax

response = client.create_resource_group(
    resourceGroupTags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
Parameters:

resourceGroupTags (list) –

[REQUIRED]

A collection of keys and an array of possible values, ‘[{“key”:”key1”,”values”:[“Value1”,”Value2”]},{“key”:”Key2”,”values”:[“Value3”]}]’.

For example,’[{“key”:”Name”,”values”:[“TestEC2Instance”]}]’.

  • (dict) –

    This data type is used as one of the elements of the ResourceGroup data type.

    • key (string) – [REQUIRED]

      A tag key.

    • value (string) –

      The value assigned to a tag key.

Return type:

dict

Returns:

Response Syntax

{
    'resourceGroupArn': 'string'
}

Response Structure

  • (dict) –

    • resourceGroupArn (string) –

      The ARN that specifies the resource group that is created.

Exceptions

Examples

Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target.

response = client.create_resource_group(
    resourceGroupTags=[
        {
            'key': 'Name',
            'value': 'example',
        },
    ],
)

print(response)

Expected Output:

{
    'resourceGroupArn': 'arn:aws:inspector:us-west-2:123456789012:resourcegroup/0-AB6DMKnv',
    'ResponseMetadata': {
        '...': '...',
    },
}