Lanch EC2 with bash user data script

  • STEPS

    1. create EC2 instance

    2. in the advance setting section, there is option to add bash script. The given example is for creating web server and create index.html

    
                         #!/bin/bash
                        sudo su
                        yum -y install httpd
                        echo "<p> My Instance! </p>" >> /var/www/html/index.html
                        sudo systemctl enable httpd
                        sudo systemctl start httpd