Skip to main content
Security groups act as virtual firewalls, controlling inbound and outbound traffic for compute instances. Aliases: securitygroups, sg Commands that act on one security group take its ID either as a positional argument or with --id. If you omit it, the CLI opens an interactive picker, so always pass it in scripts.

Subcommands

  • list — List security groups
  • get — Get security group details
  • create — Create a new security group
  • update — Update an existing security group
  • delete — Delete a security group

list

List security groups, optionally filtered by organization, project, network, or region.

Flags

FlagDescription
Organization ID
Project ID
Network ID
Region ID
Emit the full JSON payload (mutually exclusive with -q)
jq filter for value extraction (see Query output with -q)

Example


get

Get details for a specific security group.

Flags

FlagDescription
Security group ID
Organization ID
Emit the full JSON payload (mutually exclusive with -q)
jq filter for value extraction (see Query output with -q)

create

Create a new security group. Accepts input from a JSON file or stdin; with neither, the CLI prompts for the security group details and rules.

Flags

FlagDescription
Organization ID
Path to a JSON file
Read JSON from standard input
Preview actions and payload without persisting
Automatically confirm creation
Emit the full JSON payload (mutually exclusive with -q)
jq filter for value extraction (see Query output with -q)

Examples


update

Update an existing security group. Accepts input from a JSON file or stdin; with neither, the CLI prompts for each field, pre-filled from the security group as it stands.

Flags

FlagDescription
Security group ID
Organization ID
Path to a JSON file
Read JSON from standard input
Preview actions and payload without persisting
Automatically confirm update
Emit the full JSON payload (mutually exclusive with -q)
jq filter for value extraction (see Query output with -q)

Examples


delete

Delete an existing security group.

Flags

Example


Instances (Console)

Security groups are configured during instance creation.

Load balancers (CLI)

Load balancers expose services on a network; restrict listener sources with allowed CIDRs.