Datasets:
| { | |
| "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 | |
| } | |
| } | |
| } | |
| } | |