26af88b3550f3978fabf03d014266cbe2a2ae4d0
wiki/info/landscape/aws-automation.md
| ... | ... | @@ -128,6 +128,120 @@ Get value of specific attribute: |
| 128 | 128 | aws ec2 describe-instances --instance-ids i-066952116fe71fa65 _--query ‘Reservations[*].Instances[*]. |
| 129 | 129 | PublicDnsName’_ |
| 130 | 130 | |
| 131 | +aws ec2 describe-vpcs _--query ‘Vpcs[?IsDefault==`true`].VpcId’_ |
|
| 132 | + |
|
| 133 | +More syntax information can be found here http://jmespath.org/. |
|
| 134 | + |
|
| 135 | +##### Formatting |
|
| 136 | +Use text as output format: |
|
| 137 | + |
|
| 138 | +public_dns_name=$(aws ec2 describe-instances --instance-ids i-066952116fe71fa65 --query ‘Reservations[*]. |
|
| 139 | +Instances[*].PublicDnsName’ _--output text_) |
|
| 140 | + |
|
| 141 | +## Script |
|
| 142 | + |
|
| 143 | +### Files |
|
| 144 | + |
|
| 145 | +aws-setup.sh: |
|
| 146 | + |
|
| 147 | +- Parameter processing |
|
| 148 | +- Sourcing of utils.sh, ~/aws-automation/confi g, ~/aws-automation/confi g-[region].sh |
|
| 149 | +- Start of scenarios |
|
| 150 | +- Helper methods |
|
| 151 | + |
|
| 152 | +lib/build-config.sh: |
|
| 153 | + |
|
| 154 | +- GitHub script to write and read user configuration variables |
|
| 155 | + |
|
| 156 | +lib/functions_app.sh: |
|
| 157 | + |
|
| 158 | +- Functions that relate to SAP instance configuration |
|
| 159 | + |
|
| 160 | +lib/functions_ec2.sh: |
|
| 161 | + |
|
| 162 | +- Functions that relate to EC2 instance configuration |
|
| 163 | + |
|
| 164 | +lib/functions_elb.sh: |
|
| 165 | + |
|
| 166 | +- Functions that relate to Elastic Load Balancing |
|
| 167 | + |
|
| 168 | +lib/functions_io.sh: |
|
| 169 | + |
|
| 170 | +- Input processing (optional input, passwords, value proposals, default initialization) |
|
| 171 | +- Creation of user configuration files |
|
| 172 | + |
|
| 173 | +lib/functions_wrapper.sh: |
|
| 174 | + |
|
| 175 | +- Wrapper functions with error handling logic |
|
| 176 | + |
|
| 177 | +lib/require_variables.sh: |
|
| 178 | + |
|
| 179 | +- Declare input variable attributes (optional, required, password, default value, user question) |
|
| 180 | + |
|
| 181 | +lib/scenario_associate_alb.sh: |
|
| 182 | + |
|
| 183 | +- Associate instance with load balancer (target group, health check, rule, apache configuration) |
|
| 184 | + |
|
| 185 | +lib/scenario_instance.sh: |
|
| 186 | + |
|
| 187 | +- Create event |
|
| 188 | +- Change admin password |
|
| 189 | +- Associate with load balancer (target group, health check, rule, apache configuration) |
|
| 190 | + |
|
| 191 | +lib/scenario_master_instance.sh: |
|
| 192 | + |
|
| 193 | +- Create instance with correct user data to be used as master |
|
| 194 | +- Create launch template for replica with matching user data to master |
|
| 195 | + |
|
| 196 | +lib/scenario_replica_instance.sh: |
|
| 197 | + |
|
| 198 | +- Starting of a launch template |
|
| 199 | + |
|
| 200 | +lib/scenario_shared_instance.sh: |
|
| 201 | + |
|
| 202 | +- Creation of a SAP instance on an existing EC2 instance |
|
| 203 | +- Check preconditions |
|
| 204 | +- Associate SAP instance with load balancer |
|
| 205 | + |
|
| 206 | +lib/util_functions.sh: |
|
| 207 | + |
|
| 208 | +- Helper functions |
|
| 209 | + |
|
| 210 | +lib/utils.sh: |
|
| 211 | + |
|
| 212 | +- Sourcing logic |
|
| 213 | + |
|
| 214 | +lib/validation.sh: |
|
| 215 | + |
|
| 216 | +- Validation functions |
|
| 217 | + |
|
| 218 | +lib/variables.sh: |
|
| 219 | + |
|
| 220 | +- Variables |
|
| 221 | + |
|
| 222 | +### Preconditions |
|
| 223 | + |
|
| 224 | +- AWS CLI (configured) |
|
| 225 | +- Cygwin with following packages: jq, openssh, wget, curl |
|
| 226 | + |
|
| 227 | +### User input |
|
| 228 | + |
|
| 229 | +Every scenario requires user input for specific variables. For example the setup of a dedicated SAP instance on an EC2 instance requires the following variables: |
|
| 230 | + |
|
| 231 | +- Region |
|
| 232 | +- Load balancer |
|
| 233 | +- Instance type (e.g. t2.medium) |
|
| 234 | +- security group |
|
| 235 | +- image |
|
| 236 | +- instance name |
|
| 237 | +- instanz short name (e.g. for subdomains) |
|
| 238 | +- MongoDB host and port |
|
| 239 | +- alternative SSH user (default: root) |
|
| 240 | +- build version |
|
| 241 | +- keypair name |
|
| 242 | +- keypair path |
|
| 243 | +- event name (optional) |
|
| 244 | +- new admin password (optional) |
|
| 131 | 245 | |
| 132 | 246 | |
| 133 | 247 |