【发布时间】:2019-07-13 07:56:52
【问题描述】:
我是 Packer 的新手,我正在尝试使用 VPC 的专用网络创建映像,但我不断遇到错误 *amazon-ebs: Timeout waiting for SSH.*
正在使用的 Packer 版本是 1.3.4,并且私有子网可以通过公共子网和路由表访问 NAT 网关。 Butas 问题可能无法到达实例,然后我也尝试过使用其他参数,例如:ssh_interface,其值为private_dns 和associate_public_ip_address。但即使是更改我也会遇到同样的错误。
我使用的模板有下一个内容
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `region`}}",
"source_ami": "{{user `source_ami`}}",
"instance_type": "{{user `instance_type`}}",
"iam_instance_profile": "{{user `role`}}",
"ssh_username": "{{user `ssh_username`}}",
"ssh_timeout": "15m",
"vpc_id": "{{user `vpc_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"associate_public_ip_address": true,
"ami_name": "{{user `name`}}.{{isotime \"2006-01-02T150405Z\"}}",
"ami_description": "based on {{user `source_ami`}}",
"tags": {
"Name": "{{user `name`}}"
}]
在模板中我没有定义安全组,但在 Packer 的日志中我看到它能够创建一个临时安全组,那么对端口 22 的访问也应该可用
==> amazon-ebs: Pausing after run of step 'StepKeyPair'. Press enter to continue.
==> amazon-ebs: Creating temporary security group for this instance: packer_5
c6b3667-c41f-92bc-aa89-efc5f3a2d8a8
==> amazon-ebs: Authorizing access to port 22 from 0.0.0.0/0 in the temporary security group...
==> amazon-ebs: Pausing after run of step 'StepSecurityGroup'. Press enter to continue.
==> amazon-ebs: Pausing after run of step 'StepCleanupVolumes'. Press enter to continue.
==> amazon-ebs: Launching a source AWS instance...
但问题仍然存在。模板中是否缺少某些内容?还是我应该做一些不同的事情来生成 AMI?
【问题讨论】:
-
jww 感谢您的提示,我将转移问题。我在这里做了这个问题,因为它是基础设施即代码,并且这里有 Terraform 和 Packer 的主题。我还猜想可以使用公共网络中的堡垒来解决这个问题,该堡垒可以通过路由表访问私有网络中的实例。那么谢谢。
标签: amazon-ec2 ssh packer