

# AWS Cloud WAN prefix list associations
<a name="cloudwan-prefix-lists"></a>

You can use customer managed prefix lists in your Cloud WAN routing policy to simplify rules management. You need to associate your prefix list with the core network with the create-core-network-prefix-list-association API. The prefix list must be defined in the Cloud WAN home region (us-west-2). Although defined in Cloud WAN home region, the prefix-list based policy will apply globally to all the relevant core network edges (regions) in your core network.

Before you can create a prefix list association, you must first have created a prefix list. For more information about creating prefix lists, see [Consolidate and manage network CIDR blocks with managed prefix lists](https://docs.aws.amazon.com/vpc/latest/userguide/managed-prefix-lists.html) in the *Amazon Virtual Private Cloud User Guide*.

**Note**  
Creating or deleting prefix list associations will move the state of your core network to updating. The status of the association is based on the core network state, once it is finished updating the association will either be fully available or deleted. 

# Create a AWS Cloud WAN prefix list association
<a name="create-prefix-list-association"></a>

## Create a prefix list association using the console
<a name="create-prefix-list-association-console"></a>

1. Access the Network Manager console at [https://console.aws.amazon.com/networkmanager/home/](https://console.aws.amazon.com/networkmanager/home).

1. Under **Connectivity**, choose **Global networks**.

1. On the **Global networks** page, choose the global network ID.

1. Under **Core network** in the navigation pane, choose **Prefix list associations**.

1. Choose **Create prefix list association**.

1. For **Prefix list ARN**, enter the ARN of the prefix list you want to create an association for. 

1. For **Core Network Id **field, enter the id of the core network you want to associate a prefix list to.

1. In the **Prefix list alias **field, enter a name you want associated with the prefix list ARN.

1. Choose **Create prefix list association**.

## Create a prefix list association using the AWS CLI
<a name="create-prefix-list-association-cli"></a>

Use the **create-core-network-prefix-list-association** command.

Required parameters:
+ `--core-network-id` - The ID of your Cloud WAN core network
+ `--prefix-list-arn` - The ARN of the prefix list to associate
+ `--prefix-list-alias` - A human-readable alias for the prefix list association

The following command creates a prefix list association for the specified core network and prefix list:

```
aws networkmanager create-core-network-prefix-list-association \
    --core-network-id core-network-0123456789abcdef0 \
    --prefix-list-arn arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0 \
    --prefix-list-alias "corporate-networks"
```

The command returns the following output:

```
{
    "CoreNetworkPrefixListAssociation": {
        "CoreNetworkId": "core-network-0123456789abcdef0",
        "PrefixListArn": "arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0",
        "PrefixListAlias": "corporate-networks"
    }
}
```

## Create a prefix list association using the API
<a name="create-prefix-list-association-api"></a>

Use the [CreateCoreNetworkPrefixListAssociation](https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_CreateCoreNetworkPrefixListAssociation.html) operation.

Required parameters:
+ `CoreNetworkId` - The ID of your Cloud WAN core network
+ `PrefixListArn` - The ARN of the prefix list to associate
+ `PrefixListAlias` - A human-readable alias for the prefix list association

The following HTTP request creates a prefix list association:

```
POST /core-networks/core-network-0123456789abcdef0/prefix-list-arn/arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0/prefix-list-alias/corporate-networks HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: NetworkManager.CreateCoreNetworkPrefixListAssociation

{
    "CoreNetworkId": "core-network-0123456789abcdef0",
    "PrefixListArn": "arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0",
    "PrefixListAlias": "corporate-networks"
}
```

The API returns the following response:

```
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1

{
    "CoreNetworkPrefixListAssociation": {
        "CoreNetworkId": "core-network-0123456789abcdef0",
        "PrefixListArn": "arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0",
        "PrefixListAlias": "corporate-networks"
    }
}
```

# Delete an AWS Cloud WAN prefix list association
<a name="delete-prefix-list-association"></a>

**Note**  
Before you can delete a core network prefix list association you must remove any prefix list alias that is referred to in the associated core network policy before the delete call will work.

## Delete a prefix list association using the console
<a name="delete-prefix-list-association-console"></a>

1. Access the Network Manager console at [https://console.aws.amazon.com/networkmanager/home/](https://console.aws.amazon.com/networkmanager/home).

1. Under **Connectivity**, choose **Global networks**.

1. On the **Global networks** page, choose the global network ID.

1. Under **Core network** in the navigation pane, choose **Prefix list associations**.

1. Select the prefix list association you want to delete.

1. Choose **Delete**.

1. Confirm the deletion by choosing **Delete**.

## Delete a prefix list association using the AWS CLI
<a name="delete-prefix-list-association-cli"></a>

Use the **delete-core-network-prefix-list-association** command.

Required parameters:
+ `--core-network-id` - The ID of your Cloud WAN core network
+ `--prefix-list-arn` - The ARN of the prefix list association to delete

The following command deletes a prefix list association for the specified core network and prefix list:

```
aws networkmanager delete-core-network-prefix-list-association \
    --core-network-id core-network-0123456789abcdef0 \
    --prefix-list-arn arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0
```

The command returns the following output:

```
{
    "CoreNetworkPrefixListAssociation": {
        "CoreNetworkId": "core-network-0123456789abcdef0",
        "PrefixListArn": "arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0"
    }
}
```

## Delete a prefix list association using the API
<a name="delete-prefix-list-association-api"></a>

Use the [DeleteCoreNetworkPrefixListAssociation](https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_DeleteCoreNetworkPrefixListAssociation.html) operation.

Required parameters:
+ `CoreNetworkId` - The ID of your Cloud WAN core network
+ `PrefixListArn` - The ARN of the prefix list to delete

The following HTTP request deletes a prefix list association:

```
DELETE /core-networks/core-network-0123456789abcdef0/prefix-list-arn/arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0 HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: NetworkManager.DeleteCoreNetworkPrefixListAssociation
```

The API returns the following response:

```
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1

{
    "CoreNetworkPrefixListAssociation": {
        "CoreNetworkId": "core-network-0123456789abcdef0",
        "PrefixListArn": "arn:aws:ec2:us-west-2:123456789012:prefix-list/pl-0123456789abcdef0"
    }
}
```