NAME
VM::EC2::Instance::Located - determine if code is executing on an EC2 instance
SYNOPSIS
my $result = VM::EC2::Instanced::Located::at_ec2();
if($result) {
print "Running at EC2\n";
} else {
print "Not running at EC2\n";
}
DESCRIPTION
Provides a function that determines if code is executing on an EC2 instance.
Currently implemented by resolving instnace-data.ec2.internal. It will succeed on an ec2 instance and fail otherwise.
METHODS
at_ec2
Determines if the code is running at EC2.
The answer is cached because typically the result does not change unless you're able to move processes between an EC2 instance an a non EC2 instance.
Returns a boolean value answering the question.