菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
132
0

CFDebug.template

原创
05/13 14:22
阅读数 99423
{
	"AWSTemplateFormatVersion" : "2010-09-09",

	"Description" : "Create an EC2 instance.",

	"Parameters" : {
		"KeyName" : {
			"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
			"Type" : "String",
			"MinLength" : "1",
			"MaxLength" : "255",
			"AllowedPattern" : "[\\x20-\\x7E]*",
			"ConstraintDescription" : "can contain only ASCII characters."
		},

		"SSHFrom" : {
			"Description" : "Lockdown SSH access (default can be accessed from anywhere)",
			"Type" : "String",
			"MinLength" : "9",
			"MaxLength" : "18",
			"Default" : "0.0.0.0/0",
			"AllowedPattern" : "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
			"ConstraintDescription" : "must be a valid CIDR range of the form x.x.x.x/x."
		}
	},

	"Mappings" : {
		"AmazonLinuxAMI" : {
			"us-east-1": {
			        "AMI": "ami-b66ed3de"
			      },
			"us-west-1": {
			        "AMI": "ami-4b6f650e"
			      },
			"us-west-2": {
			        "AMI": "ami-b5a7ea85"
			      },
			"eu-west-1": {
			        "AMI": "ami-6e7bd919"
			      },
			"sa-east-1": {
			        "AMI": "ami-8737829a"
			      },
			"ap-southeast-1": {
			        "AMI": "ami-ac5c7afe"
			      },
			"ap-southeast-2": {
			        "AMI": "ami-63f79559"
			      },
			"ap-northeast-1": {
			        "AMI": "ami-4985b048"
			}
		}
	},

	"Resources" : {
		"EC2Instance" : {
			"Type" : "AWS::EC2::Instance",
			"Properties" : {
				"SecurityGroups" : [{
						"Ref" : "InstanceSecurityGroup"
					}
				],
				"InstanceType" : "t2.micro",
				"KeyName" : {
					"Ref" : "KeyName"
				},
				
		"ImageId" : {
      			"Fn::FindInMap" : [
      			"AmazonLinuxAMI", {
          		"Ref" : "AWS::Region"
        		},
        		"AMI"
     			]
    		}
			}
		},

		"InstanceSecurityGroup" : {
			"Type" : "AWS::EC2::SecurityGroup",
			"Properties" : {
				"GroupDescription" : "Enable SSH access via port 22",
				"SecurityGroupIngress" : [{
						"IpProtocol" : "tcp",
						"FromPort" : "22",
						"ToPort" : "22",
						"CidrIp" : {
							"Ref" : "SSHFrom"
						}
					}
				]
			}
		},

		"MountPoint" : {
			"Type" : "AWS::EC2::VolumeAttachment",
			"Properties" : {
				"InstanceId" : {
					"Ref" : "EC2Instance"
				},
				"VolumeId" : {
					"Ref" : "NewVolume"
				},
				"Device" : "/dev/sdh"
			}
		},

		"NewVolume" : {
			"Type" : "AWS::EC2::Volume",
			"Properties" : {
				"Size" : "100",
				"VolumeType" : "gp2",
				"AvailabilityZone" : {
					"Fn::GetAtt" : ["EC2Instance", "AvailabilityZone"]
				}
			}
		}
	},

	"Outputs" : {
		"InstanceId" : {
			"Description" : "InstanceId of the newly created EC2 instance",
			"Value" : {
				"Ref" : "EC2Instance"
			}
		}
	}
}

  

发表评论

0/200
132 点赞
0 评论
收藏
为你推荐 换一批