In the first post of this three-part series, we discussed the strengths and weaknesses of various types of NoSQL databases. In the second post, we compared the features of the two most popular NoSQL databases: MongoDB and Cassandra. In this final article, we will discuss best practices for hosting NoSQL databases on Amazon Elastic Compute Cloud (Amazon EC2). Amazon EC2 offers multiple compute and storage options catering to the varied requirements of NoSQL workloads. Using Amazon EC2 with other services in the Amazon Web Services (AWS) ecosystem, such as Amazon Cloud Watch and 1-Click Launch from Amazon Marketplace, provides additional advantages.
Recommended Best PracticesSome of the best practices recommended for hosting NoSQL databases on Amazon EC2 are:
Multiple Deployment OptionsWith the help of AWS regions and Availability Zones, Amazon EC2 offers multiple deployment options that provide highly available workloads. However, enabling high availability requires network and security level planning and configuration. Also, the various deployment models add latency to write operations (for eventual consistency), which comes at a financial cost.
Single Region and Multiple Availability ZonesSetting up a MongoDB cluster in a new Amazon Virtual Private Cloud (Amazon VPC) on AWS requires the following deployment and configurations:
- Amazon VPC must be configured across all three availability zones with required subnets.
- Public subnets should allow outbound communication of private subnets via the NAT gateways.
- Bastion hosts must be configured to allow secure communication with Amazon EC2 instances present in both public and private subnets.
- Amazon Identity and Access Management (AIM) roles must be created to provide the required access for deployment.
- MongoDB clusters should be set up in private subnets, along with the replica sets in different availability zones.