AWS CloudFormation:如何在 cloudformation 模板中引用默认/主路由表(在创建 VPC 时创建)? [英] AWS CloudFormation: how do I refer to the default/main route table (that is created when a VPC is created) in a cloudformation template?

查看:35
本文介绍了AWS CloudFormation:如何在 cloudformation 模板中引用默认/主路由表(在创建 VPC 时创建)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个创建自定义 VPC 的 CloudFormation 模板.该模板创建以下资源 - VPC、Internet 网关、将 IGW 附加到 VPC 并创建公共子网.我想向作为 VPC 一部分创建的路由表添加一条路由(目的地 0.0.0.0/0,目标 IGW).

I have a CloudFormation template that creates a custom VPC. The template creates the following resources - a VPC, an Internet Gateway, attaches the IGW to the VPC, and creates a Public Subnet. I want to add a route (destination 0.0.0.0/0, target IGW) to the Route Table that gets created as part of the VPC.

我已经通读了关于路由、路由表的 cloudformation 文档来弄清楚如何做到这一点,但无济于事.

I have read through the cloudformation documentation for routes, route tables to figure out how to do this, but to no avail.

我可以使用 Fn::Ref 函数来引用作为模板一部分显式创建的资源或参数,但如何引用使用 VPC 固有创建的资源?

I can use the Fn::Ref function to refer to resources or parameters that are explicitly created as part of the template, but how do I refer to resources that get created inherently with the VPC?

非常感谢有关如何重用现有路由表、NACL 和安全组的任何见解.

Any insights on how to re-use the existing route table, NACL and Security Group are much appreciated.

谢谢,

推荐答案

  1. 不要使用默认路由表(请参阅https://serverfault.com/questions/588904/aws-vpc-default-route-table-in-cloudformation)
  2. 您可以根据 https://serverfault.com/questions 获取默认安全组/544439/aws-cloudformation-vpc-default-security-group
  3. 最后,您还可以获得与上述 DefaultSecurityGroup 相同的 DefaultNetworkAcl.另请参阅 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html)

这篇关于AWS CloudFormation:如何在 cloudformation 模板中引用默认/主路由表(在创建 VPC 时创建)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆