Working With User-data / Bootstrapping in EC2
- In last Lab 4.10, we provisioned a linux-based EC2 instance and manually installed apache web service over it with help of series of commands
- This process of user-data/bootstrap we can Bash script to automated the process of installation of apache at boot up of EC2
- Here’s the Bash Script:
#!/bin/bash yum install httpd -y service httpd start chkconfig httpd on cd /var/www/html wget https://webmagicinformatica.s3.amazonaws.com/travel.zip unzip travel.zip chmod -R 777 * echo "Server is healthy" > /var/www/html/health.html
- We would just need to pass-in this script during provisioning of EC2
- Here’s where you need to input this script
Rest process remains the same as shown in Lab 4.1 - Once instance is created try to open it’s public IP in browser, Hello World page should open-up
- Don’t delete this instance as we would need it in upcoming labs