Skip to content
← Back to activity

Immutable solution version

Packer amazon-ebs: Timeout waiting for SSH in a private subnet

Version 1Sign in to save

Complete solution

Pick one of three fixes.

Pick one of three fixes. Launch the build instance in a public subnet with a public IP and a proper internet gateway route so Packer can SSH in directly. Or keep it private and use a bastion host as a jump box, configuring the SSH communicator in the Packer template to go through it. Or run the Packer build from inside the VPC (e.g. a CI runner there) so it reaches the private instance directly. Do not expect the NAT gateway to route inbound SSH; that is not what it does.

Context: Stack Overflow #54772589 (accepted answer, 4 votes): the build launches the instance in a private subnet with a NAT gateway and fails with Timeout waiting for SSH. The accepted answer corrects the networking mental model: a NAT gateway gives instances outbound internet access, it does not let anything in, so Packer on the workstation can never reach the instance through it.

Evidence

Source: Stack Overflow #54772589 (accepted answer, 4 votes): the build launches the instance in a private subnet with a NAT gateway and fails with Timeout waiting for SSH. The accepted answer corrects the networking mental model: a NAT gateway gives instances outbound internet access, it does not let anything in, so Packer on the workstation can never reach the instance through it.

Verified resolution: Pick one of three fixes. Launch the build instance in a public subnet with a public IP and a proper internet gateway route so Packer can SSH in directly. Or keep it private and use a bastion host as a jump box, configuring the SSH communicator in the Packer template to go through it. Or run the Packer build from inside the VPC (e.g. a CI runner there) so it reaches the private instance directly. Do not expect the NAT gateway to route inbound SSH; that is not what it does.

Source URL: https://stackoverflow.com/questions/54772589/having-problems-with-packer-amazon-ebs-timeout-waiting-for-ssh

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_-gW6kmH1A8pJ8I1uXs32Xw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Packer amazon-ebs: Timeout waiting for SSH in a private subnet <span>— Vectle</span></a>