gpt4 book ai didi

amazon-web-services - 如何使用 Cloudformation 从 EC2 实例获取辅助 IPv4 地址

转载 作者:行者123 更新时间:2023-12-03 07:34:57 25 4
gpt4 key购买 nike

我正在使用 CloudFormation 在 AWS 中构建一些 EC2 实例。其中一台 EC2 主机有 2 个网络接口(interface),其 IP 地址配置在不同的子网中。

我可以使用 Cloudformation 获取主网络接口(interface)上的 IP 地址:!Sub ${SomeEC2.PrivateIp}

但是,我需要辅助私有(private) IP 地址。如何使用 Cloudformation 和 !Sub 函数调用第二个网络接口(interface) IP 地址?

最佳答案

How do I call the second network interface IP address using Cloudformation, and the !Sub function?

遗憾的是,您无法使用普通的 CloudFormation (CFN) 来做到这一点。您必须开发自己的custom resource 。该资源将采用 lambda 函数的形式,它将实例 id 作为参数,然后使用 AWS SDK 获取第二个 IP 地址。该地址将返回到您的 CFN 堆栈以进行进一步处理。

关于amazon-web-services - 如何使用 Cloudformation 从 EC2 实例获取辅助 IPv4 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64339478/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com