This repository demonstrates how to call the MongoDB Atlas Administration API using Service Account authentication. You can read the accompanying article on MongoDB blog for more information.
To connect to the Atlas Administration API, you need to generate an Service Account. Make sure you add your IP address in the API access list!
Then, export the following environment variables, where MONGODB_ATLAS_CLIENT_ID
is your public key and MONGODB_ATLAS_CLIENT_SECRET
is your private key.
export MONGODB_ATLAS_CLIENT_ID=<client_id>
export MONGODB_ATLAS_CLIENT_SECRET<client_secret>
The repository includes request examples for Python, Node.js and Ruby.
To run the Python example, execute:
cd python
pip install -r requirements.txt
python ./python-example.py
To run the Node.js example, execute:
cd node
npm install
node ./node-example.js
To run the Golang SDK example, execute:
cd golang
export MONGODB_ATLAS_ORG_ID=<id of your atlas organiation> # For example 6707a96bc2b066602a4dfdcc
go run ./sdk-example.go
Examples are not a supported MongoDB product and serve informational purpose only. External libraries used in the examples are not officially maintained by MongoDB. Do not use in production.