Actions34
- LAN Actions
- NIC Actions
- Firewall Rule Actions
- IP Block Actions
- NAT Gateway Actions
- NAT Gateway Rule Actions
- Flow Log Actions
Firewall Rule → Create
AI-generatedSummary
Create a firewall rule on a server NIC
Inputs
- datacenterId (required) — The unique ID of the datacenter
- serverId (required) — The unique ID of the server
- nicId (required) — The unique ID of the NIC
- firewallRuleName (required) — The name of the firewall rule
- protocol (required) — The protocol for the firewall rule
- additionalFields — Additional optional fields such as source MAC, source IP, target IP, port ranges, ICMP type/code, and rule type.
Output shape
a single created firewall rule object
The response contains the created rule's details; errors are thrown unless continueOnFail is enabled.
Examples
Example 1: Add an inbound TCP rule allowing SSH from a specific IP
datacenterId: '1234', serverId: '5678', nicId: '9abc', firewallRuleName: 'SSH-Inbound', protocol: 'TCP', additionalFields: { sourceIp: '203.0.113.5', targetIp: '203.0.113.5', portRangeStart: 22, portRangeEnd: 22, type: 'INGRESS' }
Example 2: Allow UDP traffic on port 53 from any source
datacenterId: '1234', serverId: '5678', nicId: '9abc', firewallRuleName: 'DNS-UDP', protocol: 'UDP', additionalFields: { sourceIp: '', targetIp: '', portRangeStart: 53, portRangeEnd: 53, type: 'EGRESS' }
Example 3: Create an ICMP echo rule
datacenterId: '1234', serverId: '5678', nicId: '9abc', firewallRuleName: 'Ping-ICMP', protocol: 'ICMP', additionalFields: { type: 'INGRESS' }