ove*_*nge 3 ssh amazon-ec2 packer ec2-ami amazon-ami
我从 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.
Run Code Online (Sandbox Code Playgroud)
在哪里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":[
]
}
Run Code Online (Sandbox Code Playgroud)
我的理解是,AWS 为打包程序创建了一个私钥(ec2_amazon-ebs.pem),以便以无密码方式与 EC2 实例对话,如上述步骤所述。
但是我没有看到打包机ec2_amazon-ebs.pem在我的笔记本电脑(as ~/.ssh/ec2_amazon-ebs.pem)中复制私钥()
Packer 如何与 EC2 通信?没有像~/.ssh/ec2_amazon-ebs.pem在我的笔记本电脑中那样复制
除非 Packer 获得私有 SSH,否则 Packerssh_private_key_file会创建一个仅在 Packer 运行时保存在内存中的临时文件。
当您使用-debug标志运行时,此临时密钥将保存到当前工作目录中。这是为了让您能够通过手动 SSH 连接到实例来对构建进行故障排除。