ec2-publicip

1.0.4 • Public • Published

node-ec2-publicip

Retrieve EC2 public-ipv4 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-publicip

Example

    var ec2 = require("ec2-publicip");
 
    ec2.getPublicIP(function (error, ip) {
     if (error) {
     console.log(error);
     }
        console.log("Instance Public IP: ", ip);
    });

Details

Public IPV4 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 IPV4 from meta-data api.

Change Log

  • 1.0.4: Dependencies update.
  • 1.0.3: Dependencies update.
  • 1.0.2: Added example.
  • 1.0.1: Added documentation.
  • 1.0.0: Basic getPublicIP with timeout error.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    288
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    288
  • 1.0.3
    2
  • 1.0.2
    2
  • 1.0.1
    2
  • 1.0.0
    1

Package Sidebar

Install

npm i ec2-publicip

Weekly Downloads

295

Version

1.0.4

License

MIT

Last publish

Collaborators

  • manikandants