Once you have created and validated your template, the packer build command does the following for you:
- First, it creates a one-time key pair for SSH access to the instance.
- Then, it creates a dedicated security group to control access to the instance.
- After completing the preceding step, it launches an instance.
- Then, it waits until SSH is ready to receive connections.
- Afterward, it runs the provisioner steps on the instance.
- Then, it stops the instance.
- After this, it generates an AMI from the stopped instance.
- Finally, it terminates the instance.
Check out the Packer documentation for more provisioners and functionality: https://www.packer.io/docs/.