Skip to content
GitHubXDiscord

ImageRecipe

The ImageRecipe resource allows you to define and manage AWS ImageBuilder ImageRecipes which specify how to create images using various components and configurations.

Create a basic image recipe with required properties and a common optional property.

import AWS from "alchemy/aws/control";
const basicImageRecipe = await AWS.ImageBuilder.ImageRecipe("basicImageRecipe", {
name: "MyBasicImageRecipe",
parentImage: "arn:aws:imagebuilder:us-west-2:123456789012:image/my-base-image",
version: "1.0.0",
components: [
{
componentArn: "arn:aws:imagebuilder:us-west-2:123456789012:component/my-component"
}
],
workingDirectory: "/var/imagebuilder"
});

Configure an image recipe with additional instance configuration and block device mappings.

const advancedImageRecipe = await AWS.ImageBuilder.ImageRecipe("advancedImageRecipe", {
name: "MyAdvancedImageRecipe",
parentImage: "arn:aws:imagebuilder:us-west-2:123456789012:image/my-base-image",
version: "1.0.1",
components: [
{
componentArn: "arn:aws:imagebuilder:us-west-2:123456789012:component/my-component"
}
],
blockDeviceMappings: [
{
deviceName: "/dev/xvda",
ebs: {
volumeSize: 30,
deleteOnTermination: true,
encrypted: false
}
}
],
additionalInstanceConfiguration: {
userDataOverride: "IyEvYmluL2Jhc2gKc3VsdCAiSGVsbG8sIFdvcmxkISI="
}
});

Create an image recipe with custom tags for better resource management and identification.

const taggedImageRecipe = await AWS.ImageBuilder.ImageRecipe("taggedImageRecipe", {
name: "MyTaggedImageRecipe",
parentImage: "arn:aws:imagebuilder:us-west-2:123456789012:image/my-base-image",
version: "1.0.2",
components: [
{
componentArn: "arn:aws:imagebuilder:us-west-2:123456789012:component/my-component"
}
],
tags: {
Project: "MyProject",
Environment: "Development"
}
});

Demonstrate how to combine multiple components into a single image recipe.

const combinedComponentsImageRecipe = await AWS.ImageBuilder.ImageRecipe("combinedComponentsImageRecipe", {
name: "MyCombinedImageRecipe",
parentImage: "arn:aws:imagebuilder:us-west-2:123456789012:image/my-base-image",
version: "1.0.3",
components: [
{
componentArn: "arn:aws:imagebuilder:us-west-2:123456789012:component/my-component-1"
},
{
componentArn: "arn:aws:imagebuilder:us-west-2:123456789012:component/my-component-2"
}
]
});