Add a public port to a Workload
Continues from Deploy a Workload from a public image. It uses the api helper from that guide, plus PROJECT_ID and SERVICE_ID. Read Public ports and HTTPS endpoints to choose between the two kinds.
Code
API status
The endpoint routes are used by the console and are tagged console-only in the API reference. They accept your session token or a personal access token.
A raw TCP or UDP port
Say which port your app listens on inside the container (internal_port) and which protocol. Zaroz assigns the public address and number.
Code
Code
Code
The response carries id, public_ip, public_port and state (active once open). Use "protocol": "tcp_udp" for one public number on both protocols. Raw ports are billed by the hour they are held; a Workload's plan includes none free (see Billing).
If the service is not running yet, the request is refused with not_ready. Wait for the deployment, then retry.
A free HTTPS endpoint for a website or API
Your app serves plain HTTP on internal_port; Zaroz handles TLS.
Code
Code
Code
label is optional and picks the first part of the free host, <label>.zone.<zone>.zaroz.cloud. To serve your own domains too, send "domains": ["www.example.com"]; each must be a domain your organization has verified, or a subdomain of one. If one is refused, nothing opens.
List and close
Code
Code
Code
The list shows pending ports first, then every port the service ever held, newest first. A closed port stays listed with its last address so you can match a month's invoice against it. Closing stops billing from that moment.
When it is refused
The details of a refusal begins with a code before the colon: port_limit, port_in_use, no_address_available, no_port_available, internal_port_out_of_range, protocol_required, and for HTTPS host_taken, domain_not_verified and others. The full list is in Public ports and HTTPS endpoints.
A port goes to one unit. If you run several units and need a public address for each, see Public ports and Private names.
