high-jackal-29091
04/15/2020, 8:33 AMconst ami = aws.getAmi({
mostRecent: false,
owners: ["0123456"], // my AWS account ID
}, { provider: args.provider });
let imageId = ami.imageId || ami.id;
console.log('IMAGE ID: ' + imageId);
//result: Your query returned more than one result. Please try a more specific search criteria, or set `most_recent` attribute to true.
const ami = aws.getAmi({
filters: [
{
name: "name",
values: ['non existing ami name'],
}
],
mostRecent: true,
owners: ["0123456"], // my AWS account ID
}, { provider: args.provider });
let imageId = ami.imageId || ami.id;
console.log('IMAGE ID: ' + imageId);
// result: Your query returned no results. Please change your search criteria and try again.
const ami = aws.getAmi({
mostRecent: true,
owners: ["0123456"], // my AWS account ID
}, { provider: args.provider });
let imageId = ami.imageId || ami.id;
console.log('IMAGE ID: ' + imageId);
//result: IMAGE ID: undefined
broad-dog-22463
04/15/2020, 12:27 PMexport const imageID = imageId;
And tell me if that works?broad-dog-22463
04/15/2020, 12:28 PMconst amiId = aws.getAmi({
owners: ["0123456"],
mostRecent: true,
}, { async: true }).then(ami => ami.id);
high-jackal-29091
04/15/2020, 2:54 PMexport class ABC
constructor so I could not export const from there. I added imageID: imageId to this.registerOutputs
but it did not work. { async: true }).then(ami => ami.id);
works like a charm.high-jackal-29091
04/15/2020, 2:54 PM