# AWS Relationship Auto-Creation

We're excited to offer early access to a limited group of customers so we can incorporate feedback and ensure the experience scales well before making it generally available. If you would like to request access, please reach out to your account team.

## What's new

Two new capabilities reduce the manual work of modeling your AWS footprint in Cortex:

* **AWS account entities and account-to-resource relationships** - Enable a setting on your AWS integration to automatically create an entity for each AWS account and link it to its resources.
* **Tag-based auto-linking** - Configure a relationship type to auto-link AWS resources to other Cortex entities (such as domains or services) based on AWS tag values.

Together, these eliminate the need to manually create AWS account entities or hand-author YAML to connect AWS resources to the rest of your catalog.

### Auto-creating AWS account entities

When enabled, Cortex automatically creates an entity for each AWS account connected to your integration and links it to its AWS resources through a built-in, Cortex-managed relationship.

**To enable AWS account auto-creation**:

1. From the main sidebar, select **Integrations**.
2. Locate AWS, then click **Settings**.
3. Select the **Integration settings** tab.<br>

   <div align="left" data-with-frame="true"><figure><img src="/files/ELzEO1Nr7APyIfo0tWph" alt="The &#x27;Integration settings&#x27; tab within the AWS settings in Cortex." width="375"><figcaption></figcaption></figure></div>
4. Scroll to **Accounts as entities**, then toggle on **Import** **AWS accounts as entities**.<br>

   <div align="left" data-with-frame="true"><figure><img src="/files/JuASWCDPcW2WEQkNVYtb" alt="The &#x27;Import AWS accounts as entities&#x27; toggle in Cortex." width="375"><figcaption></figcaption></figure></div>

Once enabled:

* Cortex creates an **AWS Account** entity for each account that has been configured in Cortex.
* Each AWS resource is automatically linked to its parent account through a Cortex-managed relationship.

**To view your AWS account entities**:

1. From the main sidebar, expand **Catalogs**.
2. Select **All entities**, then select the **Entity types** tab.
3. Search for **AWS account**.<br>

   <div align="left" data-with-frame="true"><figure><img src="/files/h5qq1d4G6lnrkwQYjwIC" alt="&#x27;AWS account&#x27; appears in the Search box." width="375"><figcaption></figcaption></figure></div>
4. Select an entity type.
5. Select an entity.
6. From the **Catalog** menu, select the **Relationships** tab.<br>

   <div align="left" data-with-frame="true"><figure><img src="/files/jcfQ6M0MdRb9tidcswV4" alt="The Relationships graph shows the relationships of the selected AWS entity." width="375"><figcaption></figcaption></figure></div>

As new accounts are configured and resources are discovered, entities and relationships stay in sync automatically.

### Tag-based auto-linking for AWS backed-entities

You can configure any relationship type to auto-link AWS resources to other Cortex entities based on matching tag values. This is the recommended way to connect AWS resources to domains, services, or custom entities within Cortex for modeling your architecture.

**To configure tag-based auto-linking**:

1. From the main sidebar, expand **Catalogs**.
2. Select **All entities**, then select the **Relationship types** tab.
3. Locate the relationship type you want to configure, then click the **pencil icon**. You can also [create a new relationship type](/ingesting-data-into-cortex/entities-overview/entities/defining-relationship-types.md).
4. Scroll to the **Auto-creation of relationships** section.

   > **Note**: For this section to appear, you must select at least one AWS-backed entity type as the source and/or destination.
5. From the **Provider** drop-down menu, select **AWS**.
6. Configure the **Source tag key** by doing one of the following:
   * Enter the AWS tag key on the source entity (e.g. `cortex-entity-tag`) OR
   * Toggle on **Cortex provided tag** to use Cortex's standardized tag. Toggle this on to use Cortex's managed entity tag key instead of specifying your own.
7. Configure the **Destination tag key** by doing one of the following:
   * Enter the tag key on the destination entity (e.g. `AWS-tag-parent`) OR
   * Toggle on **Cortex provided tag** to use Cortex's standardized tag. Toggle this on to use Cortex's managed entity tag key instead of specifying your own.
8. Click **Save** (or C**reate** if it's a new relationship type).<br>

   <div align="left" data-with-frame="true"><figure><img src="/files/RvDdd5yoKLWCT7NIzNRd" alt="The &#x27;Auto-creation of relationships&#x27; section." width="375"><figcaption></figcaption></figure></div>

Cortex scans entities matching the relationship type's source and destination definitions and creates a relationship wherever tag values match.

**Example: Linking AWS resources to domains**

To roll AWS resources up to a domain for scorecard reporting:

1. Tag your AWS resources with the domain they belong to (e.g. a `domain` tag with the domain's identifier).
2. Create or open a relationship type with AWS resources as the source and domains as the destination.
3. In the **Auto-creation of relationships** section, set the source tag key to `domain` and the destination tag key to the corresponding identifier on your domain entities.
4. Click **Save**. Cortex creates the relationships automatically.

You can now report on scorecards rolled up by domain across your AWS infrastructure.

### Limitations

* Auto-creation currently supports AWS only. Additional providers coming soon.
* Tag changes in AWS may take up to one (1) sync cycle to reflect in Cortex.


---

# Agent Instructions: 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:

```
GET https://docs.cortex.io/resources/beta/aws-relationship-auto-creation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
