POST /virtual_machines/:virtual_machine_id/firewall_rules 

Adds a firewall rule to specified VS


Request Parameters

address* - Set the IP address for which this rule is active.

  • Leave the empty field to apply this rule to all IPs
  • Enter hyphen-separated IPs to apply the rule to an IP range (e.g.
  • Enter the IPs with slash to apply the rule to CIDR (e.g.

command* - sets the command to ACCEPT or DROP the above mentioned IPs

port - sets the port addresses

  • Leave the empty field to apply the rule to all ports
  • Enter colon-separated ports to apply the rule to a port range (e.g. 1024:1028)
  • Enter comma-separated ports to apply the rule to the list of ports (e.g. 80,443,21)

protocol* - protocol type (TCP or UDP)

network_interface_id* - interface of the network

Response Parameters

201 status on and the newly created firewall rule is returned on success

JSON Request example

 curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass -d '{"firewall_rule":{"address":"","command":"DROP","protocol":"TCP","network_interface_id":"105","port":""}}' --url <api_url>/virtual_machines/:virtual_machine_id/firewall_rules.json

JSON Response


XML Request example

 curl -i -X POST -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass -d '<?xml version="1.0" encoding="UTF-8"?><firewall_rule><address></address><command>DROP</command><port></port><protocol>TCP</protocol><network_interface_id>105</network_interface_id></firewall_rule>' --url <api_url>/virtual_machines/:virtual_machine_id/firewall_rules.xml