> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS CloudTrail Lake

> This topic explains how to configure the AWS CloudTrail Lake integration for LaunchDarkly.

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

<Note title="The AWS CloudTrail Lake integration is available to customers on select plans">
  The AWS CloudTrail Lake integration is only available to customers on select plans. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/).
</Note>

## Overview

This topic explains how to configure and use CloudTrail Lake integration for LaunchDarkly.

The CloudTrail Lake integration lets you configure [CloudTrail](https://aws.amazon.com/cloudtrail/) to receive any activity from LaunchDarkly and then store data in a [CloudTrail Lake](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake.html). When something changes, such as a feature flag updates or a new account member is added to LaunchDarkly, LaunchDarkly sends an event to CloudTrail.

In a few steps, you can consolidate your LaunchDarkly activity events together with AWS activity events in CloudTrail without having to build or manage the event data pipeline.

## Set up the Cloud

Trail integration in LaunchDarklyTo connect CloudTrail Lake to LaunchDarkly, you need to configure the LaunchDarkly CloudTrail Lake integration to send events to a CloudTrail Channel to be stored in a CloudTrail Lake.

To configure the integration:

1. Click the **gear** icon in the left sidenav to view Organization settings.
2. Click **Integrations** and find "AWS CloudTrail Lake."
3. Click **Add integration**. The "Create AWS CloudTrail Lake configuration" panel appears.
4. (Optional) Give your integration a human-readable **Name**.
5. Click on the auto generated **External Id** value to copy it.
6. Navigate to the [Configure the LaunchDarkly integration in AWS](#configure-the-launchdarkly-integration-in-aws) section in this documentation and follow the steps to create a "Channel ARN" with the external ID.
7. Enter the channel ARN into the **Channel ARN** field. You created this channel ARN in the previous step.
8. (Optional) Configure a custom policy to control which events LaunchDarkly sends to CloudTrail. To learn more, read [Filter the events you send to CloudTrail](#filter-the-events-you-send-to-cloudtrail).
9. After reading the Integration Terms and Conditions, check the **I have read and agree to the Integration Terms and Conditions** checkbox.
10. Click **Save configuration**.The new integration appears on the Integrations page. It is switched **On** by default.

## Configure the Launch

Darkly integration in AWS

<Note title="Prerequisite">
  An external ID is required to configure the integration in AWS. Follow the steps outlined in the [Set up the CloudTrail integration in LaunchDarkly](#set-up-the-cloudtrail-integration-in-launchdarkly) section to obtain an external ID from LaunchDarkly.
</Note>

1. In the AWS Console, go to the **CloudTrail** dashboard and expand the **Lake** section on the side navigation.
2. Click on **Integrations**.
3. Click the **Add integration** button. The **Add integration** page appears.
4. Enter your integration name and select the "LaunchDarkly" option from the **Source** menu.

<Frame caption="The &#x22;Add CloudTrail Integration&#x22; form.">
  ![The "Add CloudTrail Integration" form.](https://files.buildwithfern.com/https://launchdarkly.docs.buildwithfern.com/docs/442256eb92dd5761157ae61b59fc67dc400ea224e3ec2396b36c539d21c64071/assets/images/__third_party/cloudtrail-add-integration-form.png)
</Frame>

5. Scroll down to the **Event delivery location** and select a destination for your events from LaunchDarkly. You can choose to use an existing data store or select "Create new event data store."

<Frame caption="The &#x22;Event delivery location&#x22; form.">
  ![The "Event delivery location" form.](https://files.buildwithfern.com/https://launchdarkly.docs.buildwithfern.com/docs/6fd50f67a9cdcc01626f64c4f96cb2f0f571b565ba3993def1b3b42a9a8a8afd/assets/images/__third_party/cloudtrail-event-delivery-location.png)
</Frame>

6. Scroll down to the **Resource Policy** section and enter the LaunchDarkly external ID into the "External ID" field. LaunchDarkly created the external ID automatically when you [set up the CloudTrail integration in LaunchDarkly](#set-up-the-cloudtrail-integration-in-launchdarkly).

<Frame caption="The &#x22;CloudTrail Resource Policy&#x22; form.">
  ![The "CloudTrail Resource Policy" form.](https://files.buildwithfern.com/https://launchdarkly.docs.buildwithfern.com/docs/03ee4fb891896881a82e73321c13edb3c30a29d0454f14f55d45edd78553aa92/assets/images/__third_party/cloudtrail-resource-policy.png)
</Frame>

7. Click the **Add integration** button. The Console navigates to the created integration's detail page.
8. Copy the **Channel ARN**. You need this ARN to create to complete configuring the integration in LaunchDarkly.
9. Follow the steps outlined in the [Set up the CloudTrail integration in LaunchDarkly](#set-up-the-cloudtrail-integration-in-launchdarkly) section to complete your setup. For detailed instructions on how to set up CloudTrail, read the [AWS CloudTrail documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html).

## Filter the events you send to Cloud

TrailBy default, LaunchDarkly sends events to CloudTrail for changes made to any feature flag in a production environment. If you have a more limited use case, or you wish to expand or restrict which data you send to CloudTrail, you can filter which events LaunchDarkly sends.

To filter events, write a policy using the same syntax as the [role policy builder](/home/account/roles/role-create#create-policies-for-roles) to filter the events sent to CloudTrail.

For more information about writing policies, read [Using policies](/home/account/roles/role-policies).

For example, if you only want to receive an event when a change is made to one of the feature flags in your testing environment, you can add the following policy to your events stream:

<CodeGroup>
  ```json title="Example CloudTrail policy" theme={null}
      [
        {
          "effect": "allow",
          "actions": ["*"],
          "resources": ["proj/*:env/your-test-environment:flag/*"]
        }
      ]
  ```
</CodeGroup>

To add a custom filter:

1. Navigate to the **Integrations** page and find "AWS CloudTrail Lake."
2. Click the **Expand** arrow.
3. Next to the configuration you want to edit, click the **Overflow** menu and select **Edit integration configuration**. The "Edit AWS CloudTrail Lake configuration" panel appears.

<Frame caption="The &#x22;AWS CloudTrail Lake&#x22; section with the &#x22;Edit integration configuration&#x22; option called out.">
  ![The "AWS CloudTrail Lake" section with the "Edit integration configuration" option called out.](https://files.buildwithfern.com/https://launchdarkly.docs.buildwithfern.com/docs/cac65024c5c211869af6c31fb13ec67c05fc9abc395ce9aeca9f4ff54929d155/assets/images/auto/cloudtrail-integration-edit-callout.auto.png)
</Frame>

3. Click **Advanced editor**. The Advanced editor appears.
4. Enter your custom policy.
5. Click **Save configuration**.
6. Verify that LaunchDarkly is sending a customized set of events by viewing the events in CloudTrail Lake.

## Disable the Cloud

Trail Lake integration

<Note title="Deleting AWS resources">
  The steps below only disable the integration in your LaunchDarkly account. To learn how to delete the integration in your AWS account, read the [AWS CloudTrail documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html).
</Note>

You can either disable or delete the CloudTrail Lake integration:

* **Disable the integration** to pause the flow of events to CloudTrail, but leave the connection between CloudTrail and LaunchDarkly intact.
* **Delete the integration** to cease all event export and break the connection between CloudTrail and LaunchDarkly. To temporarily disable the CloudTrail Lake integration:

1. Navigate to the **Integrations** page and find the CloudTrail Lake integration you wish to disable.

2. Click the **Edit integration configuration** button. The "Edit AWS CloudTrail Lake configuration" panel appears.

3. Toggle to turn the integration **Off**.To permanently delete the CloudTrail Lake integration:

4. Navigate to the **Integrations** page and find the integration you wish to modify.

5. Click **Edit integration configuration**. The "Edit AWS CloudTrail Lake configuration" panel appears.

6. Click **Delete** in the "Delete configuration" section. A confirmation dialog appears.

7. Click **Delete**.
