Cloud service · AWS · Updated

EC2 Image Builder - EC2 Image Builder is an AWS service for automating the creation, testing, and distribution of Linux and Windows Server machine images and container images.

In short

EC2 Image Builder helps engineers maintain standardized images by applying operating system updates, installing software, and validating the results through configurable pipelines. It produces Amazon Machine Images (AMIs) for EC2 and container images for registries, with support for scheduled builds, cross-account and cross-Region distribution, and image lifecycle management.

Cloud Services Hub →

10 key features of EC2 Image Builder

01
AMI and container image pipelines

Create automated pipelines for Linux and Windows Server AMIs or container images. Each pipeline brings together the recipe, execution infrastructure, and artifact distribution settings.

02
Reusable build and test components

Use AWS-managed components or write custom component documents to install packages, configure services, and validate images. Version components so changes can be reviewed and associated with specific image releases.

03
Scheduled and dependency-aware builds

Run pipelines manually or on a recurring schedule. Configure scheduled execution to run unconditionally or only when applicable dependencies, such as parent images or components, have updates.

04
Configurable build infrastructure

Select EC2 instance types, instance profiles, subnets, and security groups for temporary build and test resources. Use private networking when required, while providing access to AWS APIs and package repositories.

05
Image validation

Execute build-time validation and image tests to check application readiness and configuration requirements. For example, verify that a monitoring agent is installed and that required services start successfully.

06
Cross-account and cross-Region distribution

Distribute AMIs to designated AWS accounts and Regions using distribution configuration. Prepare destination permissions and KMS key policies when distributing encrypted images.

07
Workflow customization

Use image workflows to control supported build, test, and distribution execution steps. Customize workflow behavior when the default execution process does not meet operational requirements.

08
Image lifecycle management

Define lifecycle policies to deprecate, disable, or delete eligible AMIs and clean up associated resources. Configure retention and exclusion rules to avoid removing artifacts still needed for deployment or rollback.

09
Resource sharing with AWS RAM

Share components, images, image recipes, and container recipes with AWS accounts or through AWS Organizations using AWS Resource Access Manager.

10
Approved-AMI policy enforcement

Use the built-in AWS Organizations integration to enforce policies that restrict accounts to launching instances only from approved AMIs.

Where EC2 Image Builder is used

  1. 01
    Standardized operating system images

    Produce organization-approved Linux and Windows Server AMIs with common logging agents, access controls, and configuration. Application teams can use these images instead of independently maintaining baseline installation scripts.

  2. 02
    Recurring patch refreshes

    Schedule image rebuilds to incorporate operating system and application updates, then test the refreshed artifacts. Deploy the resulting AMIs through a separate rollout process rather than treating image creation as patching running instances.

  3. 03
    Application-ready EC2 images

    Preinstall application binaries, runtimes, and dependencies to reduce instance initialization work. Validate application startup during image testing and publish approved image identifiers for deployment automation.

  4. 04
    Multi-account image governance

    Build images in a dedicated account and distribute approved AMIs to workload accounts and Regions. Apply consistent release naming, encryption permissions, and retention rules across the distribution targets.

  5. 05
    Container base image maintenance

    Build container images containing approved operating system packages and shared runtime dependencies, then publish them to Amazon ECR. Downstream application builds can consume these maintained base images by version or digest.

  6. 06
    Security baseline validation

    Encode hardening steps and tests for required settings, services, and packages. Combine the results with vulnerability findings and approval gates before allowing an image into production deployments.

How EC2 Image Builder is priced

No additional Image Builder service charge

EC2 Image Builder does not add a separate charge for using the service. Charges apply to the AWS resources and services used to build, test, store, assess, and distribute images.

Build and test resource consumption

Temporary EC2 instances and their EBS volumes incur normal compute and storage charges while provisioned. Build frequency, instance size, execution duration, and failed runs affect the total cost.

Artifact storage and supporting services

AMI backing snapshots, ECR image storage, S3 objects, CloudWatch logs, and applicable data transfer incur their usual charges. Optional services and infrastructure, such as Amazon Inspector, customer-managed KMS keys, NAT gateways, and VPC endpoints, can add costs; retaining images or distributing them to more Regions also increases resource consumption.

Services EC2 Image Builder works with

A common architecture places EC2 Image Builder in a dedicated image-production account. Temporary EC2 instances run in controlled subnets, use narrowly scoped IAM instance profiles, and retrieve versioned installation assets from S3. Private builds need routes or endpoints for the AWS services they use, plus connectivity to any external package repositories. Build logs and execution records provide evidence for troubleshooting and release reviews.

After validation, AMI distribution delivers approved artifacts to workload accounts and Regions. Encrypted distribution requires coordinated IAM permissions and KMS key policies, including destination-side access where needed. Container pipelines instead publish images to ECR repositories, where application build systems or deployment tools consume approved tags or digests.

Security and deployment automation should remain explicit. Amazon Inspector findings can supplement functional image tests, while EventBridge state-change events can trigger release registration or downstream review. An AVAILABLE image is a completed artifact, not necessarily a production-approved release. Deployment tooling must select the approved AMI or container digest, update the relevant configuration, and roll out replacements. Retention policies should preserve images needed by active deployments and rollback procedures.

Amazon EC2Amazon EC2

Image Builder uses EC2 instances to execute image builds and tests and produces AMIs that EC2 can launch. For example, build an AMI with an application runtime and monitoring agent, then reference the approved AMI in an EC2 launch template. Updating an AMI or launch template does not itself replace existing instances; the deployment process must handle rollout.

Amazon S3Amazon S3

S3 can hold component documents, installation assets, and build logs. For example, store a versioned application installer in S3 and have a custom component download it during the build. Private build instances need an appropriate network path to S3, and both identity and bucket policies must permit access.

Amazon InspectorAmazon Inspector

Image Builder can integrate with Amazon Inspector to provide vulnerability findings for supported image builds when scanning is configured. For example, review package vulnerability findings alongside functional test results before approving an AMI for production. Configure the required Inspector coverage and permissions, and implement a separate approval or automation process when findings must block deployment.

Amazon EventBridgeAmazon EventBridge

EventBridge can route Image Builder image state-change events to operational automation. For example, match an image reaching the AVAILABLE state and invoke a Lambda function that records the new AMI identifier in a release catalog. Event handlers should be idempotent and should confirm that an artifact meets release requirements before promoting it.

Amazon CloudWatchAmazon CloudWatch

EC2 Image Builder sends build and workflow execution logs to CloudWatch Logs, where you can inspect component output and troubleshoot failed image builds.

Amazon Elastic Block Store (Amazon EBS)Amazon Elastic Block Store (Amazon EBS)

EC2 Image Builder creates EBS-backed AMIs using snapshots of the build instance's volumes. Image recipes can define volume mappings, and distribution settings can control encryption of the resulting images.

Amazon Elastic Container Registry (Amazon ECR)Amazon Elastic Container Registry (Amazon ECR)

EC2 Image Builder pushes completed container images to ECR repositories specified in its distribution configuration. It also uses ECR repositories when preparing images for vulnerability scanning.

Amazon Simple Notification Service (Amazon SNS)Amazon Simple Notification Service (Amazon SNS)

EC2 Image Builder can publish detailed image-status messages to an SNS topic configured in its infrastructure settings. Notifications report when an image becomes available or its build fails.

Amazon VPCAmazon VPC

EC2 Image Builder launches build and test instances in the subnet and security groups specified in its infrastructure configuration. These settings let you control network access during image creation, including building in private subnets.

AWS CloudFormationAWS CloudFormation

EC2 Image Builder resources can be provisioned through CloudFormation, including components, recipes, pipelines, workflows, and infrastructure and distribution configurations. This lets you deploy a repeatable image-building environment as a stack.

EC2 Image Builder exam questions

Real practice exam questions on EC2 Image Builder, with the correct answer and its explanation. Answer them with every option in the exam simulator.

SOA-C03

A company uses an EC2 Image Builder pipeline to create an EBS-backed Linux AMI. The parent AMI has a 10 GiB root volume. A build component installs application files under /opt and fails with a "No space left on device" error. Logs confirm that the root file system is full. The company requires both the temporary build instance and instances launched from the resulting AMI to have a root volume of at least 40 GiB. The installation paths must remain unchanged, and the parent operating system automatically expands the root file system to fill its EBS volume.

Which change should a CloudOps engineer make?

Show answerCORRECT ANSWER

Create a new image recipe version that sets the parent image's root-device block mapping to a 40 GiB EBS volume, and update the pipeline to use that recipe version.

An Image Builder image recipe defines block device mappings. Overriding the root volume size in a new recipe version provides the required space during the build and records the larger root volume configuration in the resulting AMI. The pipeline must reference the new recipe version.

DOP-C02

A company runs document-processing workers on Amazon EC2 instances in an Auto Scaling group. Job inputs, results, and checkpoints are stored outside the instances. A version-controlled build specification defines the approved operating system, application packages, and security agents.

During an investigation, engineers discover unauthorized packages and scheduled tasks on several workers. The complete set of local changes is unknown. The security team requires the affected workers to be isolated and their EBS volumes preserved for forensic analysis before disposal. Operations must restore processing capacity to a verified software baseline without propagating potentially unauthorized changes. Healthy workers can continue processing jobs.

Which recovery approach best meets these requirements?

Show answerCORRECT ANSWER

Isolate the affected workers and snapshot their EBS volumes for restricted forensic retention. Use EC2 Image Builder with a trusted source image and the approved build specification to produce and validate an AMI. Launch replacement workers from that AMI without reusing the affected volumes, and terminate the isolated workers after evidence preservation is verified.

This restores capacity from a controlled, tested definition rather than attempting to repair an unknown software state. Separately preserving the affected volumes retains evidence without incorporating their contents into replacement workers. External job state allows replacements to resume processing without depending on the affected instances.

Practice EC2 Image Builder in a full exam

Questions on EC2 Image Builder in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is EC2 Image Builder

3 min read

EC2 Image Builder automates the process of turning a base operating system image into a tested, deployable artifact. Its primary outputs are Amazon Machine Images (AMIs) and container images. For AMIs, teams typically start with a supported Linux or Windows Server image, install required applications and agents, apply configuration, and publish the resulting image for downstream deployments. Container pipelines build container images and publish them to configured repositories.

EC2 Image Builder also supports creating, maintaining, validating, sharing, and deploying macOS images.

An image pipeline combines a recipe, infrastructure configuration, and distribution configuration. An image recipe identifies a parent image, build components, and storage settings. A container recipe defines the information needed to build a container image, including its parent image and Dockerfile template. Components contain the installation, configuration, and validation logic. AWS provides managed components for common tasks, while custom components let teams encode their own requirements using the AWS Task Orchestrator and Executor component document format.

An image workflow defines the sequence of steps performed during the build and test stages of image creation.

An image recipe can contain up to 20 build and test components in any combination by default; this quota is adjustable.

Infrastructure configuration determines where the temporary build and test instances run. Engineers choose instance types, an instance profile, network settings, logging destinations, and related execution settings. Private subnet builds require connectivity to the services and package repositories used by the pipeline. Depending on the configuration, that connectivity can come from VPC endpoints, a NAT gateway, or another controlled network path. Security groups, IAM permissions, and access to software sources must be configured before builds can succeed.

Pipelines can run on demand or on a schedule. Scheduled execution can be configured to build every time or only when selected dependencies have updates. Build steps should avoid uncontrolled package versions when strict reproducibility is required. Pinning parent images, component versions, and application packages helps engineers explain changes between image releases. Logs and execution details should be retained long enough to investigate failures and support audit requirements.

Images can also be created with a stand-alone command using previously defined configuration resources, rather than through a pipeline.

Testing verifies that an image is usable before it is distributed. Practical checks include confirming that required services start, application dependencies are installed, security settings are present, and unwanted packages are absent. Passing these tests does not prove that an image is free of vulnerabilities or compliant with every policy. Teams should combine functional tests with vulnerability assessment and their own release approval process.

Distribution configuration controls where completed artifacts are delivered. AMIs can be distributed to additional AWS Regions and accounts, subject to the necessary IAM and encryption permissions. Container images can be delivered to Amazon ECR repositories. Publishing a new artifact does not automatically replace running instances or containers; deployment systems must consume the new image and perform a controlled rollout.

Image lifecycle policies help retire eligible Image Builder resources and associated artifacts according to configured rules. Retention settings should preserve rollback images and account for consumers that still reference older AMIs. EC2 Image Builder has no additional service charge, but build instances, storage, logging, image distribution, and other supporting services incur their normal AWS charges.

Learn EC2 Image Builder in lessons

3 short lessons on EC2 Image Builder in 2 certification courses.

Open the lessons

Concepts related to EC2 Image Builder

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.