I want to select specific Elastic IP my own when my lambda function executed.
my service has to respond to several situations, and by user's attributes. Could I write code in a lambda function, that can choose specific my own elastic IP?
I had searched for this. but old information says it cannot do. but recently I heard about it is possible by using Network Load Balancer or Application Load Balancer. But I don't know how to use this for the problem.
No. You cannot associate an Elastic IP (EIP) address with an AWS Lambda function.
Well, actually you can, but I wouldn't recommend it. When a Lambda function is associated with a VPC, it connects via an Elastic Network Interface (ENI). It is possible to attach an EIP to an ENI. This also grants access to the Internet if it is attached to a public subnet.
So why avoid it? Because Lambda might create additional ENIs, especially if the Lambda function is frequently invoked and run in parallel. This means it will not have a consistent ENI.
An alternative method is: