- Newest
- Most votes
- Most comments
This error during the BootstrapInstanceForContainer step in EC2 Image Builder could be caused by several factors. Here are some potential reasons and solutions:
-
IAM Permissions: Ensure that the IAM role associated with your Image Builder infrastructure configuration has the necessary permissions. The role should include the "AmazonSSMManagedInstanceCore" managed policy at a minimum. This allows the instance to communicate with AWS Systems Manager, which is crucial for the bootstrap process.
-
Network Connectivity: If you're building in a private subnet, make sure the instance has proper outbound internet access. This can be achieved through a NAT Gateway or by setting up the required VPC endpoints. Specifically, you may need endpoints for Systems Manager, Image Builder, and potentially Amazon S3 and CloudWatch.
-
IMDSv2 Configuration: If you've set IMDSv2 (Instance Metadata Service v2) to required, you might encounter issues with the bootstrap process. Try increasing the HTTP PUT response hop limit from the default of 1 to 2 or 3, especially in container environments.
-
Systems Manager Agent: Verify that the SSM Agent is installed and functioning correctly on your instance. The bootstrap process relies on this agent to communicate with AWS services.
-
Timeout Issues: The error could be due to a timeout while verifying the Systems Manager Agent availability. This might happen if the instance takes too long to start up or if there are network latency issues.
-
Component Download: If you're using components like "aws-cli-version-2-linux" or similar, ensure that the instance can download these components. In a private subnet, this might require additional network configuration or VPC endpoints.
To troubleshoot further, you can:
- Check the CloudWatch Logs for more detailed error messages.
- Examine the logs in the S3 bucket associated with your Image Builder pipeline, if configured.
- Temporarily disable the "Terminate instance on failure" option in your infrastructure configuration to allow for manual investigation of the failed instance.
If the issue persists, you may need to review your network configuration, IAM permissions, and Image Builder pipeline settings to ensure all prerequisites are met for successful container image building.
Sources
EC2 Image Builder not working in the private subnet | AWS re:Post
How to build a container image with Image Builder, with IMDSv2 set to required | AWS re:Post
Troubleshoot build pipeline timeout errors in EC2 Image Builder | AWS re:Post
Troubleshoot Image Builder issues - EC2 Image Builder
Troubleshoot pipeline failures in EC2 Image Builder | AWS re:Post
answered 2 years ago
Relevant content
- AWS OFFICIALUpdated 10 months ago

I tried everything on this list and it is not working. This is a private network with Internet access through Transit Gateway to office network. All the endpoints listed are configured.