|
41 | 41 | }, |
42 | 42 | "DbAdminUsername": { |
43 | 43 | "Description": "Username for the admin user of the database", |
44 | | - "Type": "String" |
| 44 | + "Type": "String" |
45 | 45 | }, |
46 | 46 | "DbAdminPassword": { |
47 | 47 | "Description": "Password for the admin user of the database", |
48 | | - "Type": "String" |
| 48 | + "Type": "String", |
| 49 | + "NoEcho": true |
49 | 50 | } |
50 | 51 | }, |
51 | 52 | "Conditions": { |
|
127 | 128 | } |
128 | 129 | } |
129 | 130 | }, |
130 | | - "Resources": { |
| 131 | + "Resources": { |
| 132 | + "EC2InstanceRole": { |
| 133 | + "Type": "AWS::IAM::Role", |
| 134 | + "Properties": { |
| 135 | + "AssumeRolePolicyDocument": { |
| 136 | + "Version" : "2012-10-17", |
| 137 | + "Statement": [ { |
| 138 | + "Effect": "Allow", |
| 139 | + "Principal": { |
| 140 | + "Service": [ "ec2.amazonaws.com" ] |
| 141 | + }, |
| 142 | + "Action": [ "sts:AssumeRole" ] |
| 143 | + } ] |
| 144 | + }, |
| 145 | + "Policies": [ |
| 146 | + { |
| 147 | + "PolicyName": "MongoAndDockerInstancePolicy", |
| 148 | + "PolicyDocument": { |
| 149 | + "Version": "2012-10-17", |
| 150 | + "Statement": [ |
| 151 | + { |
| 152 | + "Effect": "Allow", |
| 153 | + "Action": [ |
| 154 | + "s3:Get*", |
| 155 | + "s3:List*" |
| 156 | + ], |
| 157 | + "Resource": "*" |
| 158 | + } |
| 159 | + ] |
| 160 | + } |
| 161 | + } |
| 162 | + ] |
| 163 | + } |
| 164 | + }, |
| 165 | + "EC2InstanceProfile": { |
| 166 | + "Type": "AWS::IAM::InstanceProfile", |
| 167 | + "Properties":{ |
| 168 | + "Roles": [ |
| 169 | + { "Ref": "EC2InstanceRole" } |
| 170 | + ] |
| 171 | + } |
| 172 | + }, |
131 | 173 | "NewSecurityGroup": { |
132 | 174 | "Type": "AWS::EC2::SecurityGroup", |
133 | 175 | "Condition": "CreateNewSecurityGroup", |
|
151 | 193 | "InstanceType": { |
152 | 194 | "Ref": "InstanceType" |
153 | 195 | }, |
| 196 | + "IamInstanceProfile": { "Ref": "EC2InstanceProfile" }, |
154 | 197 | "SecurityGroups": [ |
155 | 198 | "SSH from home" |
156 | 199 | ], |
|
180 | 223 | "#!/bin/bash -xe\n", |
181 | 224 | "sudo yum -y update\n", |
182 | 225 | "sudo yum install -y git\n", |
183 | | - "git config --global user.name lukewis\n", |
184 | | - " git config --global user.email [email protected]\n", |
185 | | - "git clone https://github.com/lukewis/aws.git\n", |
186 | | - "./aws/scripts/mongoanddockerinit.sh -u ", |
| 226 | + "mkdir -p /aws/scripts/\n", |
| 227 | + "aws s3 cp s3://com.figtreesoftware.cf.scripts/mongoanddockerinit.sh /aws/scripts/mongoanddockerinit.sh\n", |
| 228 | + "sudo chmod +x /aws/scripts/mongoanddockerinit.sh\n", |
| 229 | + "/aws/scripts/mongoanddockerinit.sh -u ", |
187 | 230 | { "Ref" : "DbAdminUsername" }, |
188 | 231 | " -p ", |
189 | | - { "Ref" : "DbAdminPassword" }, |
190 | | - "\n" |
| 232 | + { "Ref" : "DbAdminPassword" } |
191 | 233 | ]] |
192 | 234 | } |
193 | 235 | } |
|
0 commit comments