Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

MEAN stack on AWS and JavaScript team for fast app builds

MongoDB, Express, AngularJS and Node.js come together in full-stack JavaScript applications. AWS supports these MEAN stacks with a variety of services.

Developers have numerous options when it comes to building web applications. There are countless frameworks and...

languages available, and cloud platforms like AWS make it easy to deploy and scale apps.

The MEAN stack, which consists of MongoDB, Express, AngularJS and Node.js, is one of the most common web development frameworks used on AWS. The MEAN framework is comprised of all the components required to build a full-stack JavaScript web application.

MongoDB is the NoSQL database back end, which can store data for an application. Express is a minimal Node.js framework that makes it easy to build server-side web applications with Javascript. AngularJS is a client-side Javascript framework used to build dynamic web front ends. And Node.js is a server-side platform built on Google Chrome's JavaScript Engine for building network enabled applications. Developers can use these components to deploy a MEAN stack on AWS.

MEAN stack on EC2

To install the MEAN stack on a single Elastic Compute Cloud (EC2) instance, download Node.js and MongoDB. There are a couple of other dependencies a developer needs to install for handling builds and managing front-end packages, including Gulp and Bower. Once all of the prerequisites are installed, download the mean-cli package from NPM. This gives developers access to the MEAN command-line interface, which provides the ability to install, manage and update the application.

Running the MEAN stack on AWS with Docker containers allows developers to get started quickly.

It's suitable to run a MEAN stack on AWS with a single EC2 instance, but single points of failure should be eliminated from production applications.

It's common to see the database tier of the application running on its own set of EC2 instances. In this model, IT teams can host a MongoDB replica set on multiple EC2 instances -- with a primary instance and one or more secondary instances spread across multiple availability zones. If the primary instance fails, one of the secondary instances takes over to become the new primary instance, providing automatic failover. This architecture eliminates single points of failure for the database tier of the application; it also provides geographic redundancy, as AWS availability zones are physically distinct data centers.

When building on top of the MongoDB replica set, a minimum of two EC2 instances can host remaining components. Both the application front end built with AngularJS, and the back end written in JavaScript with Express and Node.js can run on each server. Developers can also use an Auto Scaling group, which spins up additional instances configured in this same manner to dynamically support a sudden increase in end-user requests. In each case, developers can use Elastic Load Balancing to maintain server health.

MEAN stack in Docker Containers

In addition to running the MEAN stack on AWS with EC2 instances, developers use containers as a common alternative. This is especially true for IT teams that already use containers for other applications. Running the MEAN stack on AWS with Docker containers allows developers to get started quickly.

Instead of installing all of the prerequisites on an EC2 instance, developers can simply pull the MEAN image from Docker Hub. When running the image in a container, the IT team will have everything it needs to start building a MEAN deployment.

For production environments, developers can use multiple containers for high availability and scalability. The database tier can run within its own container or across multiple containers; developers can use the MEAN image on the Docker hub to quickly build the database tier.

For large-scale applications that require multiple containers, Amazon EC2 Container Service (ECS) can help manage and scale containers across multiple EC2 instances.

MEAN deployment in Elastic Beanstalk

It's not easy for developers to build a scalable and highly available application. If they don't want to get bogged down with all of the infrastructure work required to support AWS Auto Scaling and high availability, AWS Elastic Beanstalk is an easier alternative.

Developers can monitor and manage the application using both graphical and command-line tools, and can focus on developing applications while Elastic Beanstalk handles everything else. The service can build environments comprised of EC2 instances or Docker containers.

Get a grasp on QA, load balancing in AWS

AWS Elastic Load Balancing is an important component of application development in AWS; QA testing is the next critical step. How well do you know these AWS features and processes? Take this quiz and find out.

MEAN stack with serverless components

One emerging development pattern is to remove servers from the architecture to instead make use of managed services. The end result is a scalable and resilient application architecture that minimizes the amount of server infrastructure a developer must manage.

For example, the front end for a MEAN stack application built with AngularJS is comprised of HTML and JavaScript files. These static assets can be stored in Amazon Simple Storage Service and served up with the Amazon CloudFront content delivery network service.

Express can run inside AWS Lambda running the Node.js runtime. AWS Lambda allows developers to run code without provisioning or managing servers. Developers create Lambda functions that run as a service on the AWS platform, and they can create a managed API via Amazon API Gateway to provide access to AWS Lambda through HTTP. With this model, IT teams build the back-end API with AWS Lambda and Amazon API Gateway; the front-end application code calls the API via HTTP.

The last piece of the puzzle is the database tier. EC2 instances or Docker containers can run one or more MongoDB servers. But if the overall goal is to eliminate servers that developers have to manage, DynamoDB, which is the AWS cloud-hosted NoSQL database service, can replace the MongoDB layer.

Building a serverless model is certainly on the bleeding edge, but it is an interesting approach for developers who want to reduce the amount of server infrastructure they need to provision and manage. A recently released reference architecture that includes code samples and guidance on how to build a MEAN stack on AWS can help enterprise IT get started with this task.

Next Steps

AWS eyes IDE add with Cloud9 acquisition

Get support for your AWS dev project

Application development in AWS complicated by services

This was last published in November 2016

Essential Guide

Top JavaScript frameworks accelerate software development

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What languages do you use to develop applications in AWS?
Cancel

-ADS BY GOOGLE

SearchCloudApplications

TheServerSide.com

SearchSoftwareQuality

SearchCloudComputing

Close