# Networks and VPC peering

```json metadata
{
  "schema_version": 3,
  "title": "Networks and VPC peering",
  "description": "Create the network your databases run in, and peer it with a VPC in your AWS account.",
  "categories": ["docs","operate","ultra"],
  "tableOfContents": {"sections":[{"children":[{"id":"deployment-cidr-rules","title":"Deployment CIDR rules"}],"id":"create-a-network","title":"Create a network"},{"children":[{"id":"remove-vpc-peering","title":"Remove VPC peering"}],"id":"set-up-vpc-peering","title":"Set up VPC peering"},{"id":"rename-or-delete-a-network","title":"Rename or delete a network"}]}

,
  "codeExamples": []
}
```


A network is a cloud, a region, and a Classless Inter-Domain Routing (CIDR) block that your databases run in. All the projects in your account share it. To reach your databases from a virtual private cloud (VPC) in your Amazon Web Services (AWS) account, peer the network with that VPC.

Your account can have up to two networks during the preview.



## Create a network

The console creates a network for you the first time you create a database. To create one yourself:

1. In the [Ultra console](https://cloud.redis.io/#/ultra), select **Networking**, then select **Create network**.
1. Select a **Cloud vendor** and **Region**.
1. Under **Allowed availability zones**, keep **No preference**, or select **Manual selection** and select the **Zone IDs**.
1. Optional: enter a **Network name**. Use up to 64 letters, digits, spaces, hyphens, or underscores, starting and ending with a letter or digit.
1. Optional: enter a **Deployment CIDR**. Leave it empty to have one assigned.
1. Select **Create network**.



A network with an assigned CIDR block is usually ready in seconds. A custom CIDR block takes 10 to 20 minutes to set up.

### Deployment CIDR rules

A custom **Deployment CIDR** must be:

- A /18 block, such as `10.0.0.0/18`. When you create the network from the database create page, enter the address only: the console adds `/18`.
- In a private IPv4 range.
- Aligned to its first address, such as `10.0.0.0`.

You can't change the CIDR block after the network is created. Choose one that doesn't overlap the VPCs you plan to peer with. The **CIDR** column on the **Networking** page shows the block a network uses.

## Set up VPC peering

VPC peering connects the network to a VPC in your AWS account, so your applications can reach your databases' private endpoints. You can add VPC peering when the network's status is **Active**.

Before you begin, make sure your VPC has the `enableDnsHostnames` and `enableDnsSupport` attributes turned on, and that its CIDR block doesn't overlap the network's.

1. Select **Networking**, then select the network.
1. Select the **Attachments** tab, then select **Add VPC peering**.
1. Enter your 12-digit **AWS account ID**.
1. Enter the **VPC ID**, such as `vpc-0123456789abcdef0`.
1. If the console shows **VPC region**, select your VPC's region.
1. Enter the **VPC CIDR**: an IPv4 block from /16 to /28.
1. Select **Add peering**.
1. In your AWS account, accept the VPC peering request from Redis. The attachment shows **Provisioning** until you accept it and **Active** once the peering is up. If you reject the request or let it expire, the attachment fails.
1. In your VPC's route tables, add a route to the network's CIDR block through the peering connection.
1. Associate the database's private hosted zone with your VPC. Copy the **Private DNS hosted-zone ID** from the database's **Connectivity** tab, then run:

    ```sh
    aws route53 associate-vpc-with-hosted-zone \
      --hosted-zone-id <hosted-zone-id> \
      --vpc VPCRegion=<your-vpc-region>,VPCId=<your-vpc-id>
    ```

    Until you associate the zone, the private endpoint's name doesn't resolve from your VPC.






You can also set up VPC peering from the database's page: select **Set up VPC peering** in the database header. The console offers it when the database's AWS network has no VPC peering yet, and opens it for you after you create a database.

### Remove VPC peering

1. On the network's **Attachments** tab, open the menu on the peering's row and select **Remove**.
1. Select **Remove** to confirm. Applications that use the peering lose access to the network's databases.

You can't remove VPC peering while the network has databases. Delete the databases first.



## Rename or delete a network

To rename a network, select **Rename** from its menu on the **Networking** page.

To delete a network, select **Delete** from its menu. You can't delete a network that still has databases. Delete them first.

