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
List Firewalls
GET /api/:projectSlug/:environmentSlug/firewalls- List all firewalls for a project environment
Get Firewall Details
GET /api/:projectSlug/:environmentSlug/firewalls/:firewallId- Get details of a specific firewall including its rules
Update Firewall
PATCH /api/:projectSlug/:environmentSlug/firewalls/:firewallId- Update firewall name, position, or add firewall rules
rules array will add new rules to the firewall. To remove rules, use the DELETE endpoint for individual rules.
Example:
Delete Firewall
Firewall (resource) deletion is performed only via the unified resources API:DELETE /api/:projectSlug/:environmentSlug/resources/:resourceId
rules field when creating or updating a firewall. Each rule object has the following structure:
tcp- Transmission Control Protocoludp- User Datagram Protocolicmp- Internet Control Message Protocol-1orall- All protocols
- Single port:
"port": 80or"port": "80" - Port range:
"port": "80-443"or"port": [80, 443] - All ports:
"port": nullor omit the field
- IPv4 CIDR:
"0.0.0.0/0","10.0.0.0/8"→ detected asipv4 - IPv6 CIDR:
"::/0","2001:db8::/32"→ detected asipv6 - Security Group ID:
"sg-1234567890abcdef0"→ detected assecurity_group - Prefix List ID:
"pl-1234567890abcdef0"→ detected asprefix_list
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)