I have several aws lambda instances accessible publicly, from the internet they all have the same public ip, how can we ensure that each lambda has distinct public IP address? It does not need to be static, it only needs to be different per lambda, and its no problem if same lambda has different IPs (high availability), the only condition is that 2 different lambdas never have the same IP...
Asked
Active
Viewed 2,147 times
2
-
I don't think you can achieve this easily. In the background, Lambdas are actually run on containers (it is an ECS framework) so somewhere there is an EC2 instance where the containers are stored. As in ECS, in most cases you are going to use just 1 instance so your lambdas will go out using the same IP :/ – AlexK Nov 08 '18 at 09:32
-
1Can you tell us _why_ you have this requirement? – John Rotenstein Nov 08 '18 at 15:51
-
1there are number of lambda functions that hit some 3rd party server, which rate limits by IP, i don't want one of the lambda to exhaust this limit on its own – vach Nov 09 '18 at 13:14
-
@vach Did you solve this problem? It sounds as though I have a very similar use-case. I want to scrap a wesbite but keep getting blocked. – rhys_stubbs Mar 31 '20 at 10:14
1 Answers
1
Look at the answer (and the comments) to this question: Lambda function within VPC doesn't have access to public Internet
You can "assign" an Elastic IP to a lambda function by enabling VPC for it and then making sure the VPC is configured properly to give your lambda internet access (by attaching a NAT Gateway to the VPC subnet's routing table, or by assigning an IP to the lambda's ENI).

xpa1492
- 1,953
- 1
- 10
- 19