> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/reference-1/sql-commands/jobs/create-job/monitoring/amazon-cloudwatch.md).

# Amazon CloudWatch

To export monitoring data from your Upsolver account, you must first create a connection that provides the appropriate credentials to access your Amazon CloudWatch.

## Syntax

```sql
CREATE CLOUDWATCH CONNECTION <connection_identifier>
    [ AWS_CREDENTIALS =
        { AWS_ROLE = '<role_arn>'
          EXTERNAL_ID = '<external_id>'
        | AWS_ACCESS_KEY_ID = '<key_id>'
          AWS_SECRET_ACCESS_KEY = '<key>' } ]
    REGION = '<region>'
    [ COMMENT = '<comment>' ];
```

#### Jump to

* [`AWS_ROLE`](#aws_role-editable)
* [`EXTERNAL_ID`](#external_id-editable)
* [`AWS_ACCESS_KEY_ID`](#aws_access_key_id-editable)
* [`AWS_SECRET_ACCESS_KEY`](#aws_secret_access_key-editable)
* [`REGION`](#region)
* [`COMMENT`](#comment-editable)

## Connection Options

#### `AWS_ROLE` — editable

Type: `text`

(Optional) The AWS IAM role ARN. Used in conjunction with [`EXTERNAL_ID`](#external_id-editable).

If omitted, the role created when integrating Upsolver with the AWS account is used.

#### `EXTERNAL_ID` — editable

Type: `text`

(Optional) The external ID of the role to assume. Used in conjunction with [`AWS_ROLE`](#aws_role-editable).

If omitted, the role created when integrating Upsolver with the AWS account is used.

#### `AWS_ACCESS_KEY_ID` — editable

Type: `text`

(Optional) The AWS access key ID. Used in conjunction with [`AWS_SECRET_ACCESS_KEY`](#aws_secret_access_key).

If omitted, the role created when integrating Upsolver with the AWS account is used.

#### `AWS_SECRET_ACCESS_KEY` — editable

Type: `text`

(Optional) The AWS secret key corresponds to the provided [`AWS_ACCESS_KEY_ID`](#aws_access_key_id).

If omitted, the role created when integrating Upsolver with the AWS account is used.

#### `REGION`

Type: `text`

The AWS region to use.

#### `COMMENT` — editable

Type: `text`

(Optional) A description or comment regarding this connection.

## Examples

### Create a connection

The following example creates a new connection named **my\_cloudwatch\_connection** that will be used to send monitoring information to CloudWatch.

```sql
CREATE CLOUDWATCH CONNECTION my_cloudwatch_connection
    AWS_ROLE = 'arn:aws:iam::123456789012:role/upsolver-sqlake-role'
    REGION = 'us-east-1'
    COMMENT = 'CloudWatch connection for Upsolver metrics';
```

### Create a job

The following script creates a job named **send\_monitoring\_data\_to\_cloudwatch** that sends cluster metrics to the CloudWatch account **my\_cloudwatch\_connection** created in the above example:

```sql
CREATE JOB send_monitoring_data_cloudwatch 
    START_FROM = NOW
AS INSERT INTO my_cloudwatch_connection 
    NAMESPACE = 'upsolver'
    MAP_COLUMNS_BY_NAME
          SELECT utilization_percent AS utilization_percent,
              tasks_in_queue AS tasks_in_queue,
              memory_load_percent AS memory_load_percent,
              cluster_id AS tags.cluster_id,
              cluster_name AS tags.cluster_name,
              RUN_START_TIME() AS time
       FROM system.monitoring.clusters;
```

The job writes to the **upsolver** namespace in the CloudWatch account and includes the **cluster\_id** and **cluster\_name** as tags, which is helpful if you have multiple clusters in your organization.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/reference-1/sql-commands/jobs/create-job/monitoring/amazon-cloudwatch.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
