Last active
June 15, 2023 20:13
-
-
Save tylerapplebaum/98a940c312724ae6a0838d43afc2a592 to your computer and use it in GitHub Desktop.
HTML5 and some light CSS. Useful for my AWS testing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang=en> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>AWS Test</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
body {background-color: AliceBlue;} | |
h1 {font-size: 3vw; font-family: 'Open Sans', sans-serif;} | |
p {font-size: 1vw; font-family: 'Open Sans', sans-serif;} | |
</style> | |
<script> | |
var xhr = new XMLHttpRequest; | |
xhr.open("GET", "public-ipv4.txt", true); | |
// disable browser caching in request header | |
xhr.setRequestHeader('Cache-Control', 'no-cache, no-store, max-age=0'); | |
xhr.setRequestHeader('Expires', 'Thu, 1 Jan 1970 00:00:00 GMT'); | |
xhr.setRequestHeader('Pragma', 'no-cache'); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState == 4 && xhr.status == 200) { | |
document.getElementById("IPv4").innerHTML = (xhr.responseText); | |
} | |
} | |
xhr.send(); | |
</script> | |
</head> | |
<body> | |
<h1>Hello from AWS!</h1> | |
<br /> | |
<p>EC2 Instance IPv4 address: <span id="IPv4"></span></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One way around that is to record the EC2 public IP to a database, and make a call to that from the server. The table would use the instanceId as the key.