Create Firewall rule for a Network Security Group
To create a firewall rule for a NSG, you need to use the following Cloud API POST request providing the datacenterId and securityGroupId:
POST /datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules
Request
curl --location 'https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/bxxxx-axXX-0008-8888-99k0444e5555/rules' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YYXabCDeFmLMO0c2hyYUBpb25vcy5jb206I1Bha2lzdGFuXzE=' \
--data '{
"properties":{
"name": "My FWR",
"protocol": "TCP",
"sourceMac": "00:0a:95:9d:68:16",
"ipVersion": "IPv4",
"sourceIp": "22.231.113.12",
"targetIp": "22.231.113.64",
"portRangeStart": 8,
"portRangeEnd": 8,
"type": "INGRESS"
}
}'Response
202 Accepted
Last updated
Was this helpful?