BACKGROUND IMAGE: iSTOCK/GETTY IMAGES
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.
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.
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.
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.
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.
AWS eyes IDE add with Cloud9 acquisition
Get support for your AWS dev project
Application development in AWS complicated by services