Best way to filter to find a Lambda function's Network interface IP address via Boto3?

0

I have a custom resource and I want the output to be the private ipv4 address of a specific lambda's elastic network interface of my choosing. I've figured out how to get this working and fetching an EC2's private ipv4 address.

Unfortunately the resources I do not have total control over so I cannot just add tags, and they get spun up and spun down a lot.

I know through the console, I can select the function and then examine a security group attached to it, and then search that security group in the EC2 Console screen under Network Interface, to find the Network interface that would attach to the lambda. But as far as I know, there's no direct filters or boto3 API calls to do this. I tried filtering on owner being Amazon but the owner of all the lambdas come under the AWS account in which they're housed in. I need that ENI IP address for a config file that deals with security/etc otherwise the lambda won't be able to communicate.

1回答
0

I would discourage you from doing this - not because what you're doing isn't working but more because Lamdba IP addresses might change from time to time. Instead, consider creating a small subnet in each Availability Zone that the Lambda functions use; then use that subnet range in your configuration file.

profile pictureAWS
エキスパート
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ