MongoDB Replica

This stack creates a MongoDB replica:
- Create N number of replicas into an existing VPC
- Create one data volume per VM
- Generate MongoDB keys (SSH, PEMs, and keyfile)
- Place MongoDB cluster in private subnet
- Configure MongoDB replica through a bastion host
- Limit access through existing database security group
Prerequisites
Complete the Getting Started guide for creating VPC.
Add Project to Config0
- Go to Home → click Add Project
- Select and click launch-config0 as the launch repository
- Type branch name: mongodb
- Add project name: mongodb-101
- Click Add Project
Customized config0.yml
You can create your own config0.yml file (optional).
Sample starter:
global:
arguments:
aws_default_region: eu-west-1
cloud_tags_hash:
environment: dev
purpose: eval-config0
database: mongodb
product: ec2
database_type: nosql
metadata:
labels:
general:
environment: dev
purpose: eval-config0
infrastructure:
cloud: aws
product: mongodb
matchSelectors:
network_vars:
labels:
environment: dev
purpose: eval-config0
area: network
region: eu-west-1
cloud: aws
infrastructure:
mongodb_replica:
stack_name: config0-publish:::mongodb_replica_on_ec2
arguments:
vpc_name: selector:::network_vars::vpc_name
vpc_id: selector:::network_vars::vpc_id
subnet_ids: selector:::network_vars::private_subnet_ids
sg_id: selector:::network_vars::db_sg_id
bastion_sg_id: selector:::network_vars::bastion_sg_id
bastion_subnet_ids: selector:::network_vars::private_subnet_ids
mongodb_cluster: mongodb-cluster-dev
ami_filter: Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*
ami_owner: 099720109477
bastion_ami_filter: Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*
bastion_ami_owner: 099720109477
bastion_destroy: true
instance_type: t3.micro
num_of_replicas: 3
disksize: 25
volume_size: 25
volume_mount: /var/lib/mongodb
volume_fstype: xfs
mongodb_username: admin123
mongodb_password: admin123
publish_to_saas: true
spec:
serialization:
to_base64:
arguments:
- cloud_tags_hash
metadata:
matchSelectors:
- network_vars