Lambda functions do not accept inbound connections. When you configure a VPC and security group for a Lambda function, this is for the purposes of allowing the Lambda function to execute within your VPC, allowing the function to access other services within the same VPC (e.g. RDS or Aurora instances, EC2 instances, load balancers, etc).
Lambda functions access SQS using the SQS API. You only need to ensure that the security group provides (at a minimum) outbound access on port 443 so that it can connect to SQS.
Please take a look at my answer to a similar question recently - https://repost.aws/questions/QUA-ke4GYcQx6-YNvmHxsfUA/can-lambdas-inside-a-private-subnet-still-receive-data-from-sqs#ANzEFlBd5wQ02DlAOAuszeoA
inbound rule of security group for EC2 Instance in private subnetasked a year ago
Is it a good idea to have single security group for multiple apps?asked 3 months ago
codepipeline.putJobSuccessResult() Hanging when Invoking a Lambda from VPCasked 4 years ago
`RequestTimeout`s for S3 put requests from a Lambda in a VPC for larger payloadsasked 7 months ago
Pushing to SQS through VPC Endpoint from lambda in private VPC failsasked a year ago
Can lambdas inside a private subnet still receive data from SQS ?
What do I need to allow for my Security group to receive inbound traffic from SQS in lambda?
How to setup an EC2 Security Group to only allow inbound traffic on a port from the API Gateway onlyasked 7 days ago
Do we need VPC Endpoints for SNS and SQS if data not originating from any VPC and directly landing in SNS from external sourceasked a year ago
How to access a public RDS instance from lambda without compromising on the security of RDS by putting an inbound rule for RDS Sg with source as 0.0.0.0/0 ?Accepted Answerasked 6 months ago