security-groups, sg, securitygroups
Commands that act on one security group take its ID or name 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.list, ls
Flags
| Flag | Description |
|---|---|
| Organization ID or name | |
| Project ID or name | |
| Network ID or name | |
| Region ID or name | |
Show at most N results (client-side; every result is still fetched). Cuts before -q. 0 for all | |
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
| Flag | Description |
|---|---|
| Security group ID or name | |
| Organization ID or name | |
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
| Flag | Description |
|---|---|
| Organization ID or name | |
| 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
| Flag | Description |
|---|---|
| Security group ID or name | |
| Organization ID or name | |
| 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.delete, rm, remove
Flags
Example
Related
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.