November 10, 2024
7 min read
Hyuntaek Park
August 18, 2025
4
Recently, as part of a Proof of Concept (PoC) at Twigfarm, we have been adapting Datadog to efficiently identify bugs and issues. Our backend is primarily serverless, incorporating elements such as API Gateway, S3, MongoDB Atlas, and numerous Lambda functions spread across different AWS accounts.
While integrating these serverless components with Datadog proved feasible, we encountered difficulties in tracking logs for certain Lambda functions on the Datadog console. Upon investigation, we discovered that the Lambda functions within the VPC were not connecting.
As you might know already, lambda functions inside VPC cannot connect to the internet without additional settings such as NAT gateway or NAT instance.
We addressed this problem using VPC Peering.
Since we had to deal with several Datadog private links, we had some repetitive jobs and they were easy to make mistakes. Be careful.
For simplicity, consider the setup as follows:
Create a security group within the us-east-1 VPC that permits traffic from the 172.28.0.0/16, (IP range of ap-northeast-2 VPC) network on port 443.
The table below lists the PrivateLink service names. Not all endpoints need to be created; I have selected 7 that I intend to use.
Repeat the same process for all the private link services that you want to connect. Here are the results:
Repeat the same process for all of the private link services that you want to connect. Here are the results:
Now we need create an A record for each of the private hosted zones we just created.
Again, repeat this for all of the private link services
We need to associate VPCs which reside in both us-east-1 and ap-northeast-2.
Again, repeat this for all of the hosted zones. Then we are done with the Route 53 setup.
A VPC peering connection consists of requester and acceptor. In our case we create a requester first in ap-northeast-2 region and acceptor in us-east-1.
Now the request has been made. Time to accept the request.
We need to update Route tables for VPCs in both regions. Since we are in us-east-1 region, let’s do this region first.
Updating route table in ap-northeast-2 region is the last step. Repeat the same but choose the destination appropriately.
If you’ve completed the steps so far, the peering connection should now be established. Next, navigate to the Datadog console to verify whether the logs from the Lambda function are visible in a few minutes. However, if your peering connection is not established correctly, you need to check the connection.
The following commands would be useful for you to test the peering connection. Run the commands from EC2 instances in both us-east-1 and ap-northeast-2 regions.
dig +short http-intake.logs.datadoghq.com
nc w1 -vz http-intake.logs.datadoghq.com 443
November 10, 2024
7 min read