Last active
July 30, 2020 15:21
-
-
Save joshkitt/f8788d57b7b8ae6bfb8240ef575dde15 to your computer and use it in GitHub Desktop.
AWS EC2 User Data Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo su | |
yum update -y | |
yum install -y httpd | |
systemctl start httpd.service | |
systemctl enable httpd.service | |
EC2_AVAIL_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
echo "<h1>Hello World from $(hostname -f) in AZ $EC2_AVAIL_ZONE </h1>" > /var/www/html/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment