Vpc Peering Lambda
This allows vpc resources including ec2 instances amazon rds databases and lambda functions that run in different aws regions to communicate with each other using private ip addresses without requiring gateways vpn connections or separate network appliances.
Vpc peering lambda. I ve setup vpc peering on my own aws account to test running a lambda from one vpc to query data from a database in another vpc. For security groups choose a security group. Before setting up the vpc peer connection external http calls were working fine.
Traffic between peered vpcs stays on the aws network and does not traverse the public internet. Then go to the. In the lambda console on the configuration pane under network do the following.
You can establish peering relationships between vpcs across different aws regions also called inter region vpc peering. By default the requester account cannot both request and also approve vpc peering connection requests made to a different aws peer account. The vpcs can also be in two different aws regions.
You can establish a vpc peering connection between your own two vpcs or with a vpc in another aws account. Connect your lambda function to your vpc. For subnets choose two or more subnets in your vpc.
Attach vpc endpoint for api gateway go to the api gateway dashboard and open the api you have created in the earlier step for the lambda or any of your existing api gateway. For virtual private cloud vpc choose the default tenancy vpc that you created. Vpc peering is a networking connection between two vpcs.
Using aws lambda and cloudformation custom resources we can go around this limitation allowing the creation of the vpc peers from within a cloudformation stack. I also had an external http request within my lambda to a random website to get some sample data.