Last active
July 30, 2020 15:19
-
-
Save joshkitt/297da727d6e3f7c822bf67462f1ab46f to your computer and use it in GitHub Desktop.
AWS EC2 User Data with Java
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 | |
amazon-linux-extras install java-openjdk11 | |
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