我在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已经为Packer创建了一个私钥(
ec2_amazon-ebs.pem
),以无密码方式与EC2实例通信,如上述步骤所述。但我没有看到Packer将私钥(
ec2_amazon-ebs.pem
)复制到我的笔记本电脑中(作为~/.ssh/ec2_amazon-ebs.pem
)。那么Packer如何在不将私钥复制为
~/.ssh/ec2_amazon-ebs.pem
的情况下与EC2进行通信呢?