加壳器将私钥存储在哪里?

Where does packer store the private key?

来自 ubuntu shell 我 运行 下面的命令,与 aws 平台对话,自定义 amazon ami(ami-9abea4fb):

$ packer build -debug template.packer 
Debug mode enabled. Builds will not be parallelized.
amazon-ebs output will be in this color.

==> amazon-ebs: Prevalidating AMI Name...
==> amazon-ebs: Pausing after run of step 'StepPreValidate'. Press enter to continue. 
==> amazon-ebs: Inspecting the source AMI...
==> amazon-ebs: Pausing after run of step 'StepSourceAMIInfo'. Press enter to continue. 
==> amazon-ebs: Creating temporary keypair: packer 5dfe9f3b-9cc2-cbfa-7349-5c8ef50c64d5
    amazon-ebs: Saving key for debug purposes: ec2_amazon-ebs.pem
==> amazon-ebs: Pausing after run of step 'StepKeyPair'. Press enter to continue. 

其中 template.packer 是:

{
    "builders": [
        {
            "type": "amazon-ebs",
            "region": "us-west-2",
            "source_ami": "ami-9abea4fb",
            "instance_type": "t2.micro",
            "ssh_username": "ubuntu",
            "ami_name": "MiddleTier-{{isotime | clean_ami_name}}",
            "ami_description": "Amazon AMI customised",
            "tags": {
                "role": "MiddleTier"
            },
            "run_tags":{
                "role": "buildSystem"
            }
        }
    ],
    "provisioners": [

    ],
    "post-processors":[

    ]
}

我的理解是,AWS 已经创建了一个私钥(ec2_amazon-ebs.pem)供打包程序以无密码方式与 EC2 实例通信,如上述步骤所述。

但我没有看到打包程序在我的笔记本电脑中复制私钥(ec2_amazon-ebs.pem)(如~/.ssh/ec2_amazon-ebs.pem)

packer 如何与 EC2 通信?没有在我的笔记本电脑中复制为 ~/.ssh/ec2_amazon-ebs.pem

除非给 Packer 一个私人 SSH,ssh_private_key_file Packer 会创建一个仅在 Packer 运行ning 时保存在内存中的临时文件。

当您使用 -debug 标记 运行 时,此临时密钥将保存到当前工作目录中。这是为了让您能够通过手动 SSH 连接到实例来解决构建问题。