CloudWatch / Client / update_resource_metrics_configuration

update_resource_metrics_configuration

CloudWatch.Client.update_resource_metrics_configuration(**kwargs)

Updates the resource metrics configuration for an Amazon Web Services resource. The MetricSelections value that you provide replaces any existing metric selections for the resource; it is not merged with them.

If you omit MetricSelections, Amazon CloudWatch removes any existing metric selection filter and collects all available detailed metrics for the resource.

This operation returns a ResourceNotFoundException if no resource metrics configuration exists for the specified resource ARN. To create a configuration, use CreateResourceMetricsConfiguration.

To update a resource metrics configuration, you must have the cloudwatch:UpdateResourceMetricsConfiguration 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.update_resource_metrics_configuration(
    ResourceArn='string',
    MetricSelections=[
        {
            'IncludeMetrics': [
                'string',
            ]
        },
    ]
)
Parameters:
  • ResourceArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Amazon Web Services resource to update the resource metrics configuration for.

  • MetricSelections (list) –

    Specifies which metrics Amazon CloudWatch collects for the resource. The selections that you provide completely replace any existing metric selections.

    If you omit this parameter, Amazon CloudWatch removes any existing metric selection filter and 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 updated resource metrics configuration.

    • ResourceMetricsConfiguration (dict) –

      The resource metrics configuration after the update was applied.

      • 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