# Use instance metadata services
# get region name
REGION=$(curl -s -H "Authorization: Bearer Oracle" \\
http://169.254.169.254/opc/v2/instance/region)
# get display name
DISPLAY_NAME=$(curl -s -H "Authorization: Bearer Oracle" \\
http://169.254.169.254/opc/v2/instance/displayName)
# Get Public IP
PUBLIC_IP=$(curl -s https://ifconfig.me)
# prepare www folders
mkdir -p ~/www/demo
cd ~/www/demo
# prepare index.html
cat > index.html <<EOF
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>DNS Failover Demo</title>
</head>
<body>
<h1>DNS Failover Demo</h1>
<pre>
Region: $REGION
Instance: $DISPLAY_NAME
Public IP: $PUBLIC_IP
</pre>
</body>
</html>
EOF
# start serving http:80
sudo python3 -m http.server 80