MEAN Stack with AWS Fargate on AWS

Partner Solution Deployment Guide


April 2023
Zuhair Ahmed, MongoDB Inc.
Vinod Shukla, AWS Integration & Automation team

Refer to the GitHub repository to view source files, report bugs, submit feature ideas, and post feedback about this Partner Solution. To comment on the documentation, refer to Feedback.

This Partner Solution was created by MongoDB Inc. in collaboration with Amazon Web Services (AWS). Partner Solutions are automated reference deployments that help people deploy popular technologies on AWS according to AWS best practices. If you’re unfamiliar with AWS Partner Solutions, refer to the AWS Partner Solution General Information Guide.


This guide covers the information you need to deploy the MEAN Stack with AWS Fargate Partner Solution in the AWS Cloud.

Costs and licenses

There is no cost to use this Partner Solution, but you will be billed for any AWS services or resources that this Partner Solution deploys. For more information, refer to the AWS Partner Solution General Information Guide.

This Partner Solution deploys MongoDB Atlas resources with the latest stable MongoDB enterprise version, which is licensed and distributed under the Server Side Public License (SSPL).


Deploying this Partner Solution with default parameters builds the following MEAN Stack with AWS Fargate environment in the AWS Cloud.

Figure 1. Partner Solution architecture for MEAN Stack with AWS Fargate on AWS

As shown in Figure 1, this Partner Solution sets up the following:

  • A virtual private cloud (VPC) for the MongoDB Atlas project that spans at least three Availability Zones. This includes a fully managed MongoDB Atlas cluster and a database user.

  • An AWS PrivateLink connection between your VPC and the MongoDB Atlas VPC.

  • A VPC that spans two Availability Zones. The VPC is configured with public subnets, according to AWS best practices, to provide you with your own virtual network on AWS.

  • In the public subnets, managed NAT gateways to allow outbound internet access.

    • An Amazon Elastic Container Service (Amazon ECS) task and service with the AWS Fargate launch type for the containerized Angular client application using the user-provided Amazon Elastic Container Registry (Amazon ECR) image URI.

    • An AWS Cloud Map entry for the service discovery.

    • An Amazon ECS task and service with the Fargate launch type for the containerized server application using the user-provided Amazon ECR image URI.

    • An Application Load Balancer to distribute incoming traffic to client applications.

  • An AWS Cloud Map to create a private namespace based on Domain Name Service (DNS), which will be visible only inside the specified Amazon VPC.

  • Amazon ECR for storing images for client and server applications.

  • Fargate to run your containerized applications without the need to provision and manage the underlying infrastructure.

Deployment options

This Partner Solution provides the following deployment options:

Predeployment steps

Prepare your AWS account

This Partner Solution uses MongoDB Atlas CloudFormation resource types and automatically activates them in the AWS Region of your choice. Once it’s running, you can safely skip this step for additional deployments in each Region by setting the ActivateMongoDBResources parameter to No.

Prepare your MongoDB Inc. account

A MongoDB Atlas programmatic API key must be generated with the appropriate permissions and network access entries so AWS CloudFormation can successfully authenticate the MongoDB cloud. For more information about creating and managing API keys, refer to Get Started with the Atlas Administration API.

After creating the programmatic API key, store it as a secret in AWS Secrets Manager with the following naming convention: cfn/atlas/profile/${ProfileName}. Use this CloudFormation template to create the secret in the AWS Region where this Partner Solution will be deployed.

Create Amazon ECR images for client and server applications

Containerized applications for the client and server are required to be uploaded to Amazon ECR. For more details on creating container images see the example code provided in this GitHub repository.

Deployment steps

  1. Sign in to your AWS account, and launch this Partner Solution, as described under Deployment options. The AWS CloudFormation console opens with a prepopulated template.

  2. Choose the correct AWS Region, and then choose Next.

  3. On the Create stack page, keep the default setting for the template URL, and then choose Next.

  4. On the Specify stack details page, change the stack name if needed. Review the parameters for the template. Provide values for the parameters that require input. For all other parameters, review the default settings and customize them as necessary. When you finish reviewing and customizing the parameters, choose Next.

    Unless you’re customizing the Partner Solution templates or are instructed otherwise in this guide’s Predeployment section, don’t change the default settings for the following parameters: QSS3BucketName, QSS3BucketRegion, and QSS3KeyPrefix. Changing the values of these parameters will modify code references that point to the Amazon Simple Storage Service (Amazon S3) bucket name and key prefix. For more information, refer to the AWS Partner Solutions Contributor’s Guide.
  5. On the Configure stack options page, you can specify tags (key-value pairs) for resources in your stack and set advanced options. When you finish, choose Next.

  6. On the Review page, review and confirm the template settings. Under Capabilities, select all of the check boxes to acknowledge that the template creates AWS Identity and Access Management (IAM) resources that might require the ability to automatically expand macros.

  7. Choose Create stack. The stack takes about 10-20 minutes to deploy.

  8. Monitor the stack’s status, and when the status is CREATE_COMPLETE, the MEAN Stack with AWS Fargate deployment is ready.

  9. To view the created resources, choose the Outputs tab.

Postdeployment steps

Test the deployment

When the deployment completes, locate the Outputs tab and search for the ClientURL key. Use that value to open the MEAN Stack web application.


For troubleshooting common Partner Solution issues, refer to the AWS Partner Solution General Information Guide and Troubleshooting CloudFormation.

Customer responsibility

After you deploy a Partner Solution, confirm that your resources and services are updated and configured—including any required patches—to meet your security and other needs. For more information, refer to the Shared Responsibility Model.


To submit feature ideas and report bugs, use the Issues section of the GitHub repository for this Partner Solution. To submit code, refer to the Partner Solution Contributor’s Guide. To submit feedback on this deployment guide, use the following GitHub links:


This document is provided for informational purposes only. It represents current AWS product offerings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS products or services, each of which is provided "as is" without warranty of any kind, whether expressed or implied. This document does not create any warranties, representations, contractual commitments, conditions, or assurances from AWS, its affiliates, suppliers, or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers.

The software included with this paper is licensed under the Apache License, version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at or in the accompanying "license" file. This code is distributed on an "as is" basis, without warranties or conditions of any kind, either expressed or implied. Refer to the License for specific language governing permissions and limitations.