witty-battery-42692
08/26/2025, 4:19 PMadamant-lawyer-19698
08/26/2025, 4:54 PMwitty-battery-42692
08/26/2025, 4:55 PMwitty-battery-42692
08/26/2025, 4:59 PMadamant-lawyer-19698
08/26/2025, 5:13 PMwitty-battery-42692
08/26/2025, 5:15 PMadamant-lawyer-19698
08/26/2025, 5:16 PMimageResource.id
is the value when you setup ec2 instancesadamant-lawyer-19698
08/26/2025, 5:17 PMconst fooInstance = new aws.ec2.Instance("foo", {
ami: "ami-005e54dee72cc1d00",
instanceType: aws.ec2.InstanceType.T2_Micro,
networkInterfaces: [{
networkInterfaceId: foo.id,
deviceIndex: 0,
adamant-lawyer-19698
08/26/2025, 5:17 PMami: imageResource.id,
witty-battery-42692
08/26/2025, 5:18 PMwitty-battery-42692
08/26/2025, 5:18 PMwitty-battery-42692
08/26/2025, 5:18 PMwitty-battery-42692
08/26/2025, 5:19 PM"urn": "urn:pulumi:dev::console::aws:imagebuilder/image:Image::<imagename>",
"id": "arn:aws:imagebuilder:us-west-2:<account>:image/<imagename>/1.0.0/1",
adamant-lawyer-19698
08/26/2025, 5:19 PMadamant-lawyer-19698
08/26/2025, 5:20 PMwitty-battery-42692
08/26/2025, 5:20 PMwitty-battery-42692
08/26/2025, 5:21 PMadamant-lawyer-19698
08/26/2025, 5:59 PMOutput
, pulumi will wait for it to be created at runtime.adamant-lawyer-19698
08/26/2025, 5:59 PMOutput
values.witty-battery-42692
08/26/2025, 6:00 PMlittle-cartoon-10569
08/26/2025, 9:25 PMwitty-battery-42692
08/26/2025, 9:29 PMlittle-cartoon-10569
08/26/2025, 9:31 PMwitty-battery-42692
08/26/2025, 9:32 PMsteep-plastic-74107
08/27/2025, 3:02 PM// Extract the AMI ID from the ImageBuilder output
const customAmiId = image.outputResources.apply((resources) => {
if (resources && resources.length > 0) {
const firstResource = resources[0];
if (
"amis" in firstResource &&
firstResource.amis &&
firstResource.amis.length > 0
) {
return firstResource.amis[0].image;
}
}
throw new Error("No AMI found in ImageBuilder output");
});
// Create an EC2 instance using the custom AMI
const instance = new aws.ec2.Instance("custom-instance", {
ami: customAmiId,
instanceType: "t3.micro",
subnetId: defaultSubnet.then((subnets) => subnets.ids[0]),
tags: {
Name: "Custom AMI Instance",
},
});
witty-battery-42692
08/27/2025, 3:18 PMadamant-lawyer-19698
08/28/2025, 7:26 PMwitty-battery-42692
08/28/2025, 7:29 PMwitty-battery-42692
08/28/2025, 10:20 PM