Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda different IP address for each Lambda

Is it possible to have each Lambda access the internet from a different IP address? In my testing, it appears the each time a Lambda is invoked it uses the same IP address to access our servers.

Our Lambdas do not have VPC access and are not NAT'd. I would think we would get different IP addresses with this setup but that doesn't seem to be the case.

I am wondering if it's possible that our because our volume is low we just always end up using the same container hence the same IP address? If so is there any way to prevent this?

like image 399
tcj123 Avatar asked Jul 26 '17 21:07

tcj123


2 Answers

When you redeploy the lambda it seems to use a new container. So you can automate this deploy process using awscli to get a new ip on command.

like image 109
adamwlev Avatar answered Sep 16 '22 11:09

adamwlev


I am wondering if it's possible that our because our volume is low we just always end up using the same container hence the same IP address?

Yes, that is exactly the reason. A container is only spawned if no containers are already available. After a few minutes of no further demand, excess/unneeded containers are destroyed.

If so is there any way to prevent this?

No, this behavior is by design.

like image 35
Michael - sqlbot Avatar answered Sep 16 '22 11:09

Michael - sqlbot