amazon-ebs builder force_deregister flag: handling AMIs attached to running instances
0 reputation · 18 Aug 2021, 06:46 UTC
Goal
To understand how Packer’s force_deregister option behaves when an AMI with the target name is currently attached to a running EC2 instance.
Constraints
The build configuration is identical across local CI and production environments, but the outcome differs. The AWS region, IAM permissions for ec2:DeregisterImage, and the state propagation of image deregistration may influence the result. The ambiguity in the official documentation leads to inconsistent image management and potential outages in production.
Unresolved Questions
- What is the exact sequence of actions Packer takes when
force_deregisteris true and the target AMI is attached to a running instance? - How do region‑specific IAM policies or image state propagation delays affect the success or failure of the deregistration step?
- Should CI pipelines incorporate pre‑emptive instance termination or a conditional check before invoking
force_deregisterto avoid silent failures?