gpt4 book ai didi

windows - 如何在预先创建的 VPC 中启动实例并且还应该为其配置公共(public) IP?

转载 作者:行者123 更新时间:2023-12-03 07:37:43 25 4
gpt4 key购买 nike

我正在使用下面的云形成模板在已创建的 VPC 中启动实例。该实例正在所需的 VPC 中创建。但我还需要为该实例配置公共(public) IP。尝试了很多方案,都无法解决。请有人帮助我。

 {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Ec2 block device mapping",
"Resources": {
"MyEC2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": "ami-0bbd146b",
"AvailabilityZone": "us-west-2a",
"SubnetId": "subnet-e1b24b86",
"SecurityGroupIds": [ "sg-fad0c383" ],
"KeyName": "TibcoBuild",
"Tags": [{
"Key": "Name",
"Value": "VPCTest"
}]
}
}
}
}

最佳答案

你尝试了什么?它实际上非常简单并记录在此处:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html

"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"KeyName" : { "Ref" : "KeyName" },
"NetworkInterfaces": [ {
"AssociatePublicIpAddress": "true",
"DeviceIndex": "0",
"GroupSet": [{ "Ref" : "myVPCEC2SecurityGroup" }],
"SubnetId": { "Ref" : "PublicSubnet" }
} ]
}
}

关于windows - 如何在预先创建的 VPC 中启动实例并且还应该为其配置公共(public) IP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41153007/

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