Azure Private Link traffic filtersedit

Traffic filtering, to allow only Azure Private Link connections, is one of the security layers available in Elasticsearch Add-On for Heroku. It allows you to limit how your deployments can be accessed.

Read more about Traffic Filtering for the general concepts behind traffic filtering in Elasticsearch Add-On for Heroku.

Azure Private Link filtering is supported only for Azure regions.

Azure Private Link establishes a secure connection between two Azure VNets. The VNets can belong to separate accounts, for example a service provider and their service consumers. Azure routes the Private Link traffic within the Azure data centers and never exposes it to the public internet. In such a configuration, Elastic Cloud is the third-party service provider and the customers are service consumers.

Private Link is a connection between an Azure Private Endpoint and a Azure Private Link Service.

Azure Private Link Service aliasesedit

Private Link Services are set up by Elastic in all supported Azure regions under the following aliases:

Region Azure Private Link Service Alias Private hosted zone domain name

australiaeast

australiaeast-prod-012-privatelink-service.a0cf0c1a-33ab-4528-81e7-9cb23608f94e.australiaeast.azure.privatelinkservice

privatelink.australiaeast.azure.elastic-cloud.com

centralus

centralus-prod-009-privatelink-service.49a041f7-2ad1-4bd2-9898-fba7f7a1ff77.centralus.azure.privatelinkservice

privatelink.centralus.azure.elastic-cloud.com

eastus2

eastus2-prod-002-privatelink-service.64359fdd-7893-4215-9929-ece3287e1371.eastus2.azure.privatelinkservice

privatelink.eastus2.azure.elastic-cloud.com

francecentral

francecentral-prod-008-privatelink-service.8ab667fd-e8af-44b2-a347-bd48d109afec.francecentral.azure.privatelinkservice

privatelink.francecentral.azure.elastic-cloud.com

japaneast

japaneast-prod-006-privatelink-service.cfcf2172-917a-4260-b002-3e7183e56fd0.japaneast.azure.privatelinkservice

privatelink.japaneast.azure.elastic-cloud.com

northeurope

northeurope-prod-005-privatelink-service.163e4238-bdde-4a0b-a812-04650bfa41c4.northeurope.azure.privatelinkservice

privatelink.northeurope.azure.elastic-cloud.com

southeastasia

southeastasia-prod-004-privatelink-service.20d67dc0-2a36-40a0-af8d-0e1f997a419d.southeastasia.azure.privatelinkservice

privatelink.southeastasia.azure.elastic-cloud.com

uksouth

uksouth-prod-007-privatelink-service.98758729-06f7-438d-baaa-0cb63e737cdf.uksouth.azure.privatelinkservice

privatelink.uksouth.azure.elastic-cloud.com

westeurope

westeurope-prod-001-privatelink-service.190cd496-6d79-4ee2-8f23-0667fd5a8ec1.westeurope.azure.privatelinkservice

privatelink.westeurope.azure.elastic-cloud.com

westus2

westus2-prod-003-privatelink-service.b9c176b8-4fe9-41f9-916c-67cacd753ca1.westus2.azure.privatelinkservice

privatelink.westus2.azure.elastic-cloud.com

eastus

eastus-prod-010-privatelink-service.b5765cd8-1fc8-45e9-91fc-a9b208369f9a.eastus.azure.privatelinkservice

privatelink.eastus.azure.elastic-cloud.com

southcentralus

southcentralus-prod-013-privatelink-service.f8030986-5fb9-4b0e-8463-69604233b07e.southcentralus.azure.privatelinkservice

privatelink.southcentralus.azure.elastic-cloud.com

The process of setting up the Private link connection to your clusters is split between Azure (e.g. by using Azure portal), Elastic Cloud Support, and Elastic Cloud UI. These are the high-level steps:

Azure portal Elastic Cloud UI

1. Create a private endpoint using Elastic Cloud service alias.

2. Create a DNS record pointing to the private endpoint.

3. Create an Azure Private Link rule set with the private endpoint Name and ID.

4. Associate the Azure Private Link rule set with your deployments.

5. Interact with your deployments over Private Link.

Create your private endpoint and DNS entries in Azureedit

  1. Create a private endpoint in your VNet using the alias for your region.

    Follow the Azure instructions for details on creating a private endpoint to an endpoint service.

    Use the service aliases for your region. Select the "Connect to an Azure resource by resource ID or alias" option. For example for the region eastus2 the service alias is eastus2-prod-002-privatelink-service.64359fdd-7893-4215-9929-ece3287e1371.eastus2.azure.privatelinkservice

    You will notice that the Private Link endpoint is in the Awaiting Approval state. We validate and approve the endpoints when you create the ruleset using the Private Link resource name and resource ID, as described in the next section Add the private link rules to your deployments.

  2. Create a DNS record.

    1. Create a Private DNS Zone. Get the private hosted zone domain name in Azure Private Link Service Alias for the name of the zone. For example, in eastus2 use privatelink.eastus2.azure.elastic-cloud.com as the zone domain name.
    2. After creating the Private DNS Zone, associate the zone with your VNet.
    3. Then create a DNS A record pointing to the private endpoint. Use * as the record name, A as the type, and put the private endpoint IP address as the record value.

      Follow the Azure instructions for details on creating an A record which points to your private endpoint IP address.

      The private endpoint IP address is available through the network interface for the private endpoint.

Add the private link rules to your deploymentsedit

Follow these high-level steps to add private link rules to your deployments.

Find your private endpoint resource nameedit

  1. Go to your Private Link Endpoint in the Azure Portal.
  2. Click JSON View.
  3. Copy the value of the top level name property.

Find your private endpoint resource IDedit

  1. Go to your Private Link Endpoint in the Azure Portal.
  2. Click JSON View.
  3. Copy the value of the properties.resourceGUID property.
Private endpoint JSON View
Private endpoint Properties

Create rules using the Private Link Endpoint Resource Name and Resource IDedit

When you have your private endpoint name and ID, you can create a private link traffic filter rule set.

  1. From the Account menu, select Traffic filters.
  2. Click Create filter.
  3. Select Private link endpoint.
  4. Create your rule set, providing a meaningful name and description.
  5. Select the region for the rule set.
  6. Enter you Private Endpoint Resource Name and Resource ID.
  7. Select if this rule set should be automatically attached to new deployments.

Each rule set is bound to a particular region and can be only assigned to deployments in the same region.

Creating the filter approves the Private Link connection.

Let’s test the connection:

  1. Find out the Elasticsearch cluster ID of your deployment. You can do that by clicking Copy cluster id link in the Cloud UI. It looks something like 9c794b7c08fa494b9990fa3f6f74c2f8.

    The Elasticsearch cluster ID is different from the deployment ID, custom alias endpoint, and Cloud ID values that feature prominently in the user console.

  2. To access your Elasticsearch cluster over Private Link, use the following URL structure:

    https://{elasticsearch_cluster_ID}.{private_hosted_zone_domain_name}:9243

    For example:

    https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243

  3. You can test the Azure portal part of the setup with the following command (substitute the region and Elasticsearch ID with your cluster).

    The output should look like this:

    $ curl -v https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243
    * Rebuilt URL to: https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243/
    *   Trying 192.168.46.5...         # <== note this IP address
    ..
    * SSL connection using TLS1.2 / ECDHE_RSA_AES_256_GCM_SHA384
    * 	 server certificate verification OK
    * 	 common name: *.privatelink.elastic-cloud.com (matched)
    ..
    < HTTP/1.1 403 Forbidden
    {"ok":false,"message":"Forbidden"}

    Check the IP address 192.168.46.5 it should be the same as the IP address of your private endpoint.

    The connection is established, and a valid certificate is presented to the client. The 403 Forbidden is expected, you haven’t associate the rule set with any deployment yet.

  4. In the event that the Private Link connection is not approved by Elastic Cloud, you’ll see output with an error message like the following. Double check that the filter you’ve created in the previous step uses the right resource name and GUID.

    $ curl -v https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243
    * Rebuilt URL to: https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243/
    *   Trying 192.168.46.5...
    * connect to 192.168.46.5 port 9243 failed: No route to host
    * Failed to connect to 6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com port 9243: No route to host
    * Closing connection 0
    curl: (7) Failed to connect to 6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com port 9243: No route to host

The next step is to associate the rule set with your deployments.

Associate a private link rule set with your deploymentedit

To associate a private link rule set with your deployment:

  1. Go to the deployment.
  2. On the Security page, under Traffic filters click Apply filter.
  3. Select the filter you want to apply and click Apply filter.

Access the deployment over a private linkedit

For traffic to connect with the deployment over Azure Private Link, the client making the request needs to be located within the VNet where you’ve created the private endpoint. You can also setup network traffic to flow through the originating VNet from somewhere else, such as another VNet or a VPN from your corporate network. This assumes that the private endpoint and the DNS record are also available within that context. See your service provider documentation for setup instructions.

Use the alias you’ve set up as CNAME A record to access your deployment.

For example, if your Elasticsearch ID is 6b111580caaa4a9e84b18ec7c600155e and it is located in eastus2 region you can access it under https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243.

$ curl -u 'username:password'  -v https://6b111580caaa4a9e84b18ec7c600155e.privatelink.eastus2.azure.elastic-cloud.com:9243
..
< HTTP/1.1 200 OK
..

Edit a private link connectionedit

You can edit a rule set name or to change the VPC endpoint ID.

  1. From the Account menu, select Traffic filters.
  2. Find the rule set you want to edit.
  3. Click the Edit icon.

Delete a private link rule setedit

If you need to remove a rule set, you must first remove any associations with deployments.

To delete a rule set with all its rules:

  1. Remove any deployment associations.
  2. From the Account menu, select Traffic filters.
  3. Find the rule set you want to edit.
  4. Click the Remove icon. The icon is inactive if there are deployments assigned to the rule set.

Remove a private link rule set association from your deploymentedit

To remove an association through the UI:

  1. Go to the deployment.
  2. On the Security page, under Traffic filters simply click Remove.

Setting up an inter-region Private Link connectionedit

Azure supports inter-region Private Link as described in the Azure documentation. "The private link resource can be deployed in a different region than the virtual network and private endpoint."

This means your deployment on Elastic Cloud can be in a different region than the Private Link endpoints or the clients that consume the deployment endpoints.

Inter-region Private Link
  1. Set up Private Link Endpoint in region 1 for a deployment hosted in region 2.

    1. Create your Private Endpoint using the service alias for region 2 in the region 1 VNET (let’s call this VNET1).
    2. Create a Private Hosted Zone for region 2, and associate it with VNET1 similar to the step above Create a Private Link endpoint and DNS. Note that you are creating these resources in region 1, VNET1.
  2. Create a traffic filter rule set and Associate the rule set through the Elasticsearch Add-On for Heroku console, just as you would for any deployment.
  3. Test the connection from a VM or client in region 1 to your Private Link endpoint, and it should be able to connect to your Elasticsearch cluster hosted in region 2.