doctl Verified current stable Not installed? Documentation

Doctl / List Database Firewall Rules

List Database Firewall Rules

List all firewall rules for a specific database in DigitalOcean.

$
Terminal
doctl {d|databases} {fw|firewalls} {ls|list}

When To Use

Before making configuration changes to ensure compliance with security policies.

Pro Tip

Use `--format` flag to customize output for better readability in scripts.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
ID          | Type      | Source IP         | Created At
------------|-----------|-------------------|---------------------
1           | allow     | 192.168.1.10      | 2023-10-01 12:00:00
2           | allow     | 10.0.0.0/24      | 2023-09-15 09:30:00
3           | deny      | 203.0.113.0/24   | 2023-08-20 14:45:00

Anatomy of Output

Understanding the result

+---------------------+---------------------+---------+ Table Header

Indicates the columns of firewall rules.

| Rule ID | Type | Status | Row Details

Columns show the identifier, type, and status of each rule.

| 123456 | ip | active | Sample Rule

Example of a specific rule listed with its details.

Power User Variants

Optimized versions

doctl databases fw list --format json

List rules formatted as JSON.

doctl databases fw list --json

Retrieve rules in JSON format, useful for parsing.

Troubleshooting

Common pitfalls

Error: No firewall rules found.

Solution: Verify the database ID is correct.

Error: Database not accessible.

Solution: Check database status and your permissions.

Error: Unable to fetch firewall rules due to timeout.

Solution: Retry the command or check network conditions.

Command Breakdown

What each part is doing

doctl
Base Command
The executable that performs this operation. Here it runs Doctl before the shell applies any redirect operators.

How To Run

Execution path

  1. Step 1

    Run `doctl databases fw list` to view current firewall rules.

  2. Step 2

    Review the output for compliance with security policies.

  3. Step 3

    Document any necessary changes for approval.

Alternative Approaches

Comparable commands in other tools

Alternative documentation tools for the same job.