This repository demonstrates a production-ready MongoDB Atlas Landing Zone that enables organizations to:
- Standardize Infrastructure: Deploy MongoDB Atlas clusters using a "Golden Path" approach with pre-approved, secure configurations
- Enable Self-Service: Empower developers to provision databases through Backstage without learning Terraform or opening tickets
- Ensure Compliance: Automatically enforce security policies, backup schedules, auditing, and governance controls
- Reduce Operational Burden: Eliminate manual database operations through Infrastructure as Code and MongoDB's fully managed SaaS
Key Technologies:
- MongoDB Atlas: Fully managed database-as-a-service (SaaS)
- Terraform: Infrastructure as Code for consistent, repeatable deployments
- Backstage: Developer portal for self-service infrastructure provisioning
- Google Kubernetes Engine (GKE): Container orchestration for application workloads
- Private Service Connect: Secure, private connectivity between GCP and MongoDB Atlas
Quick Links:
- π Quick Start - Get started in minutes
- π Architecture Explained - Understand the design
- π Running Backstage - Launch the developer portal
- π Detailed Documentation - Deep dive into features
The diagram above illustrates the complete "Golden Path" architecture:
- Backstage UI: Self-service interface where developers request infrastructure
- Golden Path Template: Pre-configured form with guardrails (approved regions, cluster sizes, security settings)
- Self-Service Flow: Developers fill out a form β Backstage generates Terraform code β Creates Pull Request for review
The standard-stack module encapsulates all infrastructure components:
Foundation Layer:
- MongoDB Atlas Project creation
- Organizational policies and settings
Cluster Layer:
- GCP Finland (Private): M10 cluster with private endpoint connectivity
- AWS Stockholm (Public): M10 cluster for cross-cloud latency comparison
Security Layer:
- Database users with auto-generated passwords
- IP access lists (restrictive for production, open for demo)
- Private Link Endpoint for secure GCP connectivity
Network Layer:
- GCP VPC and subnets
- Private Service Connect (50 forwarding rules to Atlas)
- No internet exposure for database traffic
Compute Layer:
- GKE Autopilot cluster (fully managed Kubernetes)
- Workload Identity for secure service account binding
- Hacker Dashboard: Node.js application demonstrating dual-cluster connectivity
- Latency Comparison: Real-time ping tests showing private vs public endpoint performance
- Credential Injection: Kubernetes secrets automatically populated by Terraform
Automatically enforced policies:
- Auditing: All database access logged for compliance
- Backup Policies: Continuous backup + daily/weekly/monthly snapshots
- Monitoring: Datadog integration for metrics and alerts
- Maintenance Windows: Scheduled updates during off-peak hours (Sunday 02:00 UTC)
This Landing Zone demonstrates how to connect customer workloads to MongoDB Atlas (a fully managed SaaS) using secure private connectivity.
Infrastructure Ownership:
| Component | Managed By | Location |
|---|---|---|
| MongoDB Atlas Clusters | MongoDB (SaaS) | MongoDB's VPC in GCP/AWS |
| Backups, Monitoring, Patching | MongoDB (SaaS) | Atlas Control Plane |
| Customer VPC & Subnets | Customer (SvenskaSpel) | Customer's GCP Project |
| GKE Autopilot Cluster | Customer (SvenskaSpel) | Customer's GCP Project |
| Application Workloads | Customer (SvenskaSpel) | Runs in Customer's GKE |
| Private Service Connect Endpoint | Customer (SvenskaSpel) | Customer's VPC |
Key Points:
- MongoDB Atlas is SaaS: Database clusters run in MongoDB-managed VPCs, not in your VPC
- Private Connectivity: Private Service Connect creates a secure tunnel from your VPC to Atlas (no internet exposure)
- Zero Database Operations: MongoDB handles all patching, backups, monitoring, and scaling
- Customer Controls Application: You manage your GKE cluster and application deployment
The "Golden Path" Pattern:
- Developer Portal (Backstage): Self-service interface for developers to request infrastructure
- Standard Stack Module: Reusable Terraform module containing all best practices
- Application Layer: Kubernetes workloads with automated credential injection
- Governance Layer: Built-in auditing, backups, monitoring, and maintenance policies
This architecture ensures:
- β Consistency: All deployments use the same tested configuration
- β Security: Private endpoints, automated credential management, IP access controls
- β Compliance: Auditing, backup policies, and maintenance windows enforced
- β Self-Service: Developers can provision infrastructure without manual intervention
Before the workshop, ensure you have the following prepared:
-
MongoDB Atlas Account:
- Access to an Atlas Organization with "Organization Owner" or "Project Creator" permissions.
- API Keys: Create a Public/Private API Key pair at the Organization level.
- Permissions: Organization Owner (required for creating Projects).
- Allowlist: Add your current IP address.
-
Google Cloud Platform (GCP):
- A GCP Project to host the Private Endpoint and Service Accounts.
gcloudCLI installed and authenticated.
-
Tools:
Run the helper script to check tools and configure credentials:
cd scripts
./setup.sh
source .envIf you prefer to configure manually: Export your Atlas API keys as environment variables to avoid hardcoding them:
export TF_VAR_atlas_public_key="your_public_key"
export TF_VAR_atlas_private_key="your_private_key"
export TF_VAR_atlas_org_id="your_org_id"
export TF_VAR_gcp_project_id="your_gcp_project_id"
export GITHUB_TOKEN="your_github_token" # Required for Backstage ScaffolderThe Terraform code is designed to be uncommented in stages.
- Navigate to the directory:
cd terraform - Initialize Terraform:
terraform init
- Part 1 (Foundation): Run
terraform apply. This creates the Project. - Part 2 (Cluster): Uncomment the
module "cluster"block inmain.tfand runterraform apply. - Part 3 (Security): Uncomment
module "security"and apply. - Part 4 (Advanced): Uncomment
module "advanced"and apply. - Part 5 (Integrations): Uncomment
module "integrations"and apply. - Part 6 (Sharding): Uncomment
module "sharding"and apply.
Since we don't have a live Backstage instance, you will demonstrate the Code & Process:
-
Show the Template (
backstage/atlas-template.yaml):- Explain that this file defines the UI form developers see in Backstage.
- Highlight the
parameterssection (Name, Region, Size) - this is how you enforce governance (e.g., only allowing specific regions). - Show the
stepssection - specificallyfetch:templateandpublish:github:pull-request.
-
Show the mongodb-atlas-landingzone (
backstage/mongodb-atlas-template/):- Explain that this is the "Cookie Cutter" code.
- Open
main.tfand show how variables likevar.project_nameare injected. - Point out the "Best Practices" hardcoded here (e.g.,
termination_protection,backup_enabled) that developers get for free.
-
The Story:
- "Developers don't write Terraform from scratch."
- "They fill out a form, Backstage creates a PR with this high-quality Terraform code."
- "Platform Engineers review the PR, merge it, and Atlantis/Terraform Cloud applies it."
This is the core of the technical demo. It shows the end-to-end flow from Infrastructure to Application.
-
Provision Infrastructure:
cd terraform terraform apply- This creates the GKE Cluster, Atlas Cluster, and the Kubernetes Secret (
atlas-creds) containing the database credentials.
- This creates the GKE Cluster, Atlas Cluster, and the Kubernetes Secret (
-
Deploy Application:
# Ensure you are in the project root cd .. # Authenticate kubectl (if needed) gcloud container clusters get-credentials atlas-demo-cluster --region europe-north1 --project svenska-spel-demo # Deploy kubectl apply -f kubernetes/app-deployment.yaml
-
Verify:
- Get the External IP:
kubectl get service my-app-service - Open in Browser.
- Click "Log In" to verify the secure connection to MongoDB Atlas.
- Get the External IP:
The Backstage portal provides a self-service interface for developers to provision MongoDB Atlas infrastructure using the "Golden Path" template.
- Node.js 20 or 22
- Yarn package manager
- GitHub Personal Access Token (for scaffolder)
-
Navigate to the Backstage directory:
cd backstage/developer-portal -
Install dependencies (first time only):
yarn install
-
Configure environment variables:
# Required for Node.js 20+ export NODE_OPTIONS=--no-node-snapshot # Required for GitHub integration export GITHUB_TOKEN="your_github_token"
-
Configure GitHub token in Backstage: Create or update
app-config.local.yaml:integrations: github: - host: github.com token: ${GITHUB_TOKEN}
-
Start the development server:
yarn start
-
Access the portal: Open your browser to: http://localhost:3000
- In Backstage, navigate to Create β Choose a template
- Select "MongoDB Atlas Cluster"
- Fill in the form:
- Project Name: Name for your Atlas project
- Region: Choose from available regions (e.g., Finland, Stockholm)
- Cluster Size: M10, M20, M30, etc.
- Click Create
- Backstage will:
- Generate Terraform code from the
mongodb-atlas-template - Create a Pull Request in your GitHub repository
- Include all best practices (backups, security, monitoring)
- Generate Terraform code from the
The template uses the standard-stack module to provision:
- MongoDB Atlas Project
- Cluster with your specified configuration
- Private endpoint connectivity
- Database users with secure passwords
- IP access lists
- Backup policies
- Monitoring integration
All infrastructure follows the "Golden Path" - pre-approved, secure, compliant configuration.
-
- How database users are created and managed
- Credential injection into Kubernetes
- Security best practices and rotation procedures
- Troubleshooting authentication issues
-
Private Endpoint Configuration
- Why use private endpoints (security, performance, cost)
- Architecture and implementation details
- Connection string differences
- Latency comparison and verification
- Troubleshooting connectivity issues
-
Backup Policies and Disaster Recovery
- Continuous cloud backup (oplog-based)
- Snapshot schedules (daily, weekly, monthly)
- Point-in-time recovery procedures
- RTO/RPO targets and compliance
- Cost optimization strategies
-
- Auditing configuration and use cases
- Maintenance windows and update policies
- IP access lists and network security
- Monitoring integration (Datadog)
- Encryption at rest and in transit
- Compliance certifications (SOC 2, GDPR, HIPAA)
terraform/: Infrastructure as Code implementationbackstage/: Self-service developer portalkubernetes/: Application deployment manifests
This is a demo repository. For questions or improvements, please open an issue or pull request.

