Creating an Azure vNet Peering Connection

Since security is vital in Hazelcast Cloud Enterprise, your clusters are installed within a private "Virtual Network" and can not be accessed unless you choose "Public Access" on cluster creation. So to connect private Azure Hazelcast Clusters, you need to establish a vNet peering connection between your network and Hazelcast Cluster network.

Before you Begin

Download the Hazelcast Cloud CLI from Github.

Download the Azure CLI and make sure you have the correct permissions.

To create a peering connection on a team cluster, you must have either an admin or developer role. See Managing Teams and Users.

Creating a Peering Connection

  1. Create the peering connection.

    hzcloud azure-peering create \
    --cluster-id={YOUR_CLUSTER_ID} \
    --tenant-id={YOUR_TENANT_ID} \
    --subscription-id={YOUR_SUBSCRIPTION_ID} \
    --resource-group={YOUR_RESOURCE_GROUP} \
    --vnet={YOUR_VNET_NAME}

    Make sure to replace the following placeholders:

    • YOUR_CLUSTER_ID with the ID of your cluster.

      To get your cluster ID, use the hzcloud enterprise-cluster list command of the Hazelcast Cloud CLI.

    • YOUR_TENANT_ID with the ID of your tenant which contains your subscription.

      To get your tenant ID, use the az account list command of the Azure CLI.

    • YOUR_SUBSCRIPTION_ID with the ID of your subscription which contains your resource group.

      To get your subscription ID, use the az account list command of the Azure CLI.

    • YOUR_RESOURCE_GROUP with the Name of your resource group which contains your vNet.

      To get your resource group name, use the az network vnet list command of the Azure CLI.

    • YOUR_VNET_NAME with the name of your Virtual Network that you will make vNet peering.

      To get your vnet name, use the az network vnet list command of the Azure CLI.

      This command will create a service principal on your account and assign the Network Contributor role to it. Then, it will create peering for both sides (Hazelcast’s, Your’s). This command may take up to 5 minutes to finish.

      Create a new peering

      The CIDR of your Hazelcast Cloud Enterprise Cluster and the CIDR of your VPC should not be overlapped otherwise, it will fail.
  2. Check for active peerings from the Peerings tab after you select your Virtual Network on Azure for your side of peering. You can filter by its peer, which will be cl-<CLUSTER_ID>. On the example below, it is cl53949 because the cluster ID was 53949

    Check that your peering status is connected

Listing Peering Connections

You can list Azure vNet peerings on your Enterprise Hazelcast Cluster on Azure from Console by going Settings > vNet Peering one by one as shown below. You can check where the connection established by checking the name of the vNet with it’s CIDR from this list.

List all vNet peering connections

Also, you can easily use Hazelcast Cloud SDK, Hazelcast Cloud CLI for listing vNet peerings as shown below.

  • Hazelcast Cloud CLI

  • Hazelcast Cloud SDK

hzcloud azure-peering list --cluster-id={YOUR_CLUSTER_ID}
client, _, _ := hazelcastcloud.New()
peerings, _, _ := client.AzurePeering.List(context.Background(), &models.ListAzurePeeringsInput{
  ClusterId: "YOUR_CLUSTER_ID",
},
)
for _,peer := range *peerings {
  fmt.Println(peer.Id)
  fmt.Println(peer.VpcId)
  fmt.Println(peer.VpcCidr)
}

Deleting Peering Connections

You can delete Azure vNet peerings of your Enterprise Hazelcast Cluster on Azure from the vNet Peerings list by easily clicking the garbage can on the item.

Click Delete to delete a peering connection

  • Hazelcast Cloud CLI

  • Hazelcast Cloud SDK

hzcloud azure-peering delete --peering-id={ID_OF_PEERING}
client, _, _ := hazelcastcloud.New()
result, _, _ := client.AzurePeering.Delete(context.Background(), &models.DeleteAzurePeeringInput{
  Id: "ID_OF_PEERING",
},
)
fmt.Println(result.Status)