An automated setup to deploy a MongoDB Cluster with a Replica Set (1 Primary, n Secondary nodes)
This project creates in AWS a VPC, Public/Private subnets, a Jumpbox server in the public subnet, and a MongoDB cluster in the private subnets
- Clone this repository
- cd into the repository
- Edit the variables in the terraform.tfvars file
vpc_name = "mongo_vpc"
replica_set_name = "mongoRs"
num_secondary_nodes = 2
mongo_username = "admin"
mongo_password = "mongo4pass"
mongo_database = "admin"
- Set up the AWS CLI on your development machine and configure the ~/.aws/credentials file
[default]
aws_access_key_id = xxxxxxxxxxxxxxxxxx
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Install Terraform on your development machine
-
Use "terraform init" to initialize the modules
-
Use "terraform plan" to view the resources that would be created
-
Use "terraform apply" to deploy the cluster