> ## Documentation Index
> Fetch the complete documentation index at: https://www.ravion.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get CloudWatch metric data

> Fetch CloudWatch metric data for a module instance UI metric. Resolves the AWS account from `awsAccountId` + `region`. Applies a short Redis cache (60s for ranges that end at `now`, 5 min for fixed ranges).



## OpenAPI

````yaml https://api.ravion.com/openapi.yaml get /aws/cloudwatch/metric
openapi: 3.0.0
info:
  title: Ravion
  version: 0.0.0
servers:
  - url: https://api.ravion.com
security:
  - BearerAuth: []
tags:
  - name: Projects
  - name: Environments
  - name: Pipelines
  - name: PipelineRuns
  - name: TerraformResources
  - name: TerraformExecutionSummaries
  - name: PipelineStepExecutions
  - name: AwsCloudWatch
  - name: PipelineVersions
  - name: Organizations
  - name: Stacks
  - name: StackWorkspaces
  - name: Auth
  - name: OAuth
  - name: User
  - name: Health
  - name: Memberships
  - name: ServiceAccounts
  - name: AwsDefaultNetworks
  - name: AwsAccounts
  - name: ApiKeys
  - name: ExecutionEnvironments
  - name: ModuleDefinitions
  - name: ModuleVersions
  - name: ModuleInstances
  - name: DefaultValueDefinitions
  - name: DefaultValues
  - name: CodeSources
  - name: Github
  - name: Gitlab
  - name: Git
  - name: Values
  - name: Deployments
  - name: DeploymentResources
  - name: InfrastructureEvents
  - name: WebSocket
  - name: Describe
paths:
  /aws/cloudwatch/metric:
    get:
      tags:
        - AwsCloudWatch
      summary: Get CloudWatch metric data
      description: >-
        Fetch CloudWatch metric data for a module instance UI metric. Resolves
        the AWS account from `awsAccountId` + `region`. Applies a short Redis
        cache (60s for ranges that end at `now`, 5 min for fixed ranges).
      operationId: GetCloudWatchMetricData
      parameters:
        - description: AWS account database ID used to resolve credentials.
          in: query
          name: awsAccountId
          required: true
          schema:
            type: string
        - description: AWS region the metric lives in.
          in: query
          name: region
          required: true
          schema:
            type: string
        - description: CloudWatch namespace (e.g. AWS/ECS)
          in: query
          name: metricNamespace
          required: true
          schema:
            type: string
        - description: CloudWatch metric name (e.g. CPUUtilization)
          in: query
          name: metricName
          required: true
          schema:
            type: string
        - description: CloudWatch statistic to apply (Average, Sum, Maximum, ...)
          in: query
          name: statistic
          required: true
          schema:
            type: string
        - description: >-
            Aggregation period in seconds (e.g. 300). Must obey CloudWatch's
            per-window granularity floor (60s ≤ 15d, 300s ≤ 63d, 3600s ≤ 455d).
          in: query
          name: period
          required: true
          schema:
            format: int32
            type: integer
        - description: >-
            Inclusive start of the query window (ISO 8601). Must be earlier than
            `endTime` and within CloudWatch's 455-day retention.
          in: query
          name: startTime
          required: true
          schema:
            type: string
        - description: >-
            Inclusive end of the query window (ISO 8601). Must be after
            `startTime` and not in the future.
          in: query
          name: endTime
          required: true
          schema:
            type: string
        - description: Repeated dimensionName=dimensionValue pairs scoping the metric
          in: query
          name: dimensions
          schema:
            items:
              type: string
            nullable: true
            type: array
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudWatchMetricDataResponse'
          description: The request has succeeded.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The request is invalid or malformed.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The server cannot find the requested resource.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Client error
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Server error
components:
  schemas:
    CloudWatchMetricDataResponse:
      additionalProperties: false
      description: Response payload for a CloudWatch metric query
      properties:
        datapoints:
          description: Time-series datapoints, ordered by timestamp ascending
          items:
            $ref: '#/components/schemas/CloudWatchMetricDatapoint'
          type: array
        unit:
          description: >-
            Display unit suffix for the metric, inferred server-side from the
            namespace + metric name (e.g. `%`, ``, `B`). Empty when unknown.
          type: string
      required:
        - datapoints
        - unit
      type: object
    Errors.UserFacingErrorData:
      additionalProperties: false
      description: |-
        User-facing error presentation data.
        This is what the API returns to the frontend after formatting ErrorData
        using CEL templates from the error registry.

        Used for both:
        - Error fields on domain models (e.g., PipelineRun.error)
        - API error response bodies (HTTP 4xx/5xx responses)
      properties:
        action:
          allOf:
            - $ref: '#/components/schemas/Errors.Action'
          description: Optional action to help resolve the error
        code:
          description: Full error code, e.g., "Ravion:Pipeline:NOT_FOUND"
          type: string
        description:
          description: Additional description with more details
          type: string
        details:
          description: Structured details rendered as user-facing sections.
          items:
            $ref: '#/components/schemas/Errors.UserFacingErrorDetailSection'
          type: array
        isInternal:
          description: >-
            Indicates whether this error is internal (only set when
            ShowInternal=true).

            This allows SUPERADMINs to identify internal errors while viewing
            full details.
          type: boolean
        message:
          description: Main error message (required)
          type: string
        metadata:
          additionalProperties: {}
          description: >-
            Error params/metadata. Stripped for internal errors unless
            superadmin.
          type: object
        requestId:
          description: Request ID for correlating errors with server logs.
          type: string
      required:
        - code
        - message
      type: object
    CloudWatchMetricDatapoint:
      additionalProperties: false
      description: A single CloudWatch metric datapoint
      properties:
        max:
          description: >-
            Maximum value across the period — paired with `min` to render a band
            on line charts
          format: double
          type: number
        min:
          description: >-
            Minimum value across the period — paired with `max` to render a band
            on line charts
          format: double
          type: number
        timestamp:
          description: Datapoint timestamp in ISO 8601 format
          type: string
        value:
          description: Primary metric value (the user-supplied statistic, e.g. Average)
          format: double
          type: number
      required:
        - timestamp
        - value
      type: object
    Errors.Action:
      additionalProperties: false
      description: Action to help user resolve the error
      properties:
        label:
          description: Button/link label text
          type: string
        url:
          description: URL to navigate to for resolution
          type: string
      required:
        - label
        - url
      type: object
    Errors.UserFacingErrorDetailSection:
      additionalProperties: false
      description: Structured user-facing error detail section.
      properties:
        items:
          description: List of detail values for this section.
          items:
            type: string
          type: array
        object:
          additionalProperties: {}
          description: Structured detail payload for object rendering.
          type: object
        render:
          description: Rendering hint for clients. Valid values are list or object.
          type: string
        title:
          description: Detail section title shown in the UI.
          type: string
      required:
        - title
        - render
      type: object
  securitySchemes:
    BearerAuth:
      scheme: Bearer
      type: http

````