turbot/mongodbatlas
steampipe plugin install mongodbatlas

MongoDB Atlas + Steampipe

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

MongoDB Atlas is a multi-cloud data platform powered by MongoDB.

Example query:

select
id,
name
from
mongodbatlas_project;
+--------------------------+-----------+
| id | name |
+--------------------------+-----------+
| 6272xxxxxxxxxxxxxxxxec00 | Project 1 |
+--------------------------+-----------+

Documentation

Get started

Install

Download and install the latest MongoDB Atlas plugin

steampipe plugin install mongodbatlas

Configuration

Installing the latest mongodbatlas plugin will create a config file (~/.steampipe/config/mongodbatlas.spc) with a single connection named mongodbatlas:

connection "mongodbatlas" {
plugin = "mongodbatlas"
# See https://www.mongodb.com/docs/atlas/configure-api-access/#create-an-api-key-in-an-organization
# for information on how to generate API keys.
# Public key of the API key.
# Can also be set with the MONGODB_ATLAS_PUBLIC_API_KEY environment variable.
# public_key = "hnxxxxxo"
# Private key of the API key.
# Can also be set with the MONGODB_ATLAS_PRIVATE_API_KEY environment variable.
# private_key = "xxxxxxxx-xxxx-4xxx-axxx-dxxxxxxxd9fc"
}
  • public_key - (optional) The API public key from the MongoDB Atlas console. Can also be set with the MONGODB_ATLAS_PUBLIC_API_KEY environment variable.
  • private_key - (optional) The API private key from the MongoDB Atlas console. Can also be set with the MONGODB_ATLAS_PRIVATE_API_KEY environment variable.

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

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

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

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_mongodbatlas;
CREATE SERVER steampipe_mongodbatlas FOREIGN DATA WRAPPER steampipe_postgres_mongodbatlas OPTIONS (config '<your_config>');
CREATE SCHEMA mongodbatlas;
IMPORT FOREIGN SCHEMA mongodbatlas FROM SERVER steampipe_mongodbatlas INTO mongodbatlas;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

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

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

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_mongodbatlas function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_mongodbatlas.so
sqlite> select steampipe_configure_mongodbatlas('<your_config>');

Export

This plugin is available as a standalone Export 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>' <table_name>