Security groups and security rules
Each security group is associated with a network and can only apply to VMs in this network. The network ID is specified in the.spec.network_id field of the security group’s specification:
192.0.2.0/24 CIDR block on port 8888:
Description of the parameters
Description of the parameters
-
.metadata.id: ID of the security rule. -
.metadata.parent_id: ID of the security group. The parent resource of a security rule is a security group; the parent resource of a security group is a project. -
.spec.access: Whether toALLOWorDENYthe ingress or egress traffic defined in the security rule. -
.spec.egress: Source and destination of the egress traffic that should match the rule. Each security rule must have either.spec.egressor.spec.ingress(for ingress traffic)..spec.egress.destination_cidrs,.spec.egress.destination_ports: Lists of CIDR blocks and ports that the traffic goes to. Both egress and ingress rules support these fields as well assource_cidrsandsource_ports. You can also specify a security group as the source in an ingress security rule (.spec.ingress.source_security_group_id) or as the destination in an egress security rule (.spec.egress.destination_security_group_id).
-
.spec.protocol: Networking protocol to which the rule applies. Supported values areTCP,UDP,ICMPandANY. -
.spec.type: Rule type. Supported values areSTATEFUL(connection tracking is enabled; default) andSTATELESS(connection tracking is disabled). -
.spec.priority: Priority of the rule. 1 is the highest priority, 1000 is the lowest.
Security rule types: stateful and stateless
A security rule can be stateful or stateless, which means it has connection tracking enabled or disabled:- Stateful security rules track connections in which the matching traffic is sent and automatically allow the response traffic within the same connection, even if it doesn’t match any other rule. For example, if a VM sends a request that a stateful security rule in the VM’s security group allows, the response to this request is allowed by the same rule.
- Stateless security rules don’t track connections like stateful security rules do. For your VM to be able to send or receive a response to ingress or egress traffic that a stateless security rule allows, you need to create a separate security rule.
Security rule priorities
Each security rule has a priority from 1 to 1000. When determining how to apply security rules to a traffic packet, Nebius AI Cloud looks for a matching security rule, starting from security rules with lower priority values—that is, going from 1 to 1000. Once a match is found, the lookup stops and the matching rule is applied. If no match is found, the traffic is denied. This means that assigning an empty security group to a VM’s network interface blocks all traffic to and from this network interface. If two or more security rules have the same priority, security rules that deny traffic take precedence over security rules that allow traffic. The default priority of a security rule is 500. Setting the priority at 0 is the same as the default value. If you assign multiple security groups to a network interface of a VM, all security rules from these security groups are combined into one list which is then looked up by effective priority. Effective priority is automatically calculated for each security rule from its priority and returned in its.status.effective_priority field:
Security groups as sources or destinations in security rules
You can specify a security group as the source for an ingress security rule or as the destination for an egress security rule. For example:Default security groups
Each network has a default security group which is assigned to VMs in this network by default. It allows all ingress and egress traffic.Security rules in a default security group
Security rules in a default security group