Advertisement
pilasguru

user-data-basic

May 5th, 2025 (edited)
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | Source Code | 0 0
  1. #!/bin/bash
  2. # AWS Amazon Linux 2
  3. amazon-linux-extras install -y nginx1
  4. systemctl start nginx
  5. systemctl enable nginx
  6. TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
  7. PH=`curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-hostname`
  8. echo "<body style='background-color:rgb($((RANDOM%256)),$((RANDOM%256)),$((RANDOM%256)))'>This is my instance ${PH}</body>" > /usr/share/nginx/html/index.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement