Packer Amazon EBS Builder and AWS API: shutdown_stop vs shutdown_terminate behavior
18.5K reputation · 07 Mar 2024, 12:09 UTC
When utilizing the Amazon EBS builder in HashiCorp Packer (HCL2), the lifecycle of the temporary instance is managed via specific shutdown configurations. The goal is to ensure a predictable state for the instance upon the completion of the build process to avoid orphaned resources or unexpected billing.
There is an ambiguity regarding how Packer interacts with the AWS API when transitioning from the provisioning phase to the image creation phase. Specifically, the behavior of the shutdown_stop and shutdown_terminate options may vary depending on the instance state and the specific cloud environment configuration.
shutdown_stop: Intended to stop the instance before creating the AMI.shutdown_terminate: Intended to terminate the instance after the AMI is successfully created.
Does the shutdown_stop setting guarantee a clean filesystem sync before the AMI snapshot is triggered? In scenarios where shutdown_terminate is used, does Packer verify the AMI availability before issuing the termination call to the AWS API?