Userdata

Login to your AWS Account / User, Select EC2 Service to access EC2 Dashboard

Click Launch instance cloud.vn

Click Launch instance cloud.vn

Click Select to choose the Amazon Linux AMI cloud.vn

Choose t2.micro / Click Next: Configuration Instance Detail cloud.vn

Scroll down! cloud.vn

Advance Detail / Go to User data section cloud.vn

Past the below codes into the User data section:

#!/bin/bash
# install httpd
yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo "<h1>Hello AWS from $(hostname -f)</h1>" > /var/www/html/index.html

cloud.vn

Click Next: Add Tags cloud.vn

Click Next: Configure Security Group cloud.vn

Select Select an existing security group / Click Review and Launch cloud.vn

Click Launch cloud.vn

Choose your previos created keypair and click on Acknowledge… box / Click Launch instances cloud.vn

Launching… cloud.vn

cloud.vn

Add HTTP rule into the security group (defautl group) / Save rules cloud.vn

Successfully! cloud.vn

It worked! cloud.vn