Skip to main content

Firewall Management Endpoints

Firewalls are AWS security groups that control inbound and outbound network traffic for your instances. You can create firewall resources and connect them to instances using resource connections. Important Notes:
  • When you create a server/instance, a default security group is automatically created and attached (named GatewaysApp-Default-{projectSlug}-{environmentSlug}). This security group is not added as a firewall resource in the database - it’s just attached to the instance.
  • You can create custom firewall resources separately and connect them to instances using resource connections.
  • Firewall rules are stored in the firewall resource’s metadata.rules (inbound/outbound arrays). Rule IDs are strings (e.g. rule-1234567890-abc123) and are used when deleting a rule.

Create Firewall

  • POST /api/:projectSlug/:environmentSlug/firewalls - Create a new firewall resource (AWS security group) with optional region and rules
Request Body:
Example:
Example Response:

List Firewalls

  • GET /api/:projectSlug/:environmentSlug/firewalls - List all firewalls for a project environment
Example:
Example Response:

Get Firewall Details

  • GET /api/:projectSlug/:environmentSlug/firewalls/:firewallId - Get details of a specific firewall including its rules
Example:
Example Response:

Update Firewall

  • PATCH /api/:projectSlug/:environmentSlug/firewalls/:firewallId - Update firewall name, position, or add firewall rules
Request Body:
Note: The rules array will add new rules to the firewall. To remove rules, use the DELETE endpoint for individual rules. Example:
Example Response:

Delete Firewall

Firewall (resource) deletion is performed only via the unified resources API:
  • DELETE /api/:projectSlug/:environmentSlug/resources/:resourceId
Use the firewall’s database ID. The service deletes the cloud security group (AWS, GCP, Azure), removes all resource connections, then soft-deletes the resource. See Resources API — Delete Resource by ID. Example:
Firewall Rule Format: Rules are provided as an optional array in the rules field when creating or updating a firewall. Each rule object has the following structure:
Supported Protocols:
  • tcp - Transmission Control Protocol
  • udp - User Datagram Protocol
  • icmp - Internet Control Message Protocol
  • -1 or all - All protocols
Port Format:
  • Single port: "port": 80 or "port": "80"
  • Port range: "port": "80-443" or "port": [80, 443]
  • All ports: "port": null or omit the field
Source Value Format (type is auto-detected):
  • IPv4 CIDR: "0.0.0.0/0", "10.0.0.0/8" → detected as ipv4
  • IPv6 CIDR: "::/0", "2001:db8::/32" → detected as ipv6
  • Security Group ID: "sg-1234567890abcdef0" → detected as security_group
  • Prefix List ID: "pl-1234567890abcdef0" → detected as prefix_list
Rule Examples: Allow SSH (port 22) from a specific IP:
Allow HTTPS (port 443) from anywhere:
Allow port range (80-443) from anywhere:
Allow MySQL (port 3306) from another security group:
Allow all outbound traffic (all ports, all protocols):
Allow from IPv6 address:

Remove Firewall Rule

  • DELETE /api/:projectSlug/:environmentSlug/firewalls/:firewallId/rules/:ruleId - Remove a rule from a firewall (ruleId is the rule’s string id from the rule object, e.g. rule-1234567890-abc123)
Example:
Example Response:
Note: Firewall rule creation and deletion are now automatically synced with AWS security groups. When you create, update, or delete firewall rules, the corresponding changes are immediately applied to the AWS Security Group. The default AWS outbound “All traffic” rule is automatically removed if no outbound rules are specified.