I am currently part of a group that is dealing with the repercussions of deploying 300+ AWS Lambda functions running Node.js in place of a more traditional REST API. I recently implemented an application that runs on EC2 instances in a VPC on a private subnet. Thus, the Lambdas themselves, which will be communicating heavily with this application, are also placed into private subnets in the same VPC. The EC2 instances run in 6 private /24 subnets (one for each availability zone in our region). The lambdas have 6 /20 private subnets that they are configured to run in. As I understand it, each invocation of a lambda will allocate an IP address in one of those subnets, which gives me about 24,564 IP addresses before we run out.
My questions are:
1) does a Lambda occupy an IP address only for the period that it is actually running and then the IP address is released? More succinctly, are we going to run out IP addresses fairly quickly as we're expecting an uptick in invocations very soon? I know I can just allocate more of the address space in the VPC to the lambdas, but will this be a problem we are continuously chasing?
2) How can I see in the AWS console or elsewhere how many IP addresses are being occupied by lambdas?
NOTE: I am a junior DevOps engineer so forgive me if something is unclear and feel free to correct me