Datasets:
File size: 1,980 Bytes
43cd3eb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | {
"Description": "This stack automates the creation of an EC2 Instance\n",
"Parameters": {
"LatestAmiId": {
"Description": "Region specific image from the Parameter Store",
"Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
"Default": "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
},
"Subnet": {
"Description": "The subnet to put the instance into",
"Type": "AWS::EC2::Subnet::Id"
}
},
"Resources": {
"IamRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com"
]
},
"Actions": [
"sts:AssumeRole"
]
}
]
},
"Path": "/"
}
},
"IamProfile": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Roles": [
{
"Ref": "IamRole"
}
],
"Path": "/"
}
},
"Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Ref": "LatestAmiId"
},
"SubnetId": {
"Ref": "Subnet"
},
"Monitoring": true,
"IamInstanceProfile": {
"Ref": "IamProfile"
},
"EbsOptimized": true
}
}
}
}
|