title: Having trouble creating a basic AWS AMI with Packer.io. SSH Timeout
body: <p>I'm trying to follow <a href="https://packer.io/intro/getting-started/build-image.html"><strong>these</strong></a> instructions to build a basic AWS image using Packer.io. But it is not working for me.</p>
  
  <p>Here is my Template file:</p>
  
  <pre><code>{
    "variables": {
      "aws_access_key": "",
      "aws_secret_key": ""
    },
    "builders": [{
      "type": "amazon-ebs",
      "access_key": "{{user `aws_access_key`}}",
      "secret_key": "{{user `aws_secret_key`}}",
      "region": "us-east-1",
      "source_ami": "ami-146e2a7c",
      "instance_type": "t2.micro",
      "ssh_username": "ubuntu",
      "ami_name": "packer-example {{timestamp}}",
  
      # The following 2 lines don't appear in the tutorial.
      # But I had to add them because it said this source AMI
      # must be launched inside a VPC.
      "vpc_id": "vpc-98765432",
      "subnet_id": "subnet-12345678"
    }]
  }
  </code></pre>
  
  <p>You will notice that I had to deviate from the instructions by adding the two lines at the bottom (for VPC and subnets). This is because I kept getting the following error:</p>
  
  <pre><code>==&gt; amazon-ebs: Error launching source instance: The specified instance type 
                  can only be used in a VPC. A subnet ID or network interface
                  ID is required to carry out the request. 
                  (VPCResourceNotSpecified)
  </code></pre>
  
  <p>That VPC and Subnet are temprorary ones that I manually had to create. But why should I have to do that? Why doesn't packer create those and then delete them like I see it creates a temporary security group and key-pair?</p>
  
  <p>Furthermore, even after I add those two lines, it fails to create the AMI because it gets an SSH timeout. Why? I am having no trouble manually SSHing to other instances in this VPC. The temporary packer instance has <code>InstanceState=Running</code>, <code>StatusChecks=2/2</code> and SecurityGroup that allows SSH from all over the world.</p>
  
  <p>See the debug output of the packer command below:</p>
  
  <pre><code>$ packer build -debug -var 'aws_access_key=MY_ACCESS_KEY' -var 'aws_secret_key=MY_SECRET_KEY' packer_config_basic.json
  Debug mode enabled. Builds will not be parallelized.
  amazon-ebs output will be in this color.
  
  ==&gt; amazon-ebs: Inspecting the source AMI...
  ==&gt; amazon-ebs: Pausing after run of step 'StepSourceAMIInfo'. Press enter to continue.
  ==&gt; amazon-ebs: Creating temporary keypair: packer 99999999-8888-7777-6666-555555555555
      amazon-ebs: Saving key for debug purposes: ec2_amazon-ebs.pem
  ==&gt; amazon-ebs: Pausing after run of step 'StepKeyPair'. Press enter to continue.
  ==&gt; amazon-ebs: Creating temporary security group for this instance...
  ==&gt; amazon-ebs: Authorizing SSH access on the temporary security group...
  ==&gt; amazon-ebs: Pausing after run of step 'StepSecurityGroup'. Press enter to continue.
  ==&gt; amazon-ebs: Launching a source AWS instance...
      amazon-ebs: Instance ID: i-12345678
  ==&gt; amazon-ebs: Waiting for instance (i-12345678) to become ready...
      amazon-ebs: Private IP: 10.0.2.204
  ==&gt; amazon-ebs: Pausing after run of step 'StepRunSourceInstance'. Press enter to continue.
  ==&gt; amazon-ebs: Waiting for SSH to become available...
  ==&gt; amazon-ebs: Timeout waiting for SSH.
  ==&gt; amazon-ebs: Pausing before cleanup of step 'StepRunSourceInstance'. Press enter to continue.
  ==&gt; amazon-ebs: Terminating the source AWS instance...
  ==&gt; amazon-ebs: Pausing before cleanup of step 'StepSecurityGroup'. Press enter to continue.
  ==&gt; amazon-ebs: Deleting temporary security group...
  ==&gt; amazon-ebs: Pausing before cleanup of step 'StepKeyPair'. Press enter to continue.
  ==&gt; amazon-ebs: Deleting temporary keypair...
  ==&gt; amazon-ebs: Pausing before cleanup of step 'StepSourceAMIInfo'. Press enter to continue.
  Build 'amazon-ebs' errored: Timeout waiting for SSH.
  
  ==&gt; Some builds didn't complete successfully and had errors:
  --&gt; amazon-ebs: Timeout waiting for SSH.
  
  ==&gt; Builds finished but no artifacts were created.
  </code></pre>