This script will bring up EC2 instance with following :
* updated packages,
* HTTPD service installed and started,
* Also run a job at startup to Poweroff instance after 2 hours (refer 7200)
(Note: Poweroff is kept only for those who need instance only for practicing and/or limited time and to save costs. In case of production use, comment out poweroff statement)
#!/bin/bash yum update -y yum install httpd24 -y service httpd start chkconfig httpd on echo "Hello, this is a test instance from `curl http://169.254.169.254/latest/meta-data/placement/availability-zone`" > /var/www/html/index.html echo "# This will bring up instance only for below mentioned seconds" >> /etc/rc.local echo "(sleep 7200; poweroff) &" >> /etc/rc.local
No comments:
Post a Comment