gpt4 book ai didi

amazon-web-services - 如何获取cloudformation堆栈中现有的VPC cidr

转载 作者:行者123 更新时间:2023-12-02 20:05:59 26 4
gpt4 key购买 nike

创建cloudformation堆栈,它在vpc中创建额外的子网,我将VPCId(现有VPC)作为堆栈的参数。如何获取CF堆栈内的VPC cidr

最佳答案

来自AWS::EC2::VPC - AWS CloudFormation :

Fn::GetAtt returns a value for a specified attribute of this type. The following are the available attributes and sample return values:

CidrBlock: The set of IP addresses for the VPC. For example, 10.0.0.0/16.

但是,我怀疑这仅适用于在 CloudFormation 模板中创建的 VPC。

由于您想要引用现有的 VPC,因此您需要编写 CloudFormation custom resource使用 AWS Lambda。

这有点棘手,但有一些很好的示例模板:stelligent/cloudformation-custom-resources

关于amazon-web-services - 如何获取cloudformation堆栈中现有的VPC cidr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54656581/

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