Skip to content

Instantly share code, notes, and snippets.

@arnathan2k
Last active June 17, 2017 00:49
Show Gist options
  • Save arnathan2k/5ce9a7215415bddde37b10ad07d66b4d to your computer and use it in GitHub Desktop.
Save arnathan2k/5ce9a7215415bddde37b10ad07d66b4d to your computer and use it in GitHub Desktop.
#!/bin/bash
yum install httpd -y
/sbin/chkconfig --levels 235 httpd on
service httpd start
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
echo "<h1>$instanceId</h1>" > /var/www/html/index.html
aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="Test-$instanceId" --region "$region"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment