---
updatedAt: 2026-09-23T18:01:07.000Z
agentTools:
  projectIndex: https://docs.getmontecarlo.com/llms.txt
---

# AWS: CloudFormation Deployment

How-to create and register the Monte Carlo Agent with the OpenTelemetry Collector on AWS using CloudFormation

<Callout icon="📝" theme="default">
  ### Prerequisites

  1. You are an admin in [AWS](https://aws.amazon.com/).
  2. You have admin permissions in your data warehouse
  3. You are an [Account Owner](https://docs.getmontecarlo.com/docs/authorization#managed-roles-and-groups).
</Callout>

This guide outlines how to setup an Agent (with object storage) and the OpenTelemetry Collector in your AWS cloud using CloudFormation. It provides instructions for both the self-hosted and Monte Carlo-hosted OpenTelemetry Collector options.

These [FAQs](https://docs.getmontecarlo.com/docs/agent-with-open-telemetry-collector#faqs) answer common questions like how to review resources and what integrations are supported.

<Callout icon="📘" theme="info">
  If you already have the Monte Carlo Agent deployed to your cloud vendor and want to add the OpenTelemetry Collector to your deployment, skip Step 1-2 and reference this [FAQ](https://docs.getmontecarlo.com/docs/agent-with-open-telemetry-collector#what-if-i-already-have-an-agent-deployed). Afterwards, continue with [Step 3](https://docs.getmontecarlo.com/docs/create-aws-agent-with-otel-collector-cf#3-configure-your-data-warehouse-ingestion-pipeline).
</Callout>

# Steps

## 1. Deploy the Agent

Before getting started please review the Monte Carlo AWS account your collection service is hosted in.

When provisioning resources for Monte Carlo deployments on the [V2 Platform](https://docs.getmontecarlo.com/docs/deployment-and-connecting#how-do-i-check-which-version-of-the-platform-or-deployments-i-am-using), use the Collection **AWS account id** provided in the [Account information](https://getmontecarlo.com/account-info#collection) page. Accounts created after April 24th, 2024, will automatically be on the V2 platform or newer.

If you are using an older version of the platform, please contact your Monte Carlo representative for the ID.

Specifying a VPC is required to run the agent and enables certain connectivity scenarios like when you have an IP allowlist for your resource, want to peer, or deploy in your existing VPC. See more details [here](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#can-i-further-constraint-outbound-access-egress-from-the-agent).

### Deploy with a Self-Hosted OpenTelemetry Collector

You can use the quick-create link below to deploy the Agent with OpenTelemetry Collector on any [supported region](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#what-regions-does-the-agent-support) in your AWS account:

<HTMLBlock>{`
<div class="MuiBox-root jss40"><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/quickcreate?templateURL=https%3A%2F%2Fmcd-public-resources.s3.amazonaws.com%2Fcloudformation%2Faws_agent_with_opentelemetry_collector.yaml&stackName=mcd-agent" target="_blank" rel="noopener noreferrer"><svg width="144" height="27" viewBox="0 0 144 27" xmlns="http://www.w3.org/2000/svg"><title>Launch Stack</title><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="a"><stop stop-color="#FFE4B2" offset="0%"></stop><stop stop-color="#F79800" offset="100%"></stop></linearGradient><linearGradient x1="45.017%" y1="100%" x2="68.082%" y2="3.32%" id="b"><stop stop-color="#151443" offset="0%"></stop><stop stop-color="#6D80B2" offset="100%"></stop></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5z" fill="url(#a)"></path><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5zM0 5c0-2.762 2.233-5 5-5h125.5c7.456 0 13.5 6.043 13.5 13.5 0 7.456-6.05 13.5-13.5 13.5H5c-2.762 0-5-2.232-5-5V5z" fill="#0058A5"></path><circle fill="url(#b)" cx="129.5" cy="13.5" r="9.5"></circle><path fill="#FFF" d="M133 13.5l-5 4.5V9"></path><path d="M18.136 19h6.4v-1.648h-4.432V8.216h-1.968V19zm14.068 0c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm11.076-5.056H39.28v4.704c0 .224-.048.432-.112.608-.208.496-.72 1.056-1.504 1.056-1.04 0-1.456-.832-1.456-2.128v-4.24H34.24v4.576c0 2.544 1.296 3.392 2.72 3.392 1.392 0 2.16-.8 2.496-1.36h.032L39.584 19h1.728c-.032-.64-.064-1.408-.064-2.336v-5.456zM43.476 19h1.984v-4.576c0-.224.016-.464.08-.64.208-.592.752-1.152 1.536-1.152 1.072 0 1.488.848 1.488 1.968V19h1.968v-4.624c0-2.464-1.408-3.344-2.768-3.344-1.296 0-2.144.736-2.48 1.344h-.048l-.096-1.168h-1.728c.048.672.064 1.424.064 2.32V19zm14.708-1.696c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zM60.012 19h1.984v-4.656c0-.224.016-.432.08-.592.208-.592.752-1.104 1.52-1.104 1.088 0 1.504.848 1.504 1.984V19h1.968v-4.592c0-2.496-1.392-3.376-2.72-3.376-.496 0-.96.128-1.344.352-.416.224-.736.528-.976.896h-.032V7.64h-1.984V19zm12.264-.512c.592.352 1.776.672 2.912.672 2.784 0 4.096-1.504 4.096-3.232 0-1.552-.912-2.496-2.784-3.2-1.44-.56-2.064-.944-2.064-1.776 0-.624.544-1.296 1.792-1.296 1.008 0 1.76.304 2.144.512l.48-1.584c-.56-.288-1.424-.544-2.592-.544-2.336 0-3.808 1.344-3.808 3.104 0 1.552 1.136 2.496 2.912 3.136 1.376.496 1.92.976 1.92 1.792 0 .88-.704 1.472-1.968 1.472-1.008 0-1.968-.32-2.608-.688l-.432 1.632zm9.076-9.04v1.76h-1.12v1.472h1.12v3.664c0 1.024.192 1.728.608 2.176.368.4.976.64 1.696.64.624 0 1.136-.08 1.424-.192l-.032-1.504c-.176.048-.432.096-.768.096-.752 0-1.008-.496-1.008-1.44v-3.44h1.872v-1.472h-1.872V8.984l-1.92.464zM92.892 19c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm9.556 1.04c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zm3.796-9.664h-1.968V19h1.968v-2.656l.672-.784 2.24 3.44h2.416l-3.296-4.608 2.88-3.184h-2.368l-1.888 2.512c-.208.272-.432.608-.624.912h-.032V7.64z" fill="#000"></path></g></svg></a></div>
`}</HTMLBlock>

If you need to share with a colleague or first review the template you can download a copy [here](https://mcd-public-resources.s3.amazonaws.com/cloudformation/aws_agent_with_opentelemetry_collector.yaml) ([source](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#can-i-review-agent-resources-and-code)).

![](https://files.readme.io/bc821af987e572b5bbeb51b8f11fc00deeb64aaada2d80bd4fa9a6348328bddb-image.png)

<br />

When provisioning resources for Monte Carlo deployments on the [V2 Platform](https://docs.getmontecarlo.com/docs/deployment-and-connecting#how-do-i-check-which-version-of-the-platform-or-deployments-i-am-using), use the Collection **AWS account id** provided in the [Account information](https://getmontecarlo.com/account-info#collection) page. Accounts created after April 24th, 2024, will automatically be on the V2 platform or newer.

If you are using an older version of the platform, please contact your Monte Carlo representative for the ID.

Note that the AWS account ID is not the same account where you will deploy the agent. It is important to make sure this ID is the one you select as the "Monte Carlo AWS Account ID" parameter when deploying the agent as registration will fail otherwise.

<br />

<Callout icon="📘" theme="info">
  Note: by default the OpenTelemetry Collector deployed with the Monte Carlo Agent will only allow ingress from resources associated with the SecurityGroup created by the CF template. You might need to provide the `ExistingSecurityGroupId` parameter to the stack in order for the OpenTelemetry Collector to receive incoming traces from your Agent. These SecurityGroup definition will vary depend on your network configuration.
</Callout>

If you wish to use an existing S3 bucket to store the OpenTelemetry trace data, specify the ARN of the existing bucket in parameter `ExistingOpenTelemetryCollectorBucketArn`. By default the Data Store S3 bucket created by the MC Agent deployment will be used to store the OpenTelemetry trace data unless this parameter is specified.

### Deploy Using the Monte Carlo-Hosted OpenTelemetry Collector

To use the Monte Carlo-hosted OpenTelemetry collector, the Agent and OpenTelemetry data store should be deployed independently.

You can use the quick-create link below to deploy the Agent without the OpenTelemetry Collector on any [supported region](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#what-regions-does-the-agent-support) in your AWS account:

<HTMLBlock>{`
<div class="MuiBox-root jss40"><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/quickcreate?templateURL=https%3A%2F%2Fmcd-public-resources.s3.amazonaws.com%2Fcloudformation%2Faws_apollo_agent.yaml&stackName=mcd-agent" target="_blank" rel="noopener noreferrer"><svg width="144" height="27" viewBox="0 0 144 27" xmlns="http://www.w3.org/2000/svg"><title>Launch Stack</title><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="a"><stop stop-color="#FFE4B2" offset="0%"></stop><stop stop-color="#F79800" offset="100%"></stop></linearGradient><linearGradient x1="45.017%" y1="100%" x2="68.082%" y2="3.32%" id="b"><stop stop-color="#151443" offset="0%"></stop><stop stop-color="#6D80B2" offset="100%"></stop></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5z" fill="url(#a)"></path><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5zM0 5c0-2.762 2.233-5 5-5h125.5c7.456 0 13.5 6.043 13.5 13.5 0 7.456-6.05 13.5-13.5 13.5H5c-2.762 0-5-2.232-5-5V5z" fill="#0058A5"></path><circle fill="url(#b)" cx="129.5" cy="13.5" r="9.5"></circle><path fill="#FFF" d="M133 13.5l-5 4.5V9"></path><path d="M18.136 19h6.4v-1.648h-4.432V8.216h-1.968V19zm14.068 0c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm11.076-5.056H39.28v4.704c0 .224-.048.432-.112.608-.208.496-.72 1.056-1.504 1.056-1.04 0-1.456-.832-1.456-2.128v-4.24H34.24v4.576c0 2.544 1.296 3.392 2.72 3.392 1.392 0 2.16-.8 2.496-1.36h.032L39.584 19h1.728c-.032-.64-.064-1.408-.064-2.336v-5.456zM43.476 19h1.984v-4.576c0-.224.016-.464.08-.64.208-.592.752-1.152 1.536-1.152 1.072 0 1.488.848 1.488 1.968V19h1.968v-4.624c0-2.464-1.408-3.344-2.768-3.344-1.296 0-2.144.736-2.48 1.344h-.048l-.096-1.168h-1.728c.048.672.064 1.424.064 2.32V19zm14.708-1.696c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zM60.012 19h1.984v-4.656c0-.224.016-.432.08-.592.208-.592.752-1.104 1.52-1.104 1.088 0 1.504.848 1.504 1.984V19h1.968v-4.592c0-2.496-1.392-3.376-2.72-3.376-.496 0-.96.128-1.344.352-.416.224-.736.528-.976.896h-.032V7.64h-1.984V19zm12.264-.512c.592.352 1.776.672 2.912.672 2.784 0 4.096-1.504 4.096-3.232 0-1.552-.912-2.496-2.784-3.2-1.44-.56-2.064-.944-2.064-1.776 0-.624.544-1.296 1.792-1.296 1.008 0 1.76.304 2.144.512l.48-1.584c-.56-.288-1.424-.544-2.592-.544-2.336 0-3.808 1.344-3.808 3.104 0 1.552 1.136 2.496 2.912 3.136 1.376.496 1.92.976 1.92 1.792 0 .88-.704 1.472-1.968 1.472-1.008 0-1.968-.32-2.608-.688l-.432 1.632zm9.076-9.04v1.76h-1.12v1.472h1.12v3.664c0 1.024.192 1.728.608 2.176.368.4.976.64 1.696.64.624 0 1.136-.08 1.424-.192l-.032-1.504c-.176.048-.432.096-.768.096-.752 0-1.008-.496-1.008-1.44v-3.44h1.872v-1.472h-1.872V8.984l-1.92.464zM92.892 19c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm9.556 1.04c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zm3.796-9.664h-1.968V19h1.968v-2.656l.672-.784 2.24 3.44h2.416l-3.296-4.608 2.88-3.184h-2.368l-1.888 2.512c-.208.272-.432.608-.624.912h-.032V7.64z" fill="#000"></path></g></svg></a></div>
`}</HTMLBlock>

If you need to share with a colleague or first review the template you can download a copy [here](https://mcd-public-resources.s3.amazonaws.com/cloudformation/aws_apollo_agent.yaml) ([source](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#can-i-review-agent-resources-and-code)).

You can then use the link below to deploy the OpenTelemetry data store.

<HTMLBlock>{`
<div class="MuiBox-root jss40"><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/quickcreate?templateURL=https%3A%2F%2Fmcd-public-resources.s3.amazonaws.com%2Fcloudformation%2Faws_otel_collector_data_store.yaml&stackName=mcd-otel-store" target="_blank" rel="noopener noreferrer"><svg width="144" height="27" viewBox="0 0 144 27" xmlns="http://www.w3.org/2000/svg"><title>Launch Stack</title><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="a"><stop stop-color="#FFE4B2" offset="0%"></stop><stop stop-color="#F79800" offset="100%"></stop></linearGradient><linearGradient x1="45.017%" y1="100%" x2="68.082%" y2="3.32%" id="b"><stop stop-color="#151443" offset="0%"></stop><stop stop-color="#6D80B2" offset="100%"></stop></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5z" fill="url(#a)"></path><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5zM0 5c0-2.762 2.233-5 5-5h125.5c7.456 0 13.5 6.043 13.5 13.5 0 7.456-6.05 13.5-13.5 13.5H5c-2.762 0-5-2.232-5-5V5z" fill="#0058A5"></path><circle fill="url(#b)" cx="129.5" cy="13.5" r="9.5"></circle><path fill="#FFF" d="M133 13.5l-5 4.5V9"></path><path d="M18.136 19h6.4v-1.648h-4.432V8.216h-1.968V19zm14.068 0c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm11.076-5.056H39.28v4.704c0 .224-.048.432-.112.608-.208.496-.72 1.056-1.504 1.056-1.04 0-1.456-.832-1.456-2.128v-4.24H34.24v4.576c0 2.544 1.296 3.392 2.72 3.392 1.392 0 2.16-.8 2.496-1.36h.032L39.584 19h1.728c-.032-.64-.064-1.408-.064-2.336v-5.456zM43.476 19h1.984v-4.576c0-.224.016-.464.08-.64.208-.592.752-1.152 1.536-1.152 1.072 0 1.488.848 1.488 1.968V19h1.968v-4.624c0-2.464-1.408-3.344-2.768-3.344-1.296 0-2.144.736-2.48 1.344h-.048l-.096-1.168h-1.728c.048.672.064 1.424.064 2.32V19zm14.708-1.696c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zM60.012 19h1.984v-4.656c0-.224.016-.432.08-.592.208-.592.752-1.104 1.52-1.104 1.088 0 1.504.848 1.504 1.984V19h1.968v-4.592c0-2.496-1.392-3.376-2.72-3.376-.496 0-.96.128-1.344.352-.416.224-.736.528-.976.896h-.032V7.64h-1.984V19zm12.264-.512c.592.352 1.776.672 2.912.672 2.784 0 4.096-1.504 4.096-3.232 0-1.552-.912-2.496-2.784-3.2-1.44-.56-2.064-.944-2.064-1.776 0-.624.544-1.296 1.792-1.296 1.008 0 1.76.304 2.144.512l.48-1.584c-.56-.288-1.424-.544-2.592-.544-2.336 0-3.808 1.344-3.808 3.104 0 1.552 1.136 2.496 2.912 3.136 1.376.496 1.92.976 1.92 1.792 0 .88-.704 1.472-1.968 1.472-1.008 0-1.968-.32-2.608-.688l-.432 1.632zm9.076-9.04v1.76h-1.12v1.472h1.12v3.664c0 1.024.192 1.728.608 2.176.368.4.976.64 1.696.64.624 0 1.136-.08 1.424-.192l-.032-1.504c-.176.048-.432.096-.768.096-.752 0-1.008-.496-1.008-1.44v-3.44h1.872v-1.472h-1.872V8.984l-1.92.464zM92.892 19c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm9.556 1.04c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zm3.796-9.664h-1.968V19h1.968v-2.656l.672-.784 2.24 3.44h2.416l-3.296-4.608 2.88-3.184h-2.368l-1.888 2.512c-.208.272-.432.608-.624.912h-.032V7.64z" fill="#000"></path></g></svg></a></div>
`}</HTMLBlock>

## 2. Register the Agent

After deploying the agent you can register either via the Monte Carlo UI or CLI.

And see [here](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#how-do-i-retrieve-registration-input-from-cloudformation-or-terraform) for examples on how to retrieve deployment output (i.e. registration input).

### UI

<Callout icon="👍" theme="okay">
  If you are onboarding a new account, you can also register by following the steps on the onboarding screen
</Callout>

<br />

1. Navigate to [settings/integrations/agents](https://getmontecarlo.com/settings/integrations/agents) and select the `Create` button.
2. Follow the onscreen wizard for the "AWS" Platform and "Data Store + Agent" Type.

<Image align="center" alt="Monte Carlo Registration Wizard UI Example" border={true} caption="Monte Carlo Registration Wizard UI Example" src="https://files.readme.io/31bbffb-agent-aws.png" />

### CLI

Use `montecarlo agents register-aws-agent` to register.

See reference documentation [here](https://clidocs.getmontecarlo.com/#montecarlo-agents-register-aws-agent). And see [here](https://docs.getmontecarlo.com/docs/using-the-cli) for how to install and configure the CLI. For instance:

```shell Example
montecarlo agents register-aws-agent \
  --lambda-arn arn:aws:lambda:us-east-1:123456789:function:mcd-agent-AgentLambda \
  --assumable-role arn:aws:iam::123456789:role/mcd-agent-InvocationRole-12345 \
  --external-id f3840b31-772e-4fe3-8a5f-3aa5ff7e6fec
```

## 3. Configure your Data Warehouse Ingestion Pipeline

<Callout icon="📘" theme="info">
  **Prerequisite: Data Warehouse S3 Access Configuration**

  Before continuing, your data warehouse must be configured to access the AWS S3 bucket containing the OpenTelemetry trace data. If your data warehouse is not currently configured to access the S3 bucket, refer to the guides below for Monte Carlo's recommendation on how to configure S3 access in your data warehouse.

  | Warehouse Vendor | Guide                                                                                                                                                                                              |
  | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Snowflake        | [Configure Snowflake Storage Integration and Stage](https://docs.getmontecarlo.com/docs/configure-snowflake-otel-collector#how-can-i-create-a-aws-s3-data-ingestion-pipeline-to-my-data-warehouse) |
  | Databricks       | [Configure Databricks External Location](https://docs.getmontecarlo.com/docs/aws-databricks-configuration-example#/how-can-i-create-a-aws-s3-data-ingestion-pipeline-to-my-data-warehouse)         |
  | Athena           | N/A                                                                                                                                                                                                |
</Callout>

Next, we need to configure your data ingestion pipeline to write the OpenTelemetry trace data from S3 to your data warehouse so it can be monitored by Monte Carlo. Follow the guide relevant to your data warehouse vendor for steps on how to configure this pipeline.

| Warehouse Vendor | Guide                                                                                                                                                   |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Snowflake        | [Configure Snowflake Snowpipe](https://docs.getmontecarlo.com/docs/configure-snowflake-otel-collector)                                                  |
| Databricks       | [Configure Databricks Delta Live Table](https://docs.getmontecarlo.com/docs/aws-databricks-configuration-example#configure-databricks-delta-live-table) |
| Athena           | [Configure Glue Crawler](https://docs.getmontecarlo.com/docs/aws-athena-configuration#deploy-athena-aws-resources)                                      |

## 4. Configure your AI Agent

Congrats! You have now configured the Monte Carlo Agent and OpenTelemetry Collector to process traces from your AI agent and write them to your data warehouse.

The final step is to configure your AI agent to begin sending traces to the OpenTelemetry Collector.

1. Add the [Monte Carlo OpenTelemetry SDK](https://pypi.org/project/montecarlo_opentelemetry/) to your AI agent's source code.
2. Use the `OpenTelemetryCollectorHTTPEndpoint` output from the CloudFormation stack deployed earlier, with `/v1/traces` appended (for example, `http://<collector-endpoint>/v1/traces`), as the URL to provide to the Monte Carlo OpenTelemetry SDK's `otlp_endpoint` parameter. If you instead configure the endpoint through the standard `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable, use the output as-is — the OpenTelemetry exporter appends `/v1/traces` to that variable automatically.
3. Follow the Monte Carlo OpenTelemetry SDK library's instructions to configure instrumentation.

You can now validate the deployment is working as expected by observing files being written to the S3 bucket and data being ingested into the relevant table in your warehouse.

You can begin creating Agent Monitors in Monte Carlo following the instructions [here](https://docs.getmontecarlo.com/docs/agent-monitors-overview).

# FAQs

## What if I already deployed the Monte Carlo Agent?

If you already have the Monte Carlo Agent deployed to your cloud vender, you can deploy the OpenTelemetry Collector separately alongside it via CloudFormation.

Before getting started please review the Monte Carlo AWS account your collection service is hosted in.

When provisioning resources for Monte Carlo deployments on the [V2 Platform](https://docs.getmontecarlo.com/docs/deployment-and-connecting#how-do-i-check-which-version-of-the-platform-or-deployments-i-am-using), use the Collection **AWS account id** provided in the [Account information](https://getmontecarlo.com/account-info#collection) page. Accounts created after April 24th, 2024, will automatically be on the V2 platform or newer.

If you are using an older version of the platform, please contact your Monte Carlo representative for the ID.

Specifying a VPC is required to run the collector and enables certain connectivity scenarios like when you have an IP allowlist for your resource, want to peer, or deploy in your existing VPC. See more details [here](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#can-i-further-constraint-outbound-access-egress-from-the-agent). Be sure to use the same VPC associated to your Monte Carlo Agent.

You can use the quick-create link below to deploy the OpenTelemetry Collector in your AWS account alongside your existing Agent:

<HTMLBlock>{`
<div class="MuiBox-root jss40"><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/quickcreate?templateURL=https%3A%2F%2Fmcd-public-resources.s3.amazonaws.com%2Fcloudformation%2Faws_otel_collector_ecs.yaml&stackName=mcd-agent" target="_blank" rel="noopener noreferrer"><svg width="144" height="27" viewBox="0 0 144 27" xmlns="http://www.w3.org/2000/svg"><title>Launch Stack</title><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="a"><stop stop-color="#FFE4B2" offset="0%"></stop><stop stop-color="#F79800" offset="100%"></stop></linearGradient><linearGradient x1="45.017%" y1="100%" x2="68.082%" y2="3.32%" id="b"><stop stop-color="#151443" offset="0%"></stop><stop stop-color="#6D80B2" offset="100%"></stop></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5z" fill="url(#a)"></path><path d="M2 5v17c0 1.66 1.34 3 3 3h125.5c6.348 0 11.5-5.15 11.5-11.5C142 7.148 136.852 2 130.5 2H5C3.34 2 2 3.34 2 5zM0 5c0-2.762 2.233-5 5-5h125.5c7.456 0 13.5 6.043 13.5 13.5 0 7.456-6.05 13.5-13.5 13.5H5c-2.762 0-5-2.232-5-5V5z" fill="#0058A5"></path><circle fill="url(#b)" cx="129.5" cy="13.5" r="9.5"></circle><path fill="#FFF" d="M133 13.5l-5 4.5V9"></path><path d="M18.136 19h6.4v-1.648h-4.432V8.216h-1.968V19zm14.068 0c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm11.076-5.056H39.28v4.704c0 .224-.048.432-.112.608-.208.496-.72 1.056-1.504 1.056-1.04 0-1.456-.832-1.456-2.128v-4.24H34.24v4.576c0 2.544 1.296 3.392 2.72 3.392 1.392 0 2.16-.8 2.496-1.36h.032L39.584 19h1.728c-.032-.64-.064-1.408-.064-2.336v-5.456zM43.476 19h1.984v-4.576c0-.224.016-.464.08-.64.208-.592.752-1.152 1.536-1.152 1.072 0 1.488.848 1.488 1.968V19h1.968v-4.624c0-2.464-1.408-3.344-2.768-3.344-1.296 0-2.144.736-2.48 1.344h-.048l-.096-1.168h-1.728c.048.672.064 1.424.064 2.32V19zm14.708-1.696c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zM60.012 19h1.984v-4.656c0-.224.016-.432.08-.592.208-.592.752-1.104 1.52-1.104 1.088 0 1.504.848 1.504 1.984V19h1.968v-4.592c0-2.496-1.392-3.376-2.72-3.376-.496 0-.96.128-1.344.352-.416.224-.736.528-.976.896h-.032V7.64h-1.984V19zm12.264-.512c.592.352 1.776.672 2.912.672 2.784 0 4.096-1.504 4.096-3.232 0-1.552-.912-2.496-2.784-3.2-1.44-.56-2.064-.944-2.064-1.776 0-.624.544-1.296 1.792-1.296 1.008 0 1.76.304 2.144.512l.48-1.584c-.56-.288-1.424-.544-2.592-.544-2.336 0-3.808 1.344-3.808 3.104 0 1.552 1.136 2.496 2.912 3.136 1.376.496 1.92.976 1.92 1.792 0 .88-.704 1.472-1.968 1.472-1.008 0-1.968-.32-2.608-.688l-.432 1.632zm9.076-9.04v1.76h-1.12v1.472h1.12v3.664c0 1.024.192 1.728.608 2.176.368.4.976.64 1.696.64.624 0 1.136-.08 1.424-.192l-.032-1.504c-.176.048-.432.096-.768.096-.752 0-1.008-.496-1.008-1.44v-3.44h1.872v-1.472h-1.872V8.984l-1.92.464zM92.892 19c-.08-.48-.112-1.168-.112-1.872v-2.816c0-1.696-.72-3.28-3.216-3.28-1.232 0-2.24.336-2.816.688l.384 1.28c.528-.336 1.328-.576 2.096-.576 1.376 0 1.584.848 1.584 1.36v.128c-2.88-.016-4.624.976-4.624 2.944 0 1.184.88 2.32 2.448 2.32 1.008 0 1.824-.432 2.304-1.04h.048l.128.864h1.776zm-2.032-2.736c0 .128-.016.288-.064.432-.176.56-.752 1.072-1.536 1.072-.624 0-1.12-.352-1.12-1.12 0-1.184 1.328-1.488 2.72-1.456v1.072zm9.556 1.04c-.384.16-.864.304-1.552.304-1.344 0-2.384-.912-2.384-2.512-.016-1.424.88-2.528 2.384-2.528.704 0 1.168.16 1.488.304l.352-1.472c-.448-.208-1.184-.368-1.904-.368-2.736 0-4.336 1.824-4.336 4.16 0 2.416 1.584 3.968 4.016 3.968.976 0 1.792-.208 2.208-.4l-.272-1.456zm3.796-9.664h-1.968V19h1.968v-2.656l.672-.784 2.24 3.44h2.416l-3.296-4.608 2.88-3.184h-2.368l-1.888 2.512c-.208.272-.432.608-.624.912h-.032V7.64z" fill="#000"></path></g></svg></a></div>
`}</HTMLBlock>

If you need to share with a colleague or first review the template you can download a copy [here](https://mcd-public-resources.s3.amazonaws.com/cloudformation/aws_otel_collector_ecs.yaml) ([source](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#can-i-review-agent-resources-and-code)).

![](https://files.readme.io/153c87a9ab4d66d1f6d48e5caa7b0ffeaeb9ae8aef58741d658878187c42d1c2-image.png)

<br />

When provisioning resources for Monte Carlo deployments on the [V2 Platform](https://docs.getmontecarlo.com/docs/deployment-and-connecting#how-do-i-check-which-version-of-the-platform-or-deployments-i-am-using), use the Collection **AWS account id** provided in the [Account information](https://getmontecarlo.com/account-info#collection) page. Accounts created after April 24th, 2024, will automatically be on the V2 platform or newer.

If you are using an older version of the platform, please contact your Monte Carlo representative for the ID.

Note that the AWS account ID is not the same account where you will deploy the agent. It is important to make sure this ID is the one you select as the "Monte Carlo AWS Account ID" parameter when deploying the agent as registration will fail otherwise.

<br />

<Callout icon="📘" theme="info">
  Note: by default the OpenTelemetry Collector deployed with the Monte Carlo Agent will only allow ingress from resources associated with the SecurityGroup created by the CF template. You might need to provide the `ExistingSecurityGroupId` parameter to the stack in order for the OpenTelemetry Collector to receive incoming traces from your Agent. These SecurityGroup definition will vary depend on your network configuration.
</Callout>

You will be required to specify the ARN of the existing bucket to store telemetry trace data in parameter `TelemetryDataBucketArn`.

Continue with [Step 3](https://docs.getmontecarlo.com/docs/create-aws-agent-with-otel-collector-cf#3-configure-your-data-warehouse-ingestion-pipeline) above.

## Can I review agent resources and code?

Absolutely! You can find details here:

| Component                    | Target                                                                                                     | Repository                                                                                                                        |
| :--------------------------- | :--------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
| **Code**                     | <https://hub.docker.com/r/montecarlodata/agent>\*                                                          | <https://github.com/monte-carlo-data/apollo-agent>                                                                                |
| **CloudFormation Resources** | <https://mcd-public-resources.s3.amazonaws.com/cloudformation/aws_agent_with_opentelemetry_collector.yaml> | <https://github.com/monte-carlo-data/mcd-iac-resources#monte-carlos-agent-template-for-customer-hosted-deployments-in-aws-source> |

\*Note that due to an AWS limitation the agent image is also uploaded and then sourced from AWS ECR when executed on Lambda.

Repository: `590183797493.dkr.ecr.*.amazonaws.com/mcd-agent`

## Additional FAQs?

Other applicable FAQs for deploying the Monte Carlo Agent to AWS can be found [here](https://docs.getmontecarlo.com/docs/create-and-register-an-aws-agent#faqs).