> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Security groups

> Manage security groups for controlling network access to instances.

Security groups act as virtual firewalls, controlling inbound and outbound traffic for compute instances.

**Aliases:** `securitygroups`, `sg`

## Subcommands

* [list](#list) — List security groups
* [get](#get) — Get security group details
* [create](#create) — Create a new security group
* [update](#update) — Update an existing security group
* [delete](#delete) — Delete a security group

***

## list

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

```bash theme={null}
nscale securitygroups list [flags]
```

### Flags

<table>
  <thead><tr><th>Flag</th><th>Description</th></tr></thead>

  <tbody>
    <tr><td><code>--org string</code></td><td>Organization ID</td></tr>
    <tr><td><code>--project string</code></td><td>Project ID</td></tr>
    <tr><td><code>--network string</code></td><td>Network ID</td></tr>
    <tr><td><code>--region string</code></td><td>Region ID</td></tr>

    <tr>
      <td><code>--json</code></td>
      <td>Emit the full JSON payload (mutually exclusive with <code>-q</code>)</td>
    </tr>

    <tr>
      <td><code>-q, --query stringArray</code></td>
      <td>jq filter for value extraction (see <a href="/docs/cli/query-output">Query output with <code>-q</code></a>)</td>
    </tr>
  </tbody>
</table>

### Example

```bash theme={null}
nscale securitygroups list --org <org-id> --region <region-id>
```

***

## get

Get details for a specific security group.

```bash theme={null}
nscale securitygroups get --id <sg-id> --org <org-id>
```

### Flags

<table>
  <thead><tr><th>Flag</th><th>Description</th></tr></thead>

  <tbody>
    <tr><td><code>--id string</code></td><td>Security group ID</td></tr>
    <tr><td><code>--org string</code></td><td>Organization ID</td></tr>

    <tr>
      <td><code>--json</code></td>
      <td>Emit the full JSON payload (mutually exclusive with <code>-q</code>)</td>
    </tr>

    <tr>
      <td><code>-q, --query stringArray</code></td>
      <td>jq filter for value extraction (see <a href="/docs/cli/query-output">Query output with <code>-q</code></a>)</td>
    </tr>
  </tbody>
</table>

***

## create

Create a new security group. Accepts input from a JSON file or stdin.

```bash theme={null}
nscale securitygroups create [flags]
```

### Flags

<table>
  <thead><tr><th>Flag</th><th>Description</th></tr></thead>

  <tbody>
    <tr><td><code>--org string</code></td><td>Organization ID</td></tr>
    <tr><td><code>-f, --file string</code></td><td>Path to a JSON file</td></tr>
    <tr><td><code>--stdin</code></td><td>Read JSON from standard input</td></tr>
    <tr><td><code>--dry-run</code></td><td>Preview the request payload without persisting</td></tr>
    <tr><td><code>-y, --yes</code></td><td>Automatically confirm creation</td></tr>

    <tr>
      <td><code>--json</code></td>
      <td>Emit the full JSON payload (mutually exclusive with <code>-q</code>)</td>
    </tr>

    <tr>
      <td><code>-q, --query stringArray</code></td>
      <td>jq filter for value extraction (see <a href="/docs/cli/query-output">Query output with <code>-q</code></a>)</td>
    </tr>
  </tbody>
</table>

### Examples

```bash theme={null}
nscale securitygroups create --file securitygroup.json
nscale securitygroups create --stdin < securitygroup.json
cat securitygroup.json | nscale securitygroups create --stdin
```

***

## update

Update an existing security group.

```bash theme={null}
nscale securitygroups update --id <sg-id> [flags]
```

### Flags

<table>
  <thead><tr><th>Flag</th><th>Description</th></tr></thead>

  <tbody>
    <tr><td><code>--id string</code></td><td>Security group ID</td></tr>
    <tr><td><code>--org string</code></td><td>Organization ID</td></tr>
    <tr><td><code>-f, --file string</code></td><td>Path to a JSON file</td></tr>
    <tr><td><code>--stdin</code></td><td>Read JSON from standard input</td></tr>
    <tr><td><code>--dry-run</code></td><td>Preview the request payload without persisting</td></tr>
    <tr><td><code>-y, --yes</code></td><td>Automatically confirm update</td></tr>

    <tr>
      <td><code>--json</code></td>
      <td>Emit the full JSON payload (mutually exclusive with <code>-q</code>)</td>
    </tr>

    <tr>
      <td><code>-q, --query stringArray</code></td>
      <td>jq filter for value extraction (see <a href="/docs/cli/query-output">Query output with <code>-q</code></a>)</td>
    </tr>
  </tbody>
</table>

### Examples

```bash theme={null}
nscale securitygroups update --id <sg-id> --file securitygroup.json
nscale securitygroups update --id <sg-id> --stdin < securitygroup.json
cat securitygroup.json | nscale securitygroups update --id <sg-id> --stdin
```

***

## delete

Delete an existing security group.

```bash theme={null}
nscale securitygroups delete --id <sg-id> --org <org-id> [flags]
```

### Flags

| Flag           | Description                                    |
| -------------- | ---------------------------------------------- |
| `--id string`  | Security group ID                              |
| `--org string` | Organization ID                                |
| `--dry-run`    | Preview the request payload without persisting |
| `-y, --yes`    | Automatically confirm deletion                 |

***

## Related

<CardGroup cols={2}>
  <Card title="Instances (Console)" icon="browser" href="/docs/compute/create-new-instances">
    Security groups are configured during instance creation.
  </Card>
</CardGroup>
