Skip to content

Networking

A sandbox's outbound connections and addresses, and sandboxes in a VPC.

Updated View as Markdown

A sandbox makes outbound connections to the internet, over IPv4 and IPv6. A sandbox created in a VPC subnet reaches that VPC instead, and the internet through a NAT gateway. Nothing can connect to a sandbox.

Outbound addresses

A running sandbox’s outbound addresses are on its page in the console and in the API, as egressIpv4 and egressIpv6. Both are null unless it’s running, and while it’s in a VPC.

  • The addresses are shared with other sandboxes. Don’t use one to identify your sandbox to another service.
  • They can change each time the sandbox starts or resumes.

Limits on outbound connections

  • Outbound TCP port 25 is blocked.
  • A sandbox holds about 1,000 connections at once to one destination address and port. Past that, new connections to that destination fail until others close. Connections to other destinations aren’t affected.

Sandboxes in a VPC

Create a sandbox in a subnet and its code reaches your private resources, such as databases, caches and internal services, at their VPC addresses.

ezgh sandboxes create <id>.registry.ezghcloud.com/acme/app:1 --subnet sbn_4k2m9x0a7qpe

The API takes vpc: {"subnet": "sbn_4k2m9x0a7qpe"} on create. The console’s create form has a VPC and subnet picker.

  • The subnet must be in the sandbox’s project, and you need network.subnets.get on it.
  • A sandbox’s subnet is fixed for its life.
  • Access is outbound only. Nothing in the VPC can open a connection to a sandbox.

On its page in the console and in the API, a sandbox in a VPC shows its vpc as { vpc, subnet }. While it’s running, vpcIpv4 and vpcIpv6 are its VPC addresses.

If the VPC network isn’t ready when a sandbox starts or resumes, the request is refused with 409 vpc_unavailable or the sandbox comes back stopped or suspended with that reason. Start or resume it again.

Internet access

A sandbox in a VPC reaches the internet only through the VPC’s NAT gateway, over IPv4, when the subnet’s route table sends internet traffic to it. Its outbound traffic then leaves from the gateway’s address, so you can allow that address at other services. There is no IPv6 internet access.

Without a NAT gateway it reaches only the VPC. DNS names resolve with or without a NAT gateway.

Allow sandboxes in a firewall

A resource’s firewall must allow the sandboxes’ traffic. Add a rule whose peer is the subnet’s sandboxes:

{
  "direction": "inbound",
  "protocol": "tcp",
  "ports": { "from": 5432, "to": 5432 },
  "peer": { "sandboxSubnet": "sbn_4k2m9x0a7qpe" }
}
ezgh compute firewalls rules add db --direction inbound --protocol tcp \
  --ports 5432 --peer-sandbox-subnet sbn_4k2m9x0a7qpe

In the console the peer is Sandboxes in subnet; in Terraform it’s peer_sandbox_subnet_id. You can write the rule before the first sandbox exists. Allowing the subnet’s address range also works.

Suspend and resume

Connections that are open when a sandbox suspends are closed. After a resume its processes carry on, and they need to reconnect.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close