AWS CSAA EC2
AWS Console
Create a website with user data
- Launch an EC2 instance
- Select Amazon Linux
- Select t2.micro
- Assign public IP
- Fill User Data
#!/bin/bash yum update -y yum install httpd -y service httpd start chkconfig httpd on cd /var/www/html hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname) echo "<html><h1>Hello Students Welcome To My Webpage on ${hostname}</h1></html>" > index.html
- Storage default
- Tag Name: Website
- Select Security group with http enabled from everywhere
- Launch instance
- Wait
- Open the Public DNS name from AWS Console
- What if user-data is not working?
- Open ssh connection to ec2
cat /var/log/cloud-init.log cat /var/log/cloud-init-output.log
- Open ssh connection to ec2
Comments