1

I have deployed an application which exposes a REST API on EC2 instance.

This REST API needs to be accessible only from the lambda function.

I have created a VPC using launch VPC wizard and the VPC with a Single Public Subnet option.

I have created two subnets and a security group.

In the security group, I have configured the http port on which the REST service is running, to be accessible from the same security group. This security group is also assigned to Lambda function.

I have assigned the VPC, subnets and the security group to the lambda function.

I am following the below link -

Access EC2 Instance Service Via AWS Lambda Function

The lambda function is not able to connect to the REST API endpoint on the EC2 instance.

Any pointers?

1 Answer 1

0

Your associated VPC must have a NAT Gateway (or a NAT Instance) in a public subnet. This looks to be missing in your case (based on the data that you have shared in the question).

I would implore you to go through this official tutorial. It clearly demonstrates what you need to access public endpoints from a Lambda function that is placed inside a manually created VPC.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.