Navigation

mongocli atlas whitelist list

On this page

The whitelist list command retrieves all the clusters in the specified Atlas project. You can also retrieve all the clusters through the Atlas UI or API.

Syntax

mongocli atlas whitelist list|ls
     [ --limit <number-of-items-per-page> ]
     [ --output|-o <output-format> ]
     [ --page <page-number> ]
     [ --profile|-P <profile-name> ]
     [ --projectId <id-of-project> ]

Options

Option Type Description Required?
--limit integer Number of items per page, up to a maximum of 500. Defaults to 100 if not specified. no
--output, -o string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

no
--page integer Page number (1-based). Defaults to 1 if not specified. no
--profile, -P string Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. no
--projectId string Unique identifier of the project that contains the cluster to update. If omitted, uses the project ID in the profile or environment variable. no

Output

The command prints the following fields in the specified format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

Field Description
groupId Unique identifier of the project.
cidrBlock Whitelist entry in Classless Inter-Domain Routing (CIDR) notation. Mutually exclusive with awsSecurityGroup and ipAddress.
ipAddress Whitelisted IP address. Mutually exclusive with awsSecurityGroup and ciderBlock.
deleteAfter Date in ISO 8601 format after which Atlas deletes the whitelist entry.
awsSecurityGroup Whitelisted ID of an AWS security group. Mutually exclusive with cidrBlock and ipAddress.
comment Description of the whitelist entry.

Example

The following example uses the mongocli atlas whitelist list command to retrieve the list of whitelisted IP addresses and CIDR blocks in the specified project. It uses the default profile to access the project.

mongocli atlas whitelist list --output json --projectId 5e1234c17a3e5a48f5497de3

The previous command prints the following fields in the specified format to the terminal. To learn more about these fields, see Output.

[
  {
    "groupId": "5e1234c17a3e5a48f5497de3",
    "cidrBlock": "192.0.2.0/24",
    "ipAddress": "192.0.2.0",
    "comment": "Work"
  },
  {
    "groupId": "5e1234c17a3e5a48f5497de3",
    "cidrBlock": "198.51.100.0/24",
    "ipAddress": "198.51.100.0",
    "comment": "Home"
  },
  {
    "groupId": "5e1234c17a3e5a48f5497de3",
    "awsSecurityGroup": "sg-903004f8",
    "comment": "AWS Securty Group"
  }
]