Skip to content

Instantly share code, notes, and snippets.

@lbjay
Created June 21, 2019 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbjay/eff3a075a99bef9f0bed11739c72293b to your computer and use it in GitHub Desktop.
Save lbjay/eff3a075a99bef9f0bed11739c72293b to your computer and use it in GitHub Desktop.
const findInstance = (instances, name) => {
const found = instances.find((inst) => {
return inst.Tags.some((tag) => {
return tag.Key === `opsworks:layer:${name}`;
});
});
console.log(found);
return found;
};
const resp = await EC2.describeInstances(instanceParams).promise();
const admin = findInstance(resp.Reservations[0].Instances, 'admin');
console.log(admin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment