hashicorp / hashicorp/packer-plugin-amazon

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

Open
#448 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

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

```shell
> packer version
Packer v1.10.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.