LevelBlue Completes Acquisition of Trustwave to Form the World's Largest Pure-Play MSSP. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
LevelBlue Completes Acquisition of Trustwave to Form the World's Largest Pure-Play MSSP. Learn More
AWS DocumentDB by default is securely isolated within a VPC, unreachable from the public internet, what could be more secure? This security architecture can create unexpected challenges and complexity. The root cause? The very VPC isolation designed to protect DocumentDB can introduce a complex web of networking requirements, operational considerations, and architectural decisions that require careful management to maintain security.
AWS designed DocumentDB’s VPC-only deployment as a key security feature, and the security benefits are real: your database is isolated in a private AWS network, unreachable from the public internet, and protected by AWS enterprise-grade networking infrastructure. However, like many security measures, VPC isolation involves trade-offs that organizations need to understand and manage diligently. The challenge is not that VPC is inherently problematic; it is that the networking requirements it creates can introduce complexity that, if not properly managed, may create new security considerations.
Since DocumentDB operates exclusively within VPCs, accessing it from outside AWS requires careful planning. AWS recommends SSH tunneling as one approach for external connectivity, but this solution requires thoughtful implementation to maintain security.
The most common approach for connectivity is using a bastion EC2 instance to access the DocumentDB in an isolated VPC.
Method 1:
ssh -i your-key.pem ec2-user@bastion-host-ip mongosh docdb.cluster-endpoint.amazonaws.com:27017 --tls --tlsCAFile tls-budle.pemretryWrites=false --username aduser --password ****
Method 2:
ssh -i your-key.pem -L 27017:docdb-cluster-endpoint:27017 ec2-user@bastion-host-ip -N mongosh --host localhost:27017 --username dbuser --password ** --tls --tlsCAFile tls-budle.pem
While the above approach enables secure connectivity, it also introduces networking complexity that requires careful security considerations.
1. Bastion Host Security Requirements
The bastion host becomes a critical component in your security architecture. A properly secured bastion host is essential, with regular security updates, monitoring, and hardening required. Some of the security considerations include:
2. Monitoring and Tooling Integration
Monitoring tools and database management utilities need special consideration with VPC-isolated databases. Use dedicated monitoring infrastructure within VPC, implement secure credential management, and establish network paths. Recommended approaches include:
DocumentDB, as hosted in an isolated VPC, is heavily reliant on Security Groups for fine-grained network control and requires careful configuration to maintain the principle of least privilege.
DocumentDB and other resources benefit from starting within a restrictive security group. It is also recommended to have specific and targeted access, avoiding broad network access unless specifically required.
Example:
aws ec2 authorize-security-group-ingress --group-id sg-DocumentDB-1 --protocol tcp --port 27017 --source-group sg-specific
Best practices include:
If an organization is using multiple VPCs, additional networking considerations apply. Choose between VPC Peering (for low latency and 2–3 VPCs) or Transit Gateway, and consider the security implications of each connection.
Example:
aws ec2 create-vpc-peering-connection --vpc-id VPC-1 --peer-vpc-id VPC-2
Real-world DocumentDB deployments can develop complex security group configurations. Considerations include:
DocumentDB’s VPC isolation provides important security benefits through network-level protection and integration with AWS security services. However, like any architectural decision, it involves trade-offs that organizations need to understand and manage effectively. Key considerations include:
DocumentDB’s VPC approach can provide excellent security when it matches your needs and when your team can implement and maintain it effectively.
Trustwave, A LevelBlue Company, is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2025 Trustwave Holdings, Inc. All rights reserved.