Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please document/log that StepStopEBSBackedInstance is silently skipped when building with a spot instance #448

Open
dgersting opened this issue Dec 20, 2023 · 1 comment
Labels

Comments

@dgersting
Copy link

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

  1. Create basic packer config using amazon-ebs using a spot instance
  2. Run packer build with debug or trace logging
  3. Observe StepStopEBSBackedInstance is silently skipped after StepCleanupTempKeys

Plugin and Packer version

> packer version 
Packer v1.10.0
@dgersting dgersting added the bug label Dec 20, 2023
@dgersting
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant