本文整理匯總了Python中troposphere.ec2.InternetGateway方法的典型用法代碼示例。如果您正苦於以下問題:Python ec2.InternetGateway方法的具體用法?Python ec2.InternetGateway怎麽用?Python ec2.InternetGateway使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類troposphere.ec2
的用法示例。
在下文中一共展示了ec2.InternetGateway方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: sceptre_handler
# 需要導入模塊: from troposphere import ec2 [as 別名]
# 或者: from troposphere.ec2 import InternetGateway [as 別名]
def sceptre_handler(sceptre_user_data):
t = Template()
vpc = t.add_resource(VPC(
"VirtualPrivateCloud",
CidrBlock=sceptre_user_data["cidr_block"],
InstanceTenancy="default",
EnableDnsSupport=True,
EnableDnsHostnames=True,
))
igw = t.add_resource(InternetGateway(
"InternetGateway",
))
t.add_resource(VPCGatewayAttachment(
"IGWAttachment",
VpcId=Ref(vpc),
InternetGatewayId=Ref(igw),
))
t.add_output(Output(
"VpcId",
Description="New VPC ID",
Value=Ref(vpc)
))
return t.to_json()
示例2: add_igw
# 需要導入模塊: from troposphere import ec2 [as 別名]
# 或者: from troposphere.ec2 import InternetGateway [as 別名]
def add_igw(self):
t = self.template
self.igw = t.add_resource(InternetGateway(
"InternetGateway",
))
t.add_resource(VPCGatewayAttachment(
"IGWAttachment",
VpcId=Ref(self.vpc),
InternetGatewayId=Ref(self.igw),
))
示例3: sceptre_handler
# 需要導入模塊: from troposphere import ec2 [as 別名]
# 或者: from troposphere.ec2 import InternetGateway [as 別名]
def sceptre_handler(sceptre_user_data):
t = Template()
cidr_block_param = t.add_parameter(Parameter(
"CidrBlock",
Type="String",
Default="10.0.0.0/16",
))
vpc = t.add_resource(VPC(
"VirtualPrivateCloud",
CidrBlock=Ref(cidr_block_param),
InstanceTenancy="default",
EnableDnsSupport=True,
EnableDnsHostnames=True,
))
igw = t.add_resource(InternetGateway(
"InternetGateway",
))
t.add_resource(VPCGatewayAttachment(
"IGWAttachment",
VpcId=Ref(vpc),
InternetGatewayId=Ref(igw),
))
t.add_output(Output(
"VpcId",
Description="New VPC ID",
Value=Ref(vpc)
))
return t.to_json()