Hi there,
I was thinking, and seems is a chicken egg here.
This is how I understand the goal of this.
You start with a packer template, it get a source ami + AWS key/secret
It boots, it create a random pair for the provisioning work (this is important), and then shutdown.. then start.. and shutdown.. I think this is for confirmation it does boot after provision.
The generated key is only used on the provision, and then is discarded. This is way when you want to name this pair, is only a temporary pair.
So, what you want to do: use a private key pair, for this provision leads to this error:
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain ==> amazon-ebs: Terminating the source AWS instance...
Which I think is fine, perhaps a bit better wording on the documentation is needed.. I did couple of test and check the source code..
So to make this working..
So, I created 2 templates.. one that set my public key for ubuntu user.. and a second use the ami generated with my previous one and my private key.. and did work.
So I think the option here is, if your ami have a known private key, you can use for the provision, otherwise let the random one be created and then deleted.
here the templates and logs
Alvaro.