Skip to content

This script inventories indexes in any MongoDB Atlas clusters you have permission to view and outputs to a JSON file

Notifications You must be signed in to change notification settings

jscanzoni/atlas_index_inventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB Atlas Index Inventory

This script will inventory indexes in any MongoDB Atlas clusters you have permission to view and output it to a JSON file.

This script will first use the Atlas API to:

  • find all projects
  • find all clusters
  • grab the connection string

Using the connection string and the PyMongo driver for each cluster:

  • find all databases
  • find all collections
  • grab indexes from each collection

The output will either push formatted JSON to the outFile you define in your .env file or it will output in JSON into the terminal window if it can't access the outFile for whatever reasons.

Instructions

The script also requires credentials which are stored in a .env file with the following contents:

#contents of .env file

apiPub = "abcdefgh"
apiPriv = "11111111-1111-1111-1111-111111111111"
driverCreds = "user:pass"
outFile = "/path/to/output/index_inventory.json"

To run the script:

  • API credentials will require Project Read Only permission for each project
  • Database/driver credentials will require readAnyDatabase permission

About

This script inventories indexes in any MongoDB Atlas clusters you have permission to view and outputs to a JSON file

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published