Get Started with MongoDB Atlas and AWS CloudFormation
Rate this code example
It's pretty amazing that we can now deploy and control massive systems in the cloud from our laptops and phones. And it's so easy to take for granted when it all works, but not so awesome when everything is broken after coming back on Monday morning after a long weekend! On top of that, the tooling that's available is constantly changing and updating and soon you are drowning in dependabot PRs.
The reality of setting up and configuring all the tools necessary to deploy an app is time-consuming, error-prone, and can result in security risks if you're not careful. These are just a few of the reasons we've all witnessed the incredible growth of DevOps tooling as we continue the evolution to and in the cloud.
is an infrastructure-as-code (IaC) service that helps you model and set up your Amazon Web Services resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS. CloudFormation, or CFN, let's users create and manage AWS resources directly from templates which provide dependable out of the box blueprint deployments for any kind of cloud app.
To better serve customers using modern cloud-native workflows, MongoDB Atlas supports native CFN templates with a new set of Resource Types. This new integration allows you to manage complete MongoDB Atlas deployments through the AWS CloudFormation console and CLI so your apps can securely consume data services with full AWS cloud ecosystem support.
We created a helper project that walks you through an end-to-end example of setting up and launching a MongoDB Atlas stack in AWS CloudFormation.
The project has two main parts: "get-setup' will deploy and configure the MongoDB Atlas CloudFormation resources into the AWS region of your choice, while "get-started' will launch your complete Atlas deployment.
Run the get-started script:
Once the stack is launched, you will start to see resources getting created in the AWS CloudFormation console. The Atlas cluster takes a few minutes to spin up completely, and you can track the progress in the console or through the AWS CLI.
Once your MongoDB Atlas cluster is deployed successfully, you can find its connection string under the Outputs tab as the value for the "ClusterSrvAddress' key.