8

I`m creating a new image and everything is working. I would like to debug via ssh during the instance creation. A temp keypair is created and attached to the temp instance. My question is, can I get this keypair somewhere in order to debug it?

==> amazon-ebs: Prevalidating AMI Name...
    amazon-ebs: Found Image ID: ami-0866798422f5d546b
==> amazon-ebs: Creating temporary keypair: packer_5cc6c77d-494a-f185-b5b3-f9b59e62fd4e

Best,

Armando

armandomiani
  • 181
  • 1
  • 5

2 Answers2

10

First, make sure that packer runs in debug mode (packer build -debug ...), otherwise the temporary key will not be written to disk but will only be kept in memory.

packer will store the key in its working directory. In other words, look in the same directory from which you started the packer process.

If you use AWS, the file will be called ec2_amazon-ebs.pem. Assuming you are building an Ubuntu image, you should be able to login to the instance with this command:

ssh -i ec2_amazon-ebs.pem ubuntu@<ip>

(where <ip> can be found in the packer output or through the AWS console)

Philipp Claßen
  • 1,675
  • 3
  • 18
  • 30
1

They are likely in the user's home folder, or the folder in which packer is running.

You can look at ~/.ssh, or you can specify you own keypair.

Pierre.Vriens
  • 7,225
  • 14
  • 39
  • 84