How to access a service with Controlled Network Access from the Auto Scaling Group?

0

Setup Description:

  1. I have an auto scaling group with one instance inside, but it can scale up to 2 instances.
  2. Each instance in the group should read information from the MongoDB.
  3. The MongoDB has network inbound rules so that, not every IP can access the MongoDB.
  4. When auto scaling group scales, it creates new instance that has random IP generated by AWS. So they have no access to the Mongo DB by default.

Problem: How to make all instances inside auto scaling group to access the Mongo DB without making Mongo DB be accessible to all IPs?

2개 답변
1
수락된 답변

Hello.

Where is Mongo DB managed?
If Mongo DB is installed on EC2, I think there will be no problem just by allowing the EC2 security group of the AutoScaling group in the security group.
https://docs.aws.amazon.com/vpc/latest/userguide/security-group-rules.html#security-group-referencing

If Mongo DB exists on-premises and provides public access, you can fix the IP address by creating a NAT Gateway within the VPC and directing EC2 communication via the NAT Gateway.
https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-basics

If you are accessing on-premises via VPN, I think you can use a method to allow VPC CIDR.

profile picture
전문가
답변함 6달 전
  • Thank you! Made it working with NAT gateway ^^

0
Aibar
답변함 6달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인