Login to your AWS Account / User, Select EC2 Service to access EC2 Dashboard
Click Select to choose the Amazon Linux AMI
Choose t2.micro / Click Next: Configuration Instance Detail
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: Configure Security Group
Select Select an existing security group / Click Review and Launch
Choose your previos created keypair and click on Acknowledge… box / Click Launch instances
Add HTTP rule into the security group (defautl group) / Save rules