cloudformation 模板中的现有动态 AWS 资源
Existing dynamic AWS resources in cloudformation template
我已经通过 AWS 控制台创建了 AWS 网络资源(VPC、子网、IGW 等)。
现在,我正在尝试创建一个由这些现有资源和新资源组成的 cloudformation 堆栈。
为了在堆栈中实现现有资源,我使用了参数
Parameters:
VpcId:
Description: VPC Id
Type: AWS::EC2::VPC::Id
PublicSubnetId1:
Description: Public Subnet 1
Type: AWS::EC2::Subnet::Id
PublicSubnetId2:
Description: Public Subnet 2
Type: AWS::EC2::Subnet::Id
InternetGateway:
Type: AWS::EC2::InternetGateway::Id
问题 1:这是正确的方法吗? (因为我们有 diff envs 来处理动态 AWS 资源,我正在这样做)
问题2:我可以通过VPC、子网设置参数,但不能通过Internet 网关设置参数。如何将 internetgateway 作为参数?
谢谢
Question 1: Is this the right approach ? (As we have diff envs so to handle dynamic AWS resources, I am doing this)
这是一种方法。如果您希望在创建模板时能够 select 不同的子网或 vpc,那很好。但是,如果 VPC 和子网是固定的并且不会更改,可能更好的做法是 export them from their own stacks, end them import 它们在其他堆栈中。这样其他堆栈可以轻松引用它们,并且您简化了堆栈的部署,因为您不需要为每个新堆栈提供所有这些参数。
Question 2: I am able to set parameter with VPC,subnets but not with Internet gateway. How to put internetgateway as a parameter ?
不幸的是,还有 no such parameter 和 AWS::EC2::InternetGateway::Id
一样。在这种情况下,您将不得不使用 String
:
InternetGateway:
Type: String
我已经通过 AWS 控制台创建了 AWS 网络资源(VPC、子网、IGW 等)。 现在,我正在尝试创建一个由这些现有资源和新资源组成的 cloudformation 堆栈。 为了在堆栈中实现现有资源,我使用了参数
Parameters:
VpcId:
Description: VPC Id
Type: AWS::EC2::VPC::Id
PublicSubnetId1:
Description: Public Subnet 1
Type: AWS::EC2::Subnet::Id
PublicSubnetId2:
Description: Public Subnet 2
Type: AWS::EC2::Subnet::Id
InternetGateway:
Type: AWS::EC2::InternetGateway::Id
问题 1:这是正确的方法吗? (因为我们有 diff envs 来处理动态 AWS 资源,我正在这样做)
问题2:我可以通过VPC、子网设置参数,但不能通过Internet 网关设置参数。如何将 internetgateway 作为参数?
谢谢
Question 1: Is this the right approach ? (As we have diff envs so to handle dynamic AWS resources, I am doing this)
这是一种方法。如果您希望在创建模板时能够 select 不同的子网或 vpc,那很好。但是,如果 VPC 和子网是固定的并且不会更改,可能更好的做法是 export them from their own stacks, end them import 它们在其他堆栈中。这样其他堆栈可以轻松引用它们,并且您简化了堆栈的部署,因为您不需要为每个新堆栈提供所有这些参数。
Question 2: I am able to set parameter with VPC,subnets but not with Internet gateway. How to put internetgateway as a parameter ?
不幸的是,还有 no such parameter 和 AWS::EC2::InternetGateway::Id
一样。在这种情况下,您将不得不使用 String
:
InternetGateway:
Type: String