Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to communicate with private EC2 instance from Lambda function

Lets say we have a ec2 instance that running in the private subnet. No Public IP associated with this instance. There is a running application (server with endpoint) inside this instance.

Problem is I need to access this application endpoint through a Lambda function. If that instance had a public IP we could directly make a call to the instance but this instance is a private instance.

Is there any way to communicate with that private EC2 instance through a Lambda function?

like image 761
Thiwanka Wickramage Avatar asked Oct 25 '25 11:10

Thiwanka Wickramage


1 Answers

You can place a Lambda function inside of the VPC and configure the security groups to allow traffic from the Lambda function.

AWS Docs: Configuring a Lambda function to access resources in a VPC

like image 57
Maurice Avatar answered Oct 27 '25 00:10

Maurice



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!