You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using amazon-ebs on a spot instance, it turns out packer is silently skipping the step in which it shuts down the EC2 instance. AWS will then reboot the instance as part of the AMI creation so it can snapshot the disk at rest. This reboot has been causing me issues due to the "on boot" scripts being baked in via packer.
It's pretty widely documented that packer will stop the ec2 instance before creating the AMI, however... it turns out this is silently skipped if the instance is a spot instance. With this logic undocumented and no logging (not even trace logging) available, this has been a very frustrating behavior to track down.
With a little more testing, I understand the need for this as you cannot stop an instance associated with a one-time spot request. However, if packer had made that known (with docs and/or logging) that would have saved me a lot of time troubleshooting packer.
legoscia
added a commit
to legoscia/packer-plugin-amazon
that referenced
this issue
Oct 30, 2024
Overview of the Issue
When using amazon-ebs on a spot instance, it turns out packer is silently skipping the step in which it shuts down the EC2 instance. AWS will then reboot the instance as part of the AMI creation so it can snapshot the disk at rest. This reboot has been causing me issues due to the "on boot" scripts being baked in via packer.
It's pretty widely documented that packer will stop the ec2 instance before creating the AMI, however... it turns out this is silently skipped if the instance is a spot instance. With this logic undocumented and no logging (not even trace logging) available, this has been a very frustrating behavior to track down.
https://github.com/hashicorp/packer-plugin-amazon/blob/main/builder/ebs/builder.go#L385
https://github.com/hashicorp/packer-plugin-amazon/blob/main/builder/common/step_stop_ebs_instance.go#L29
Reproduction Steps
StepStopEBSBackedInstance
is silently skipped afterStepCleanupTempKeys
Plugin and Packer version
> packer version Packer v1.10.0
The text was updated successfully, but these errors were encountered: