2

Here, I am having Lambda & EC2 Instance both are under same VPC & Subnet.

Both are having to save security group with the rule to allow inbound connection from same security group for all ports. Lambda is not able to access MongoDB when it is inside VPC.

If I try to take it out from VPC and open port for 0.0.0.0/0 then only it works.

I need the solution for this...

1 Answer 1

1

Lambda needs an IAM role to manage the ENI to access the VPC.

AWS Lambda (AWS service role) – This role grants AWS Lambda permissions to assume the role.

AWSLambdaVPCAccessExecutionRole (access permissions policy) – This is the policy that you attach to the role. The policy grants permissions for the EC2 actions that AWS Lambda needs to manage ENIs. You can view this AWS managed policy in IAM console.

http://docs.aws.amazon.com/lambda/latest/dg/vpc.html

http://docs.aws.amazon.com/lambda/latest/dg/vpc-ec-create-iam-role.html

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.