Alf*_*hee 4 ssh amazon-ec2 packer
我是 Packer 新手,尝试使用 VPC 的专用网络创建映像,但不断出现错误*amazon-ebs: Timeout waiting for SSH.*
使用的Packer版本是1.3.4,私有子网可以通过公有子网和路由表访问NAT网关。但由于问题可能无法到达实例,所以我还尝试了其他参数,例如: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`}}"
}]
Run Code Online (Sandbox Code Playgroud)
在模板中我没有定义安全组,但在 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...
Run Code Online (Sandbox Code Playgroud)
但问题仍然存在。模板中是否缺少某些内容?或者我应该做些什么不同的事情来生成 AMI?
小智 6
您无法通过 NAT 网关访问 ec2。AWS 中的 NAT 网关用于提供从 VPC 到 VPC 的 Internet 访问。
您有多种选择:
问候
| 归档时间: |
|
| 查看次数: |
15499 次 |
| 最近记录: |