# 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.

Cloud service · AWS. Updated 2026-11-12. Page: https://blowstack.com/tools/cloud-services-hub/ec2-image-builder

> 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.

Practice exams covering EC2 Image Builder: [SOA-C03 AWS Certified CloudOps Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional).

## 10 key features of EC2 Image Builder

1. **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.
2. **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.
3. **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.
4. **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.
5. **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.
6. **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.
7. **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.
8. **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.
9. **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. **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. **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. **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. **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. **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. **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 EC2](https://blowstack.com/tools/cloud-services-hub/amazon-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 S3](https://blowstack.com/tools/cloud-services-hub/amazon-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 Inspector](https://blowstack.com/tools/cloud-services-hub/amazon-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 EventBridge](https://blowstack.com/tools/cloud-services-hub/amazon-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 CloudWatch](https://blowstack.com/tools/cloud-services-hub/amazon-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)](https://blowstack.com/tools/cloud-services-hub/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)](https://blowstack.com/tools/cloud-services-hub/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)](https://blowstack.com/tools/cloud-services-hub/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 VPC](https://blowstack.com/tools/cloud-services-hub/amazon-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 CloudFormation](https://blowstack.com/tools/cloud-services-hub/aws-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.
- **[AWS CloudTrail](https://blowstack.com/tools/cloud-services-hub/aws-cloudtrail)**: EC2 Image Builder API activity is recorded in CloudTrail. These records identify who created or changed a pipeline, started a build, or performed other Image Builder operations.
- **[AWS CodePipeline](https://blowstack.com/tools/cloud-services-hub/aws-codepipeline)**: EC2 Image Builder pipelines can be invoked by an EC2 Image Builder action in CodePipeline. The action starts an image build and tracks its result as part of the software release pipeline.
- **[AWS Config](https://blowstack.com/tools/cloud-services-hub/aws-config)**: AWS Config can record supported EC2 Image Builder resources and their configuration changes. This provides configuration history for resources such as image pipelines, recipes, and distribution configurations.
- **[AWS Identity and Access Management (IAM)](https://blowstack.com/tools/cloud-services-hub/aws-identity-and-access-management-(iam))**: EC2 Image Builder uses IAM service-linked roles, workflow execution roles, and EC2 instance profiles to perform builds and distribute images. IAM policies also control who can create, modify, share, or run Image Builder resources.
- **[AWS Key Management Service (AWS KMS)](https://blowstack.com/tools/cloud-services-hub/aws-key-management-service-(aws-kms))**: EC2 Image Builder uses KMS keys to encrypt component documents and image storage. Distribution configurations can specify keys for encrypting AMIs in destination Regions and accounts.
- **[AWS License Manager](https://blowstack.com/tools/cloud-services-hub/aws-license-manager)**: EC2 Image Builder distribution settings can associate License Manager license configurations with output AMIs. This lets you apply license-tracking requirements to images containing licensed software.
- **[AWS Marketplace](https://blowstack.com/tools/cloud-services-hub/aws-marketplace)**: EC2 Image Builder recipes can use subscribed AWS Marketplace image products as base images and incorporate Marketplace component products. For example, a recipe can add a third-party hardening component to a golden AMI.
- **[AWS Organizations](https://blowstack.com/tools/cloud-services-hub/aws-organizations)**: EC2 Image Builder supports distributing AMI launch permissions to an organization or organizational unit and sharing supported Image Builder resources across an organization. Organizations service control policies can also restrict Image Builder operations in member accounts.
- **[AWS PrivateLink](https://blowstack.com/tools/cloud-services-hub/aws-privatelink)**: EC2 Image Builder supports interface VPC endpoints through AWS PrivateLink. Clients can use these endpoints to call Image Builder APIs without routing requests through the public internet.
- **[AWS Resource Access Manager (AWS RAM)](https://blowstack.com/tools/cloud-services-hub/aws-resource-access-manager-(aws-ram))**: EC2 Image Builder uses AWS RAM to share components, images, image recipes, and container recipes with other AWS accounts. Resource shares can also target an organization or organizational unit.
- **[AWS Secrets Manager](https://blowstack.com/tools/cloud-services-hub/aws-secrets-manager)**: EC2 Image Builder can retrieve credentials from Secrets Manager to authenticate to an external container registry specified in a container recipe. This allows a pipeline to use a private base image without embedding registry credentials in the recipe.
- **[AWS Security Token Service (AWS STS)](https://blowstack.com/tools/cloud-services-hub/aws-security-token-service-(aws-sts))**: EC2 Image Builder uses STS to assume the distribution role in destination accounts when copying AMIs across accounts. The temporary credentials allow it to perform the authorized image-distribution operations in each account.
- **[AWS Systems Manager](https://blowstack.com/tools/cloud-services-hub/aws-systems-manager)**: EC2 Image Builder uses Systems Manager Agent on build and test instances to execute image-customization work. It can also resolve base AMIs through Parameter Store parameters and update configured parameters with newly generated AMI IDs.

## EC2 Image Builder exam questions

Real practice exam questions on EC2 Image Builder, with the correct answer and its explanation.

### Question 1 (SOA-C03)

**Question:**

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?

**Correct 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.

**Explanation:** 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.

### Question 2 (DOP-C02)

**Question:**

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?

**Correct 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.

**Explanation:** 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:

- [SOA-C03](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate): 13 questions
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 13 questions

## What is EC2 Image Builder

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.

- SOA-C03: EC2 Image Builder: creating image pipelines (Premium), https://app.blowstack.com/lessons/ec2-image-builder-creating-image-pipelines-soa-c03
- DOP-C02: EC2 Image Builder: pipeline configuration and dependency-aware execution (Premium), https://app.blowstack.com/lessons/ec2-image-builder-pipeline-configuration-and-dependency-aware-execution-dop-c02
- SOA-C03: EC2 Image Builder: image distribution and retention (Premium), https://app.blowstack.com/lessons/ec2-image-builder-image-distribution-and-retention-soa-c03

## Concepts related to EC2 Image Builder

- [Immutable Infrastructure](https://blowstack.com/tools/cloud-concepts-hub/immutable-infrastructure): Immutable infrastructure is an operating model in which deployed compute resources are replaced with newly built, versioned resources rather than modified in place.
- [Containers](https://blowstack.com/tools/cloud-concepts-hub/containers): Containers package applications and their dependencies into isolated processes that run using a compatible host operating-system kernel.
- [OS Hardening](https://blowstack.com/tools/cloud-concepts-hub/os-hardening): OS hardening is the process of reducing an operating system’s attack surface and enforcing secure configurations to limit compromise and its impact.
- [Patch Management](https://blowstack.com/tools/cloud-concepts-hub/patch-management): Patch management is the controlled process of identifying, testing, deploying, and verifying software updates to reduce vulnerabilities and maintain reliable systems.
