|
1 | 1 | { "AWSTemplateFormatVersion" : "2010-09-09",
|
2 |
| - "Description" : "Template will build SLS workstation", |
| 2 | + "Description" : "Template will build SLS workstation, can be used in all stages has SLS and REACT frameworks installed", |
3 | 3 | "Parameters" :
|
4 | 4 | {
|
5 | 5 | "myKeyPair" : {
|
6 | 6 | "Description" : "Amazon EC2 Key Pair",
|
7 | 7 | "Type" : "AWS::EC2::KeyPair::KeyName"
|
8 | 8 | },
|
9 | 9 | "myDomain" : {
|
10 |
| - "Description" : "Domain to add the sls-${region}", |
| 10 | + "Description" : "(optional) Domain to add the sls-${region}", |
11 | 11 | "Type" : "String",
|
12 | 12 | "Default" : "nodomainname"
|
13 | 13 | }
|
|
24 | 24 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "HVM64" ]},
|
25 | 25 | "KeyName" : { "Ref" : "myKeyPair" },
|
26 | 26 | "InstanceType" : "t2.micro",
|
27 |
| - "Tags" : [ { "Key" : "Role", "Value" : "SLS Workstation" } ], |
| 27 | + "IamInstanceProfile" : { "Ref" : "InstanceRole" }, |
| 28 | + "SecurityGroups" : [ {"Ref" : "SG" } ], |
| 29 | + "Tags" : [ |
| 30 | + { "Key" : "Name", "Value" : "SLS Workstation" } , |
| 31 | + { "Key" : "Created", "Value" : "CFN github aws/cgn-ec2workstation.json" } |
| 32 | + ], |
28 | 33 | "UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
|
29 | 34 | "#!/bin/bash", "\n",
|
30 | 35 | "yum update -y", "\n",
|
|
42 | 47 | },
|
43 | 48 |
|
44 | 49 |
|
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + "SLSRole": { |
| 54 | + "Type" : "AWS::IAM::Role", |
| 55 | + "Properties" : { |
| 56 | + "AssumeRolePolicyDocument" : { |
| 57 | + "Version" : "2012-10-17", |
| 58 | + "Statement" : [ { |
| 59 | + "Effect" : "Allow", |
| 60 | + "Principal" : { |
| 61 | + "Service" : [ "ec2.amazonaws.com" ] |
| 62 | + }, |
| 63 | + "Action" : [ "sts:AssumeRole" ] |
| 64 | + } ] |
| 65 | + }, |
| 66 | + "Path" : "/", |
| 67 | + "Policies" : [ |
| 68 | + { |
| 69 | + "PolicyName" : "sls-iam-instance-policy", |
| 70 | + "PolicyDocument": { |
| 71 | + "Version" : "2012-10-17", |
| 72 | + "Statement" : [ |
| 73 | + { |
| 74 | + "Action" : [ |
| 75 | + "route53:ChangeResourceRecordSets", |
| 76 | + "cloudformation:*" |
| 77 | + ], |
| 78 | + "Resource" : "*", |
| 79 | + "Effect" : "Allow" |
| 80 | + } |
| 81 | + ] |
| 82 | + } |
| 83 | + } |
| 84 | + ] |
| 85 | + } |
| 86 | + }, |
| 87 | + |
| 88 | + "InstanceRole": { |
| 89 | + "Type" : "AWS::IAM::InstanceProfile", |
| 90 | + "Properties" : { |
| 91 | + "Path" : "/", |
| 92 | + "Roles" : [ |
| 93 | + { "Ref" : "SLSRole" } |
| 94 | + ] |
| 95 | + } |
| 96 | + }, |
| 97 | + |
| 98 | + |
| 99 | + "SG": { |
| 100 | + "Type" : "AWS::EC2::SecurityGroup", |
| 101 | + "Properties" : { |
| 102 | + "GroupDescription" : "SLS Workstation CFN generated group" , |
| 103 | + "SecurityGroupIngress" : [ |
| 104 | + { "Description" : "Access to SSH", "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "0.0.0.0/0" }, |
| 105 | + { "Description" : "REACT dev port", "IpProtocol" : "tcp", "FromPort" : "3000", "ToPort" : "3000", "CidrIp" : "0.0.0.0/0" }, |
| 106 | + { "Description" : "http test port", "IpProtocol" : "tcp", "FromPort" : "8000", "ToPort" : "8000", "CidrIp" : "0.0.0.0/0" } |
| 107 | + ], |
| 108 | + "Tags" : [ |
| 109 | + { "Key" : "Name", "Value" : "SLS Workstation" } , |
| 110 | + { "Key" : "Created", "Value" : "CFN github aws/cgn-ec2workstation.json" } |
| 111 | + ] |
| 112 | + } |
| 113 | + }, |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
45 | 119 | "DnsRecord": {
|
46 | 120 | "Type" : "AWS::Route53::RecordSet",
|
47 | 121 | "Condition" : "CreateDnsResources",
|
|
0 commit comments