{"id":20974,"library":"aws-cdk-aws-imagebuilder","title":"AWS CDK ImageBuilder Construct Library","description":"The CDK Construct Library for AWS::ImageBuilder provides high-level, object-oriented abstractions for defining and deploying EC2 Image Builder resources in AWS. The current version is 1.204.0, released as part of the AWS CDK v1, which is in maintenance mode. New development should use AWS CDK v2 and the @aws-cdk/aws-imagebuilder module.","status":"maintenance","version":"1.204.0","language":"python","source_language":"en","source_url":"https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk-aws-imagebuilder","tags":["cdk","aws","imagebuilder","infrastructure","cloudformation"],"install":[{"cmd":"pip install aws-cdk-aws-imagebuilder==1.204.0","lang":"bash","label":"Install specific version"}],"dependencies":[{"reason":"Required for CDK constructs and resources","package":"aws-cdk-lib","optional":false},{"reason":"Required for construct base class","package":"constructs","optional":false},{"reason":"Required for language bindings","package":"jsii","optional":false},{"reason":"Required for publishing","package":"publication","optional":false},{"reason":"Required for type checking","package":"typeguard","optional":false}],"imports":[{"note":"CfnImageRecipe is a class, not a module. Import the class directly from the aws_imagebuilder module.","wrong":"from aws_cdk.aws_imagebuilder.CfnImageRecipe import *","symbol":"CfnImageRecipe","correct":"from aws_cdk.aws_imagebuilder import CfnImageRecipe"},{"note":"Correct import path for infrastructure configuration.","symbol":"CfnInfrastructureConfiguration","correct":"from aws_cdk.aws_imagebuilder import CfnInfrastructureConfiguration"}],"quickstart":{"code":"import aws_cdk as cdk\nfrom aws_cdk import aws_imagebuilder as imagebuilder\n\napp = cdk.App()\nstack = cdk.Stack(app, \"ImageBuilderStack\")\n\n# Create an Image Pipeline\nimage_recipe = imagebuilder.CfnImageRecipe(\n    stack,\n    \"MyRecipe\",\n    name=\"my-recipe\",\n    version=\"1.0.0\",\n    parent_image=\"amazonlinux-2-x86_64\",\n    components=[\n        imagebuilder.CfnImageRecipe.ComponentConfigurationProperty(\n            component_arn=\"arn:aws:imagebuilder:us-east-1:aws:component/amazon-cloudwatch-agent/x.x.x\"\n        )\n    ],\n    working_directory=\"/tmp\"\n)\n\ninfra_config = imagebuilder.CfnInfrastructureConfiguration(\n    stack,\n    \"MyInfraConfig\",\n    name=\"my-infra-config\",\n    instance_types=[\"t3.micro\"],\n    subnet_id=\"subnet-12345678\"\n)\n\npipeline = imagebuilder.CfnImagePipeline(\n    stack,\n    \"MyPipeline\",\n    name=\"my-pipeline\",\n    image_recipe_arn=image_recipe.ref,\n    infrastructure_configuration_arn=infra_config.ref,\n    schedule=imagebuilder.CfnImagePipeline.ScheduleProperty(\n        schedule_expression=\"cron(0 0 * * *)\"\n    )\n)\n\napp.synth()","lang":"python","description":"Creates a minimal CDK stack with an EC2 Image Builder image recipe, infrastructure configuration, and pipeline."},"warnings":[{"fix":"Use 'aws-cdk-lib' and 'import aws_cdk.aws_imagebuilder as imagebuilder' in CDK v2.","message":"This is the CDK v1 package. CDK v1 entered maintenance mode on June 1, 2022 and will end support on June 1, 2023. Users should migrate to CDK v2 and use the @aws-cdk/aws-imagebuilder module instead.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Upgrade to CDK v2 and remove 'aws-cdk-aws-imagebuilder' from requirements. Use 'from aws_cdk import aws_imagebuilder as imagebuilder'.","message":"The CDK v1 and v2 packages have different names. In v1 it's 'aws-cdk-aws-imagebuilder', in v2 it's part of 'aws-cdk-lib' with imports from 'aws_cdk.aws_imagebuilder'.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure ARNs are valid. For components, use 'aws-cdk.aws_imagebuilder.CfnComponent' to create custom components or reference existing ones.","message":"Many Image Builder resources require ARNs of existing AWS resources (e.g., components, AMIs). Using dummy ARNs may cause deployment failures. Always reference valid ARNs or use tokens.","severity":"gotcha","affected_versions":"all"},{"fix":"Always wrap the schedule expression in a ScheduleProperty object as shown in the quickstart.","message":"The property 'schedule' expects a ScheduleProperty object, not a cron expression string. Commonly mistaken.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Either install CDK v2 (aws-cdk-lib) or use import path 'from aws_cdk.aws_imagebuilder import ...' in v1.","cause":"Using CDK v2 import path with v1 package installed.","error":"ModuleNotFoundError: No module named 'aws_cdk.aws_imagebuilder'"},{"fix":"Use correct import: 'from aws_cdk.aws_imagebuilder import CfnImageRecipe'.","cause":"Importing incorrectly, e.g., 'from aws_cdk.aws_imagebuilder.CfnImageRecipe import *'.","error":"AttributeError: module 'aws_cdk.aws_imagebuilder' has no attribute 'CfnImageRecipe'"},{"fix":"Use only one version of CDK. For v1 use 'aws-cdk-aws-imagebuilder', for v2 use 'aws-cdk-lib' and remove v1 packages.","cause":"Mixing CDK v1 and v2 dependencies.","error":"jsii.errors.JSIIError: .../aws-cdk-lib.aws-imagebuilder is not available"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}