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_idfrom mongodbatlas_cluster;
select id, name, project_idfrom 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_enabledfrom 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_enabledfrom 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_standardfrom mongodbatlas_cluster;
select id, name, json_extract(connection_strings, '$.standardSrv') as conn_str_standard_srv, json_extract(connection_strings, '$.standard') as conn_str_standardfrom 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, namefrom mongodbatlas_clusterwhere num_shards = 1;
select id, namefrom mongodbatlas_clusterwhere 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_enabledfrom mongodbatlas_clusterwhere provider_backup_enabled = false;
select name, cluster_type, provider_backup_enabledfrom mongodbatlas_clusterwhere provider_backup_enabled = 0;
Schema for mongodbatlas_cluster
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
auto_scaling | jsonb | Collection of settings that configures auto-scaling information for the cluster. | |
bi_connector | jsonb | Configuration settings applied to BI Connector for Atlas on this cluster. | |
cluster_type | text | Type of the cluster. | |
connection_strings | jsonb | Set of connection strings that your applications use to connect to this cluster. | |
disk_size_gb | double precision | Capacity, 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_provider | text | Cloud service provider that offers Encryption at Rest. | |
id | text | Unique 24-hexadecimal digit string that identifies the cluster. | |
labels | jsonb | Collection of key-value pairs that tag and categorize the cluster. Each key and value has a maximum length of 255 characters. | |
mongo_uri | text | Base connection string for the cluster. | |
mongo_uri_updated | timestamp with time zone | Timestamp when the connection string was last updated. | |
mongo_uri_with_options | text | Connection 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_version | text | MongoDB Version of the cluster. | |
mongodb_version | text | Version of MongoDB that the cluster is running, in X.Y.Z format. | |
name | text | = | The name of the cluster as it appears in Atlas. |
num_shards | bigint | Positive 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. | |
organization_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the organization. |
paused | boolean | Flag that indicates whether the cluster has been paused. | |
pit_enabled | boolean | Flag 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_id | text | = | Unique identifier of the project that this cluster belongs to. |
provider_backup_enabled | boolean | Flag that indicates if the cluster uses Back Up Your Database Deployment for backups. | |
provider_settings | jsonb | Configuration for the provisioned hosts on which MongoDB runs. The available options are specific to the cloud service provider. | |
replication_factor | bigint | Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. | |
replication_spec | jsonb | Configuration of each region in the cluster. Each element in this object represents a region where Atlas deploys your cluster. | |
replication_specs | jsonb | Configuration for each zone in a Global Cluster. Each object in this array represents a zone where Atlas deploys nodes for your Global Cluster. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
srv_address | text | Connection string for connecting to the Atlas cluster. The +srv modifier forces the connection to use TLS. The mongoURI parameter lists additional options. | |
state_name | text | Condition 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. | |
title | text | Title of the resource. | |
version_release_system | text | Release 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