1.0.2 • Published 7 years ago

ec2-public-hostname v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

node-ec2-public-hostname

Retrieve EC2 public-hostname from instance metadata.

Note: this assumes that a metadata service is available at http://169.254.169.254/. Thus it works on EC2 instances, behavior on other machines is undefined.

Install

    npm install ec2-public-hostname

Example

    var ec2 = require("ec2-public-hostname");

    ec2.getPublicHostname(function (error, hostname) {
    	if (error) {
    		console.log(error);
    	}
        console.log("Instance Public Hostname: ", hostname);
    });

Details

Public Hostname of Amazon EC2 instances can be retrieved via http GET calls to http://169.254.169.254/latest/meta-data This module gets the public Hostname from meta-data api.

Change Log

  • 1.0.2: Dependencies update
  • 1.0.1: Dependencies update
  • 1.0.0: Basic getPublicHostname method.

License

MIT