The BaseNodeJsFunction creates a new, default security group for each lambda.
This is actually not a recommended practice, because AWS will create a new ENI and use up an IP address in the subnet, for each unique combination of subnet + security group.
So attaching a new, unique security group to each new lambda, means that each lambda needs its own ENI and IP address and you will hit limits at some point.
The
BaseNodeJsFunction
creates a new, default security group for each lambda.This is actually not a recommended practice, because AWS will create a new ENI and use up an IP address in the subnet, for each unique combination of subnet + security group. So attaching a new, unique security group to each new lambda, means that each lambda needs its own ENI and IP address and you will hit limits at some point.
See https://aws.amazon.com/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/ for more details on how this works.
Feature request
I would remove the default security group option completely.
Or at the very least, making it controllable with a boolean. And set the default to
false
.