- Newest
- Most votes
- Most comments
If you have the permission from the resource owner to do what you are asking and assuming that the peered VPC is using private IP addresses (anything under 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16), you could set up a network load balancer (NLB) and point its target group to the IP addresses of the database in the peered VPC. You can configure the NLB as internet-facing to give it public IP addresses and associate a security group with it to control which source IPs are allowed to connect.
If the IP addresses of the target database change occasionally, there's no completely perfect way to relay connections to it in this manner, but you should be able to get close by using EventBridge Scheduler to run a Lambda function regularly, such as every 1-5 minutes, that looks up the IP addresses of the target from its DNS name and updates the NLB's target group with the IPs if they don't match the current contents of the NLB's target group.
Relevant content
asked 3 years ago
