1. Registry
  2. Packages
  3. AWS Cloud Control
  4. API Docs
  5. cloudwatch
  6. MetricDataQueryDefinition

We recommend new projects start with resources from the AWS provider.

Viewing docs for AWS Cloud Control v1.86.0
published on Wednesday, Nov 18, 2026 by Pulumi
aws-native logo aws-native logo AWS Cloud Control

We recommend new projects start with resources from the AWS provider.

Viewing docs for AWS Cloud Control v1.86.0
published on Wednesday, Nov 18, 2026 by Pulumi

    Resource Type definition for AWS::CloudWatch::MetricDataQueryDefinition. A saved CloudWatch metric data query (PromQL, SQL, or Metric Math) with a path that is unique in the account and Region.

    Create MetricDataQueryDefinition Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new MetricDataQueryDefinition(name: string, args: MetricDataQueryDefinitionArgs, opts?: CustomResourceOptions);
    @overload
    def MetricDataQueryDefinition(resource_name: str,
                                  args: MetricDataQueryDefinitionArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def MetricDataQueryDefinition(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  expression: Optional[str] = None,
                                  path: Optional[str] = None,
                                  type: Optional[MetricDataQueryDefinitionType] = None,
                                  tags: Optional[Sequence[_root_inputs.TagArgs]] = None)
    func NewMetricDataQueryDefinition(ctx *Context, name string, args MetricDataQueryDefinitionArgs, opts ...ResourceOption) (*MetricDataQueryDefinition, error)
    public MetricDataQueryDefinition(string name, MetricDataQueryDefinitionArgs args, CustomResourceOptions? opts = null)
    public MetricDataQueryDefinition(String name, MetricDataQueryDefinitionArgs args)
    public MetricDataQueryDefinition(String name, MetricDataQueryDefinitionArgs args, CustomResourceOptions options)
    
    type: aws-native:cloudwatch:MetricDataQueryDefinition
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "aws-native_cloudwatch_metric_data_query_definition" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args MetricDataQueryDefinitionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args MetricDataQueryDefinitionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args MetricDataQueryDefinitionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MetricDataQueryDefinitionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MetricDataQueryDefinitionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    MetricDataQueryDefinition Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The MetricDataQueryDefinition resource accepts the following input properties:

    Expression string
    The metric query. It is stored as-is and is not validated.
    Path string
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    Type Pulumi.AwsNative.CloudWatch.MetricDataQueryDefinitionType
    The query language of Expression.
    Tags List<Pulumi.AwsNative.Inputs.Tag>
    An array of key-value pairs to apply to the metric data query definition.
    Expression string
    The metric query. It is stored as-is and is not validated.
    Path string
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    Type MetricDataQueryDefinitionType
    The query language of Expression.
    Tags TagArgs
    An array of key-value pairs to apply to the metric data query definition.
    expression string
    The metric query. It is stored as-is and is not validated.
    path string
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    type "PROMQL" | "SQL" | "METRIC_MATH"
    The query language of Expression.
    tags list(object)
    An array of key-value pairs to apply to the metric data query definition.
    expression String
    The metric query. It is stored as-is and is not validated.
    path String
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    type MetricDataQueryDefinitionType
    The query language of Expression.
    tags List<Tag>
    An array of key-value pairs to apply to the metric data query definition.
    expression string
    The metric query. It is stored as-is and is not validated.
    path string
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    type MetricDataQueryDefinitionType
    The query language of Expression.
    tags Tag[]
    An array of key-value pairs to apply to the metric data query definition.
    expression str
    The metric query. It is stored as-is and is not validated.
    path str
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    type MetricDataQueryDefinitionType
    The query language of Expression.
    tags Sequence[TagArgs]
    An array of key-value pairs to apply to the metric data query definition.
    expression String
    The metric query. It is stored as-is and is not validated.
    path String
    The name of the metric data query definition. Use '/' to organize definitions into folders. Must be unique in the account and Region. Changing it renames the definition in place.
    type "PROMQL" | "SQL" | "METRIC_MATH"
    The query language of Expression.
    tags List<Property Map>
    An array of key-value pairs to apply to the metric data query definition.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the MetricDataQueryDefinition resource produces the following output properties:

    Arn string
    The Amazon Resource Name (ARN) of the metric data query definition.
    AwsId string
    The ID of the metric data query definition, generated by the service.
    CreatedAt string
    The timestamp when the metric data query definition was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    The timestamp when the metric data query definition was last updated.
    Arn string
    The Amazon Resource Name (ARN) of the metric data query definition.
    AwsId string
    The ID of the metric data query definition, generated by the service.
    CreatedAt string
    The timestamp when the metric data query definition was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    The timestamp when the metric data query definition was last updated.
    arn string
    The Amazon Resource Name (ARN) of the metric data query definition.
    aws_id string
    The ID of the metric data query definition, generated by the service.
    created_at string
    The timestamp when the metric data query definition was created.
    id string
    The provider-assigned unique ID for this managed resource.
    updated_at string
    The timestamp when the metric data query definition was last updated.
    arn String
    The Amazon Resource Name (ARN) of the metric data query definition.
    awsId String
    The ID of the metric data query definition, generated by the service.
    createdAt String
    The timestamp when the metric data query definition was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    The timestamp when the metric data query definition was last updated.
    arn string
    The Amazon Resource Name (ARN) of the metric data query definition.
    awsId string
    The ID of the metric data query definition, generated by the service.
    createdAt string
    The timestamp when the metric data query definition was created.
    id string
    The provider-assigned unique ID for this managed resource.
    updatedAt string
    The timestamp when the metric data query definition was last updated.
    arn str
    The Amazon Resource Name (ARN) of the metric data query definition.
    aws_id str
    The ID of the metric data query definition, generated by the service.
    created_at str
    The timestamp when the metric data query definition was created.
    id str
    The provider-assigned unique ID for this managed resource.
    updated_at str
    The timestamp when the metric data query definition was last updated.
    arn String
    The Amazon Resource Name (ARN) of the metric data query definition.
    awsId String
    The ID of the metric data query definition, generated by the service.
    createdAt String
    The timestamp when the metric data query definition was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    The timestamp when the metric data query definition was last updated.

    Look up Existing MetricDataQueryDefinition Resource

    Get an existing MetricDataQueryDefinition resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, opts?: CustomResourceOptions): MetricDataQueryDefinition
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None) -> MetricDataQueryDefinition
    func GetMetricDataQueryDefinition(ctx *Context, name string, id IDInput, state *MetricDataQueryDefinitionState, opts ...ResourceOption) (*MetricDataQueryDefinition, error)
    public static MetricDataQueryDefinition Get(string name, Input<string> id, CustomResourceOptions? opts = null)
    public static MetricDataQueryDefinition get(String name, Output<String> id, CustomResourceOptions options)
    resources:  existingMetricDataQueryDefinition:    type: aws-native:cloudwatch:MetricDataQueryDefinition    get:      id: ${id}
    import {
      to = aws-native_cloudwatch_metric_data_query_definition.example
      id = "${id}"
    }
    
    name string
    The unique name of the resulting resource.
    id Input<ID>
    The unique provider ID of the resource to look up.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resulting resource.
    id str
    The unique provider ID of the resource to look up.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resulting resource.
    id IDInput
    The unique provider ID of the resource to look up.
    state MetricDataQueryDefinitionState
    Pass nil. This resource has no state arguments.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resulting resource.
    id Input<string>
    The unique provider ID of the resource to look up.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resulting resource.
    id Output<String>
    The unique provider ID of the resource to look up.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Supporting Types

    MetricDataQueryDefinitionType

    The query language of Expression.

    NameValue
    PromqlPROMQL
    SqlSQL
    MetricMathMETRIC_MATH
    NameValue
    MetricDataQueryDefinitionTypePromqlPROMQL
    MetricDataQueryDefinitionTypeSqlSQL
    MetricDataQueryDefinitionTypeMetricMathMETRIC_MATH
    Value
    PROMQL
    SQL
    METRIC_MATH
    NameValue
    PromqlPROMQL
    SqlSQL
    MetricMathMETRIC_MATH
    NameValue
    PromqlPROMQL
    SqlSQL
    MetricMathMETRIC_MATH
    NameValue
    PROMQLPROMQL
    SQLSQL
    METRIC_MATHMETRIC_MATH
    Value
    PROMQL
    SQL
    METRIC_MATH

    Tag, TagArgs

    A set of tags to apply to the resource.

    Key string
    The key name of the tag
    Value string
    The value of the tag
    Key string
    The key name of the tag
    Value string
    The value of the tag
    key string
    The key name of the tag
    value string
    The value of the tag
    key String
    The key name of the tag
    value String
    The value of the tag
    key string
    The key name of the tag
    value string
    The value of the tag
    key str
    The key name of the tag
    value str
    The value of the tag
    key String
    The key name of the tag
    value String
    The value of the tag

    Package Details

    Repository
    AWS Native pulumi/pulumi-aws-native
    License
    Apache-2.0
    aws-native logo aws-native logo AWS Cloud Control

    We recommend new projects start with resources from the AWS provider.

    Viewing docs for AWS Cloud Control v1.86.0
    published on Wednesday, Nov 18, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial