Modal Title
Data / DevOps Tools / Software Development

MongoDB Atlas (Finally) Gets a Command-Line Interface

The Atlas CLI is Atlas’s new dedicated command line interface that allows customers to manage Atlas’s services through the command line rather than the GUI, which used to be a requirement.
Jun 17th, 2022 8:28am by
Featued image for: MongoDB Atlas (Finally) Gets a Command-Line Interface

The command-line interface is where developers live and breathe on a daily basis so it’s no surprise that MongoDB’s new command-line interface (CLI) for its Atlas database service was greeted with open arms by customers during a limited release and received with a loud cheer during the keynote at the MongoDB World conference last week.

The Atlas CLI is Atlas’s new dedicated command-line interface that allows customers to manage Atlas’s services through the command line rather than the GUI, which used to be a requirement. Not to be confused with mongo shell which is another command-line tool already in existence but was limited to data queries, updates, and more administrative tasks. Atlas CLI works hand in hand with Mongo shell and they are distributed together.

With the general launch date goal of set for the start of the conference, the team did a much earlier soft launch internally to start testing features, working on documentation, and improving/adding functionality. One of the earliest functions of the CLI was OIDC authentication.

“Previously you had to use API keys and the process to get there was cumbersome so we started with Atlas login experience which is seamless right now; you just enter your username and password and authenticate in the CLI,” said MongoDB product manager Jakub Lazinski, in an interview with The New Stack.

The next thing the CLI team tacked was the onboarding experience, the Atlas setup; the MongoDB CLI now makes it easier to get started with Atlas.

“With the onboarding experience, the cool part is that we configure a lot of the things you had to do manually before,” said Lazinski, about how the CLI streamlines Atlas’ workflow. What used to take several steps to get up and running can now be done in a few keystrokes with the command line.

The CLI is feature-rich, including database creation, cluster creation, loading sample data, deploying to a testing environment, and many other options.  The CLI will grow as Alas does and the team intends to keep the CLI up to date. 

“When a new feature comes to Atlas, it takes one, maybe two days to add to the CLI,” said Gustavo Bazan, the MongoDB engineer who created the CLI.

For Devs by Devs

Like most of the products announced at MongoDB World Conference 2022, Atlas CLI is a developer tool though this one truly is solely a tool for developers by developers.

When asked how this project got started Bazan exclaimed, “The CLI is my baby!” Bazan started working at MongoDB about three years ago. One of his first job duties, a repetitive task required him to use the GUI and prompted him to ask around with the purpose of seeing if there was a CLI or any way to automate to allow him to focus his efforts elsewhere. There was not.

Fast forward to MongoDB’s annual hackathon, Skunkworks. This is when MongoDB employees have a designated week to work across teams on projects and ideas that are not focused on the critical path.

Bazan chose to use his Skunkworks time building out a primitive CLI prototype with very limited functionality. Though lean, it had just enough capability to garner support from product and the engineering leadership team.

Engineering Team and Technical Challenges

One of the earlier challenges with the CLI project was getting dedicated time on the calendar but this is really where the engineering leadership and product teams came into play. After championing the project, a quarter of dedicated time and an additional engineer, bringing the total to two engineers dedicated to the project full time.

But the challenges didn’t stop there as Bazan says “I knew what a CLI was but never built one.”

The team chose to write in golang and use the Cobra CLI framework, which was new to everyone. So there was a technical learning curve but slowly everything came together.

The original MVP functionality was to create a cluster and a database user. It was a slow step-by-step learning process of, “This is how you create a cluster, this is how you do these things, this is how they all come together,” Bazan said.

One key learning takeaway was that the CLI experience needs to be very human-friendly. Bazan said. “At some point, we dedicated a chunk of time to improving error handling and how we displayed things because we were basically just throwing out JSONs that were returning from the server.”

There are now four engineers dedicated to the CLI full-time and more features in the pipeline, though there are no official release dates for anything else at this time.

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.