CloudWatch / Client / create_resource_metrics_configuration

create_resource_metrics_configuration

CloudWatch.Client.create_resource_metrics_configuration(**kwargs)

Creates a resource metrics configuration for an Amazon Web Services resource. After you create a configuration, Amazon CloudWatch collects detailed metrics for that resource.

Each Amazon Web Services resource can have only one resource metrics configuration. If a configuration already exists for the specified resource ARN, this operation returns a ConflictException. To modify an existing configuration, use UpdateResourceMetricsConfiguration.

If the Amazon Web Services resource that you specify in ResourceArn does not exist, this operation returns a ResourceNotFoundException. Verify that the resource ARN is correct and that the resource exists before you retry the request.

To create a resource metrics configuration, you must have the cloudwatch:CreateResourceMetricsConfiguration permission. For information about scoping this permission to specific resources, see Condition keys for resource metrics configuration access in the Amazon CloudWatch User Guide.

See also: AWS API Documentation

Request Syntax

response = client.create_resource_metrics_configuration(
    ResourceArn='string',
    MetricSelections=[
        {
            'IncludeMetrics': [
                'string',
            ]
        },
    ]
)
Parameters:
  • ResourceArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Amazon Web Services resource to enable detailed monitoring for.

  • MetricSelections (list) –

    Specifies which metrics Amazon CloudWatch collects for the resource. If you omit this parameter, Amazon CloudWatch collects all available detailed metrics for the resource.

    • (dict) –

      Specifies which metrics Amazon CloudWatch collects for a resource metrics configuration. Include this in a CreateResourceMetricsConfiguration or UpdateResourceMetricsConfiguration request to limit collection to a specific set of metrics. If you omit metric selections, Amazon CloudWatch collects all available detailed metrics for the resource.

      • IncludeMetrics (list) – [REQUIRED]

        The names of the metrics to collect for the resource. Amazon CloudWatch collects only the metrics that you list here.

        • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'ResourceMetricsConfiguration': {
        'ResourceArn': 'string',
        'CreatedAt': datetime(2015, 1, 1),
        'UpdatedAt': datetime(2015, 1, 1),
        'MetricSelections': [
            {
                'IncludeMetrics': [
                    'string',
                ]
            },
        ]
    }
}

Response Structure

  • (dict) –

    Returns the newly created resource metrics configuration.

    • ResourceMetricsConfiguration (dict) –

      The resource metrics configuration that was created by this operation.

      • ResourceArn (string) –

        The Amazon Resource Name (ARN) of the Amazon Web Services resource that this configuration applies to.

      • CreatedAt (datetime) –

        The date and time that the resource metrics configuration was created.

      • UpdatedAt (datetime) –

        The date and time that the resource metrics configuration was last updated. When the configuration is first created, this value is the same as CreatedAt.

      • MetricSelections (list) –

        The metrics that Amazon CloudWatch collects for the resource. If this field is not present, Amazon CloudWatch collects all available detailed metrics for the resource.

        • (dict) –

          Specifies which metrics Amazon CloudWatch collects for a resource metrics configuration. Include this in a CreateResourceMetricsConfiguration or UpdateResourceMetricsConfiguration request to limit collection to a specific set of metrics. If you omit metric selections, Amazon CloudWatch collects all available detailed metrics for the resource.

          • IncludeMetrics (list) –

            The names of the metrics to collect for the resource. Amazon CloudWatch collects only the metrics that you list here.

            • (string) –

Exceptions