turbot/mongodbatlas
steampipe plugin install mongodbatlas

Table: mongodbatlas_cluster - Query MongoDB Atlas Clusters using SQL

MongoDB Atlas is a fully managed cloud database service for modern applications. It provides an easy way to deploy, operate, and scale MongoDB in the cloud, removing the operational burden from your shoulders and making it easy to focus on building your applications. MongoDB Atlas Clusters are the heart of your MongoDB deployments, where your data is stored and from where it is served.

Table Usage Guide

The mongodbatlas_cluster table provides insights into MongoDB Atlas Clusters. As a Database Administrator or Developer, you can explore cluster-specific details through this table, including configuration, status, and statistics. Utilize it to uncover information about clusters, such as their current operational status, the configuration settings in use, and performance statistics, which can be useful for monitoring and troubleshooting.

Examples

Basic info

Explore which MongoDB Atlas clusters are associated with specific project IDs to streamline project management and resource allocation.

select
id,
name,
project_id
from
mongodbatlas_cluster;
select
id,
name,
project_id
from
mongodbatlas_cluster;

Get auto-scaling details of all clusters

Explore the auto-scaling configurations of your clusters to understand if automatic indexing, disk space adjustments, and scale-down options are enabled. This can be useful in managing resources and optimizing performance in your database environment.

select
id,
name,
auto_scaling ->> 'autoIndexingEnabled' as auto_scaling_auto_indexing_enabled,
auto_scaling ->> 'diskGBEnabled' as auto_scaling_diskgb_enabled,
auto_scaling -> 'compute' ->> 'enabled' as auto_scaling_compute_enabled,
auto_scaling -> 'compute' ->> 'scaleDownEnabled' as autos_caling_compute_scale_down_enabled
from
mongodbatlas_cluster;
select
id,
name,
json_extract(auto_scaling, '$.autoIndexingEnabled') as auto_scaling_auto_indexing_enabled,
json_extract(auto_scaling, '$.diskGBEnabled') as auto_scaling_diskgb_enabled,
json_extract(auto_scaling, '$.compute.enabled') as auto_scaling_compute_enabled,
json_extract(auto_scaling, '$.compute.scaleDownEnabled') as autos_caling_compute_scale_down_enabled
from
mongodbatlas_cluster;

Get connection details for clusters

Discover the connection details for clusters to better manage and troubleshoot your MongoDB Atlas setup. This helps in simplifying the process of connecting to your clusters.

select
id,
name,
connection_strings ->> 'standardSrv' as conn_str_standard_srv,
connection_strings ->> 'standard' as conn_str_standard
from
mongodbatlas_cluster;
select
id,
name,
json_extract(connection_strings, '$.standardSrv') as conn_str_standard_srv,
json_extract(connection_strings, '$.standard') as conn_str_standard
from
mongodbatlas_cluster;

Get all clusters which are replica sets

Determine the areas in which MongoDB Atlas clusters are functioning as replica sets. This can help in managing resource allocation and understanding the distribution of your database workloads.

select
id,
name
from
mongodbatlas_cluster
where
num_shards = 1;
select
id,
name
from
mongodbatlas_cluster
where
num_shards = 1;

List clusters with provider backups disabled

Discover the segments that have provider backups disabled in MongoDB Atlas clusters. This can help identify potential risk areas where data might not be recoverable in the event of a system failure.

select
name,
cluster_type,
provider_backup_enabled
from
mongodbatlas_cluster
where
provider_backup_enabled = false;
select
name,
cluster_type,
provider_backup_enabled
from
mongodbatlas_cluster
where
provider_backup_enabled = 0;

Schema for mongodbatlas_cluster

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
auto_scalingjsonbCollection of settings that configures auto-scaling information for the cluster.
bi_connectorjsonbConfiguration settings applied to BI Connector for Atlas on this cluster.
cluster_typetextType of the cluster.
connection_stringsjsonbSet of connection strings that your applications use to connect to this cluster.
disk_size_gbdouble precisionCapacity, in gigabytes, of the host's root volume. Increase this number to add capacity, up to a maximum possible value of 4096 (i.e., 4 TB). This value must be a positive number.
encryption_at_rest_providertextCloud service provider that offers Encryption at Rest.
idtextUnique 24-hexadecimal digit string that identifies the cluster.
labelsjsonbCollection of key-value pairs that tag and categorize the cluster. Each key and value has a maximum length of 255 characters.
mongo_uritextBase connection string for the cluster.
mongo_uri_updatedtimestamp with time zoneTimestamp when the connection string was last updated.
mongo_uri_with_optionstextConnection string for connecting to the Atlas cluster. Includes the replicaSet, ssl, and authSource query parameters in the connection string with values appropriate for the cluster.
mongodb_major_versiontextMongoDB Version of the cluster.
mongodb_versiontextVersion of MongoDB that the cluster is running, in X.Y.Z format.
nametext=The name of the cluster as it appears in Atlas.
num_shardsbigintPositive integer that specifies the number of shards for a sharded cluster. If this is set to 1, the cluster is a replica set. If this is set to 2 or higher, the cluster is a sharded cluster with the number of shards specified.
pausedbooleanFlag that indicates whether the cluster has been paused.
pit_enabledbooleanFlag that indicates whether the cluster uses continuous cloud backups. More information is available at https://www.mongodb.com/docs/atlas/backup/cloud-backup/overview/#continuous-cloud-backups.
project_idtext=Unique identifier of the project that this cluster belongs to.
provider_backup_enabledbooleanFlag that indicates if the cluster uses Back Up Your Database Deployment for backups.
provider_settingsjsonbConfiguration for the provisioned hosts on which MongoDB runs. The available options are specific to the cloud service provider.
replication_factorbigintNumber of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy.
replication_specjsonbConfiguration of each region in the cluster. Each element in this object represents a region where Atlas deploys your cluster.
replication_specsjsonbConfiguration for each zone in a Global Cluster. Each object in this array represents a zone where Atlas deploys nodes for your Global Cluster.
srv_addresstextConnection string for connecting to the Atlas cluster. The +srv modifier forces the connection to use TLS. The mongoURI parameter lists additional options.
state_nametextCondition in which the API resource finds the cluster when you called the resource. The resource returns one of the following states: IDLE, CREATING, UPDATING, DELETING, DELETED, REPAIRING.
titletextTitle of the resource.
version_release_systemtextRelease cadence that Atlas uses for this cluster.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- mongodbatlas

You can pass the configuration to the command with the --config argument:

steampipe_export_mongodbatlas --config '<your_config>' mongodbatlas_cluster