CloudWatch / Client / get_metric_data_query_definition

get_metric_data_query_definition

CloudWatch.Client.get_metric_data_query_definition(**kwargs)

Returns a metric data query definition, including its expression.

Permissions

To get a definition, you need the cloudwatch:GetMetricDataQueryDefinition permission on the metric data query definition resource. You can use the aws:ResourceTag/${TagKey} condition key to control access based on the tags of the definition.

See also: AWS API Documentation

Request Syntax

response = client.get_metric_data_query_definition(
    Id='string'
)
Parameters:

Id (string) –

[REQUIRED]

The ID of the metric data query definition to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'Id': 'string',
    'Arn': 'string',
    'Path': 'string',
    'Expression': 'string',
    'Type': 'PROMQL'|'SQL'|'METRIC_MATH',
    'CreatedAt': datetime(2015, 1, 1),
    'UpdatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • Id (string) –

      The ID of the metric data query definition.

    • Arn (string) –

      The Amazon Resource Name (ARN) of the metric data query definition.

    • Path (string) –

      The path of the metric data query definition.

    • Expression (string) –

      The query expression.

    • Type (string) –

      The language of the expression. Valid values are the following:

      • PROMQL – A PromQL query.

      • SQL – A CloudWatch Metrics Insights query.

      • METRIC_MATH – A metric math expression.

    • CreatedAt (datetime) –

      The date and time when you created the metric data query definition.

    • UpdatedAt (datetime) –

      The date and time when you last updated the metric data query definition.

Exceptions