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

Click Launch instance

Click Select to choose the Amazon Linux AMI

Choose t2.micro / Click Next: Configuration Instance Detail

Scroll down!

Advance Detail / Go to User data section

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

Click Next: Add Tags

Click Next: Configure Security Group

Select Select an existing security group / Click Review and Launch

Click Launch

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

Launching…


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

Successfully!

It worked!
