Tag Archives: Test AWS EC2

Test-AWSEC2 – Detect if a virtual host is running on Amazon EC2

Amazon EC2 Instances have metadata they can access. They get it by accessing a web server on a link-local address 169.254.169.254.
This PowerShell function will attempt to open http connection to the link-local address 169.254.169.254, and if successful will confirm that the host is running on Amazon Elastic Compute Cloud (Amazon EC2).

Function run on AWS EC2 virtual machine.
Function run on AWS EC2 virtual machine.

Code: