Skip to main content
AWS PrivateLink allows you to connect to S2 privately from your VPC, without exposing traffic to the public internet. You also benefit from significantly reduced egress costs. With a network policy, you can also restrict an access token to requests through your PrivateLink endpoint, so it is denied from anywhere else.
S2 is currently available in AWS regions, so private networking uses AWS PrivateLink. Equivalent options, such as GCP Private Service Connect, will be added as S2 expands to other clouds.

Regions

Create your VPC endpoint in the AWS region of the basin’s location, for example us-east-1 for aws:us-east-1. An endpoint service can only be found from its own region, unless you create a cross-region endpoint.
Cross-region endpoints can be created from us-east-1, us-west-2, eu-north-1, and eu-central-1. Contact us if you need another region.Cross-region access also requires the vpce:AllowMultiRegion IAM permission.
Prefer an endpoint in the same region where you can. With a cross-region endpoint, AWS bills the endpoint owner inter-region data transfer for every GB in both directions, and requests take on inter-region latency.

Setup with the AWS Console

These steps use the AWS console. To script the setup instead, see Setup with the AWS CLI.
1

Get Service Name

In the S2 dashboard, open the Private Connectivity tab on the Basins page to find your PrivateLink service name.
The service name is also returned as private_net.aws.service_name for each location by the list locations API, and shown by s2 location list:
The service name is specific to your account and can differ from another account’s in the same location. It is only available once you have at least one basin in the location.
2

Navigate to VPC Endpoints

Search for VPC endpoint on the AWS console and select “Endpoints”.
3

Create Endpoint

Click on “Create Endpoint”.
4

Select Service Type

Select “PrivateLink Ready Partner Services”.
5

Verify Service

Enter the PrivateLink service name and click on “Verify Service”.
If the service is not found, check that the console is in the location’s region. To connect from another region, select Enable Cross Region endpoint and choose the location’s region.
6

Select VPC

Select the appropriate VPC.
7

Enable Private DNS

Enable private DNS name.
8

Include Subnets

Include subnets.
9

Configure Security Groups

Select appropriate Security Groups.
The endpoint’s security group must allow inbound HTTPS (port 443) from your clients, for example from your VPC’s CIDR range. Your clients’ security groups must allow outbound HTTPS to the endpoint, which the default outbound rule already does.

Setup with the AWS CLI

The same setup with AWS CLI v2. Set these to your own values:
  • VPC_ID: the VPC your S2 clients run in. The endpoint and its private DNS only serve that VPC, so each VPC with clients needs its own endpoint.
  • SUBNET_IDS: one subnet in each Availability Zone where your clients run, at most one per zone. The endpoint gets a network interface in each, billed hourly. Clients in a zone without one still connect, but cross zones and pay for the transfer. The subnets need no internet access, and the endpoint can only use zones the service supports.
To list your VPCs, their subnets, and the zones the service supports (for a cross-region endpoint, add --service-regions to the last command, as in step 1):
Subnets with PublicIp set to False are usually private subnets, which are a good fit for the endpoint. For a cross-region endpoint, also set the location’s region and add --service-regions "$SERVICE_REGION" to step 1 and --service-region "$SERVICE_REGION" to step 4:
1

Check the Service

Check that the VPC has no endpoint for the service yet. A VPC can only have one endpoint with private DNS for a service, so if this lists one, use it instead of creating another:
2

Enable DNS on the VPC

Private DNS needs both DNS attributes enabled on the VPC. Check them first:
If either prints false, enable it:
3

Create a Security Group

Allow HTTPS (port 443) from the VPC:
This allows the VPC’s primary CIDR range. Clients in a secondary CIDR range, a peered VPC, or behind a Transit Gateway need a rule for their range too:
To list the VPC’s CIDR ranges, including secondary ones:
4

Create the Endpoint

The endpoint ID is what a network policy lists in vpce_ids.
5

Wait Until Available

This prints the state every 10 seconds and stops when the endpoint is available, or in any other state that needs action, such as failed.

Validate Your Connection

Run these from a VM in your VPC. Set BASIN to one of your basins in the location:
  1. Check that the basin’s DNS name resolves to the endpoint’s private addresses, one per subnet, all in your VPC’s CIDR range:
    If it still resolves to public addresses, clear DNS caches or wait a few moments.
  2. Check that HTTPS works through each address. DNS can return any of them, so a broken zone causes failures for only some requests:
    Each address should print 401, since the request has no access token. 000 means the connection through that address failed. Check that your clients’ security group allows outbound HTTPS and that the endpoint’s security group allows inbound HTTPS from them. If both do, contact us with the endpoint ID and the zone that fails.
  3. If you also send account requests over PrivateLink, set S2_PRIVATE_DNS_NAME and both endpoint overrides as described there. Then check that the private DNS name resolves to private addresses too, and make an account request:
The setup above covers basin requests, such as appending to and reading from streams. Account requests, such as listing basins or issuing access tokens, go to a.s2.dev over the public internet by default. To send account requests over PrivateLink too, set the account endpoint to the private DNS name of your VPC endpoint’s service. Like the service name, it is specific to the location and can differ between accounts. It is returned as private_net.aws.private_dns_name by the list locations API, shown as privatelink dns name by s2 location list, and returned as PrivateDnsName when you check the service with the AWS CLI:
Set both endpoint overrides. The CLI and some SDKs only use custom endpoints when both are set, so keep the basin endpoint at its default value:
The CLI reads these variables automatically, and SDKs can read them with their environment helpers.
A private DNS name only resolves to PrivateLink from a VPC that has an endpoint for that location’s service, with private DNS enabled. Use the name for a location your VPC has an endpoint for. If it has endpoints for several locations, any of their names works for account requests.
This matters for access tokens with a network policy that has only private_net rules, since those tokens are denied for requests over the public internet.

Remove the Endpoint

Delete the endpoint, then its security group once the endpoint is gone. Until then, deleting the security group fails because the endpoint still uses it:
Run the second command until it prints deleted or reports that the endpoint does not exist, then run the third. Requests from the VPC then go over the public internet if it has internet access, and fail otherwise. Access tokens whose network policy only allows this endpoint are denied.