# AWS - packer - ssh timeout error

**URL:** <https://discuss.hashicorp.com/t/aws-packer-ssh-timeout-error/55226>\
**Category:** Packer\
**Created:** [June 20, 2023, 5:40pm UTC](https://discuss.hashicorp.com/t/aws-packer-ssh-timeout-error/55226 "2023-06-20T17:40:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prakash.prks](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@prakash.prks](https://discuss.hashicorp.com/u/prakash.prks)\
**Post date:** [June 20, 2023, 5:40pm UTC](https://discuss.hashicorp.com/t/aws-packer-ssh-timeout-error/55226/1 "2023-06-20T17:40:02Z")

</div>

Hi,

I’m trying to create aws ami image using packer, please find the json file. Here in my code I’m trying to use private\_ip while running this code im getting

Waiting for SSH to become available…  
Timeout waiting for SSH.

Could you please help me on this issue.  
``  
{  
“variables”: {  
“aws\_access\_key”: “{{env `AWS_ACCESS_KEY`}}”,  
“aws\_secret\_key”: “{{env `AWS_SECRET_KEY`}}”  
},

```
    "builders": [
    {
        "access_key": "{{user `aws_access_key`}}",
        "instance_type": "t3.medium",
        "region": "us-west-2",
        "ami_name": "linux-image",
        "secret_key": "{{user `aws_secret_key`}}",
        "source_ami": "ami- *******",
        "ssh_username": "root",
        "ssh_pty": "true",
        "type": "amazon-ebs",
        "skip_region_validation": "true",
        "vpc_id": "vpc- *****",
        "subnet_id": "subnet- *******",
        "security_group_id": "sg- *******",
        "ssh_interface": "private_ip",
        "associate_public_ip_address": "false",
        "ssh_timeout": "20m"

    }

```

],  
“provisioners”: [  
{  
“type”: “ansible”,  
“playbook\_file”: “./playbook.yml”  
}  
]  
}  
``

---

<div class="post-metadata">

**Author:** ![safenetwork-CMTY](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/safenetwork-cmty/32/16286_2.png) [@safenetwork-CMTY](https://discuss.hashicorp.com/u/safenetwork-CMTY)\
**Post date:** [June 20, 2023, 6:44pm UTC](https://discuss.hashicorp.com/t/aws-packer-ssh-timeout-error/55226/2 "2023-06-20T18:44:35Z")

</div>

Such an issue means that your liveVM does not have SSH enabled after the boot command ends or your password/key misconfigured.

That is, if AWS has a boot command, because I’m not familiar with AWS.  
I actually can’t find any, so I’ll have to ask you what is being loaded when the liveVM starts running?

---

<div class="post-metadata">

**Author:** ![prakash.prks](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@prakash.prks](https://discuss.hashicorp.com/u/prakash.prks)\
**Post date:** [June 21, 2023, 5:06am UTC](https://discuss.hashicorp.com/t/aws-packer-ssh-timeout-error/55226/3 "2023-06-21T05:06:24Z")

</div>

Hi

I’m able to see that temporary vm that is being created by packer and manually i can able to reach the server by doing ssh,however using packer while running i could see this timeout error.

Please let me know if you need any other info

---

<div class="post-metadata">

**Author:** ![safenetwork-CMTY](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/safenetwork-cmty/32/16286_2.png) [@safenetwork-CMTY](https://discuss.hashicorp.com/u/safenetwork-CMTY)\
**Post date:** [June 21, 2023, 6:08am UTC](https://discuss.hashicorp.com/t/aws-packer-ssh-timeout-error/55226/4 "2023-06-21T06:08:03Z")

</div>

A log file would be nice.

If you’re able to create a temp vm that could mean that you’re getting past the boot command and into the provisioner script `playbook.yml`, which at the end of the script does another reboot, where packer wants to make an SSH connection with the buildVM as well.

This means that for the buildVM you also need to have an SSH server running, plus the same user and password you have as the liveVM.

And if you’re really desperate screencast your packer build run and upload it somewhere so I can see what you’re doing.  
I’m only a user of packer after all and what I’m trying building isn’t what you’re trying to build, so I can only speak from my experience if I can’t see what your process looks like.
