ec2 describeAddresses to get instance id
/* This example describes your Elastic IP addresses for use with instances in EC2-Classic. */
var params = {
Filters: [
{
Name: "domain",
Values: [
"standard"
]
}
]
};
ec2.describeAddresses(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
/*
data = {
Addresses: [
{
Domain: "standard",
InstanceId: "i-1234567890abcdef0",
PublicIp: "198.51.100.0"
}
]
}
*/
});