GCP Private Service Connect traffic filters
editGCP Private Service Connect traffic filters
editTraffic filtering, to allow only Private Service Connect connections, is one of the security layers available in Elasticsearch Service. 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 Service.
Private Service Connect filtering is supported only for Google Cloud regions.
Private Service Connect establishes a secure connection between two Google Cloud VPCs. The VPCs can belong to separate accounts, for example a service provider and their service consumers. Google Cloud routes the Private Service Connect traffic within the Google Cloud 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 a Private Service Connect Endpoint and a Service Attachment. Learn more about using Private Service Connect on Google Cloud.
Private Service Connect connections are regional, your Private Service Connect Endpoint needs to live in the same region as your deployment. The Endpoint can be accessed from any region once you enable its Global Access feature.
Private Service Connect URIs
editService Attachments are set up by Elastic in all supported GCP regions under the following URIs:
GCP Public Regions
Region | Service Attachment URI | Private zone DNS name |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The process of setting up the Private link connection to your clusters is split between Google Cloud (e.g. by using Google Cloud console), and Elastic Cloud UI. These are the high-level steps:
Google Cloud console | Elastic Cloud UI |
---|---|
1. Create a Private Service Connect endpoint using Elastic Cloud Service Attachment URI. |
|
2. Create a DNS record pointing to the Private Service Connect endpoint. |
|
3. Create a Private Service Connect rule set with the PSC Connection ID. |
|
4. Associate the Private Service Connect rule set with your deployments. |
|
5. Interact with your deployments over Private Service Connect. |
Create your Private Service Connect endpoint and DNS entries in Google Cloud
edit-
Create a Private Service Connect endpoint in your VPC using the Service Attachment URI for your region.
Follow the Google Cloud instructions for details on creating a Private Service Connect endpoint to access Private Service Connect services.
Use the Service Attachment URI for your region. Select the Published service option and enter the selected Service Attachment URI as the Target service. For example for the region
asia-southeast1
the Service Attachment URI isprojects/cloud-production-168820/regions/asia-southeast1/serviceAttachments/proxy-psc-production-asia-southeast1-v1-attachment
you need to reserve a static internal IP address in your VPC. The address is used by Private Service Connect endpoint.
Note down the PSC Connection ID, e.g.
18446744072646845332
. -
Create a DNS record.
-
Create a DNS Zone of type Private. Set the DNS name to Private zone DNS name for your region. For example, in asia-southeast1 use
psc.asia-southeast1.gcp.elastic-cloud.com
as the zone domain name. Make sure the zone is associated with your VPC. -
Then create a DNS record set with an A record pointing to the Private Service Connect endpoint IP. Use
*
as the DNS name,A
as the Resource Record Type, and put the Private Service Connect endpoint IP address as the record value.Follow the Google Cloud instructions for details on creating an A record which points to your Private Service Connect endpoint IP address.
-
Create a DNS Zone of type Private. Set the DNS name to Private zone DNS name for your region. For example, in asia-southeast1 use
-
Test the connection.
Find out the Elasticsearch cluster ID of your deployment. You can do that by selecting Copy cluster id 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.
To access your Elasticsearch cluster over Private Link:,
-
If you have a custom endpoint alias configured, you can use the custom endpoint URL to connect.
https://{alias}.{product}.{private_hosted_zone_domain_name}
For example:
https://my-deployment-d53192.es.psc.asia-southeast1.gcp.elastic-cloud.com
-
Alternatively, use the following URL structure:
https://{elasticsearch_cluster_ID}.{private_hosted_zone_domain_name}:9243
For example:
https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243
You can test the Google Cloud console part of the setup with the following command (substitute the region and Elasticsearch ID with your cluster):
$ curl -v https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243 .. * Trying 192.168.100.2... .. < HTTP/2 403 .. {"ok":false,"message":"Forbidden"}
Check the IP address
192.168.100.2
. it should be the same as the IP address assigned to your Private Service Connect endpoint.The connection is established, and a valid certificate is presented to the client. The
403 Forbidden
is expected, you haven’t associated any deployment with the Private Service Connect endpoint yet. -
Add the Private Service Connect rules to your deployments
editFollow these high-level steps to add private link rules to your deployments.
Find your Private Service Connect connection ID
edit- Go to your Private Service Connect endpoint in the Google Cloud console.
- Copy the value of PSC Connection ID.
Create rules using the Private Service Connect endpoint connection ID
editWhen you have your Private Service Connect endpoint connection ID, you can create a traffic filter rule set.
- From the Account menu, select Traffic filters.
- Select Create filter.
- Select Private Service Connect endpoint.
- Create your rule set, providing a meaningful name and description.
- Select the region for the rule set.
- Enter your PSC Connection ID.
-
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.
- (Optional) You can claim your PSC Connection ID, so that no other organization is able to use it in a traffic filter ruleset.
The next step is to associate the rule set with your deployments.
Associate the Private Service Connect endpoint with your deployment
editTo associate a private link rule set with your deployment:
- Go to the deployment.
- On the Security page, under Traffic filters select Apply filter.
- Choose the filter you want to apply and select Apply filter.
Access the deployment over the Private Service Connect
editFor traffic to connect with the deployment over Private Service Connect, the client making the request needs to be located within the VPC where you’ve created the Private Service Connect endpoint. You can also setup network traffic to flow through the originating VPC from somewhere else, such as another VPC or a VPN from your corporate network. This assumes that the Private Service Connect endpoint and the DNS record are also available within that context. Check your cloud 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 asia-southeast1
region you can access it under https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243
.
$ curl -u 'username:password' -v https://6b111580caaa4a9e84b18ec7c600155e.psc.asia-southeast1.gcp.elastic-cloud.com:9243 .. < HTTP/1.1 200 OK ..
If you are using Private Service Connect together with Fleet, and enrolling the Elastic Agent with a Private Service Connect URL, you need to configure Fleet Server to use and propagate the Private Service Connect URL by updating the Fleet Server hosts field in the Fleet settings section of Kibana. Otherwise, Elastic Agent will reset to use a default address instead of the Private Service Connect URL. The URL needs to follow this pattern: https://<Fleet component ID/deployment alias>.fleet.<private zone DNS name>:443
.
Similarly, the Elasticsearch host needs to be updated to propagate the Private Service Connect URL. The Elasticsearch URL needs to follow this pattern: https://<Elasticsearch cluster ID/deployment alias>.es.<private zone DNS name>:443
.
The settings xpack.fleet.agents.fleet_server.hosts
and xpack.fleet.outputs
that are needed to enable this configuration in Kibana are currently available on-prem only, and not in the Kibana settings in Elastic Cloud.
Edit a Private Service Connect rule set
editYou can edit a rule set name or to change the PSC connection ID.
- From the Account menu, select Traffic filters.
- Find the rule set you want to edit.
- Select the Edit icon.
Delete a Private Service Connect rule set
editIf you need to remove a rule set, you must first remove any associations with deployments.
To delete a rule set with all its rules:
- Remove any deployment associations.
- From the Account menu, select Traffic filters.
- Find the rule set you want to edit.
- Select the Remove icon. The icon is inactive if there are deployments assigned to the rule set.
Remove a Private Service Connect rule set association from your deployment
editTo remove an association through the UI:
- Go to the deployment.
- On the Security page, under Traffic filters select Remove.