AWS - packer - ssh timeout error


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”

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?


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

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.