document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # Use instance metadata services
  2. # get region name
  3. REGION=$(curl -s -H "Authorization: Bearer Oracle" \\
  4.   http://169.254.169.254/opc/v2/instance/region)
  5.  
  6. # get display name
  7. DISPLAY_NAME=$(curl -s -H "Authorization: Bearer Oracle" \\
  8.   http://169.254.169.254/opc/v2/instance/displayName)
  9.  
  10. # Get Public IP
  11. PUBLIC_IP=$(curl -s https://ifconfig.me)
  12.  
  13. # prepare www folders
  14. mkdir -p ~/www/demo
  15. cd ~/www/demo
  16.  
  17. # prepare index.html
  18. cat > index.html <<EOF
  19. <!doctype html>
  20. <html>
  21.   <head>
  22.     <meta charset="utf-8" />
  23.     <title>DNS Failover Demo</title>
  24.   </head>
  25.   <body>
  26.     <h1>DNS Failover Demo</h1>
  27.     <pre>
  28. Region:     $REGION
  29. Instance:   $DISPLAY_NAME
  30. Public IP:  $PUBLIC_IP
  31.     </pre>
  32.   </body>
  33. </html>
  34. EOF
  35.  
  36. # start serving http:80
  37. sudo python3 -m http.server 80
');