This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| yum install httpd -y | |
| /sbin/chkconfig --levels 235 httpd on | |
| service httpd start | |
| instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
| region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}') | |
| echo "<h1>$instanceId</h1>" > /var/www/html/index.html | |
| aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="PROD-$instanceId" --region "$region" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws elb create-load-balancer \ | |
| --load-balancer-name MyELB \ | |
| --listeners Protocol=TCP,LoadBalancerPort=80,InstanceProtocol=TCP,InstancePort=80 \ | |
| --subnets subnet-46e6506c subnet-57b8010f \ | |
| --scheme internet-facing \ | |
| --security-groups sg-aec570d4 | |
| aws autoscaling create-launch-configuration \ | |
| --launch-configuration-name MyLC \ | |
| --key-name virginia \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| yum update -y | |
| yum install -y httpd | |
| instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
| echo "<h1>Hello World from $instanceId</h1>" > /var/www/html/index.html | |
| systemctl start httpd | |
| systemctl enable httpd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https -y | |
| curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O | |
| unzip CloudWatchMonitoringScripts-1.2.1.zip | |
| rm CloudWatchMonitoringScripts-1.2.1.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <powershell> | |
| iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
| choco install python -y | |
| (new-object net.webclient).DownloadFile('https://s3.amazonaws.com/aws-cli/AWSCLI64.msi','c:\AWSCLI64.msi') | |
| msiexec.exe /i 'C:\AWSCLI64.msi' /qn | |
| </powershell> |