Prerequisites
- Install and configure the Nebius AI Cloud CLI.
- Make sure you are in a group that has at least the
editorrole within your tenant; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - Get the ID of the network where you want to manage security groups and security rules.
Creating security groups
To create a security group, runnebius vpc security-group create:
--name: Name of the security group.--network-id: ID of the network for the security group. You can only assign a security group to VMs within this network. For instructions, see How to get a network ID.
Adding security rules to security groups
To add a security rule to a security group, runnebius vpc security-rule create. For example, to create an egress security rule, run the following command:
nebius vpc security-group list. The output contains the ID in the .metadata.id field.
For more details, see:
- Command reference
--egress-destination-security-group-id(and--ingress-source-security-group-id): Security groups as sources or destinations in security rules--type: Security rule types: stateful and stateless--priority: Security rule priorities
Deleting security rules
To delete a security rule from a security group, run thenebius vpc security-rule delete command:
nebius vpc security-rule list --parent-id <security_group_ID>.
For more details, see the command reference.
If you delete all security rules from a security group, it denies all traffic to and from VMs’ network interfaces that it is assigned to. For more details, see Security rule priorities.
Assigning security groups to VMs
A VM and security groups that are assigned to it must be associated with the same network. To assign a security group to a VM’s network interface, add the security group ID to the specification of the network interface when creating or modifying the VM. For example, to add a security group to an existing VM, perform the following steps:-
Run
nebius compute instance edit <VM_ID>. -
Modify the
.spec.network_interfacesfield: - Save the edited specification and exit the editor to apply the change to the VM.
nebius vpc security-group list.
For more details, see reference for commands that create and modify VMs:
If no security groups are assigned to a VM’s network interface, the default security group of the VM’s network controls traffic to and from this network interface. You can achieve this by making the list of the network interface’s security groups empty.
Deleting security groups
To delete a security group, runnebius vpc security-group delete:
nebius vpc security-group list.