【问题标题】:How to get existing VPC cidr inside cloudformation stack如何在 cloudformation 堆栈中获取现有的 VPC cidr
【发布时间】:2019-02-12 18:35:06
【问题描述】:

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

【问题讨论】:

标签: amazon-web-services amazon-cloudformation


【解决方案1】:

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

Fn::GetAtt 返回此类型的指定属性的值。以下是可用的属性和示例返回值:

CidrBlock:VPC 的 IP 地址集。例如,10.0.0.0/16。

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

由于您要引用现有 VPC,您需要使用 AWS Lambda 编写 CloudFormation custom resource

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-26
    • 2020-10-19
    • 2019-11-27
    • 2021-11-26
    • 2019-09-01
    • 2021-12-07
    • 2021-03-14
    • 2021-01-14
    相关资源
    最近更新 更多