Skip to content

Instantly share code, notes, and snippets.

@labeveryday
Last active September 14, 2022 16:48
Show Gist options
  • Save labeveryday/cfa3db8b93690dfdddc9f9b1d3d346e2 to your computer and use it in GitHub Desktop.
Save labeveryday/cfa3db8b93690dfdddc9f9b1d3d346e2 to your computer and use it in GitHub Desktop.
Same ec2 user data
#!/bin/bash
sudo yum update -y
sudo yum install -y httpd
sudo service httpd start
sudo chkconfig httpd on
sudo chmod o+w /var/www/html
public_ip=$(curl 'http://169.254.169.254/latest/meta-data/public-ipv4' -w "\n")
sudo echo "<h1>Welcome to Amazon VPC for DevNet Snack Minute. This is your EC2 instance and ip address is $public_ip.</h1>" > /var/www/html/index.html
sudo echo "AWS_DEFAULT_REGION=us-west-2">>/etc/environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment