packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.69:22: i/o timeout

80 views
Skip to first unread message

satya mallipeddi

unread,
Jun 15, 2020, 6:28:57 PM6/15/20
to Packer
Hi all i am having trouble in connecting SSH, can some one help me to fix the issue 
 {
    "_comment" : "Create a AWS AMI ith AMZ Linux 2018 with Java and Tomcat",
    "variables": {
      "access_key""AKIA4GKVL52I4CKP34MR",
      "secret_key""/RbZX77gwnwNXKg1QO4mwBdyQCN0QX61/F79rk+H"
    },
    
    "builders": [{
      "type""amazon-ebs",
      "access_key""{{user `access_key`}}",
      "secret_key""{{user `secret_key`}}",
      "region""us-east-1",
      "source_ami""ami-01d025118d8e760db",
      "instance_type""t2.nano",
      "ssh_username""ec2-user",
      "ami_name""DevOpsClass-Build-{{isotime | clean_resource_name}}",
      "vpc_id""vpc-04e69f2a4a09ae2e5",
      "subnet_id""subnet-0365d6c1d3d38427f",
      "security_group_id""sg-04cc6e9056d120f4f",      
      "communicator""ssh",
      "pause_before_connecting""10m"
      
    
    }],
    "provisioners": [{
      "type""shell",
      "inline": [
        "sleep 30",
        "sudo yum update -y",
        "sudo yum install nginx -y",
        "sudo yum install git -y",
        "sudo service nginx start",
        "sudo chkconfig nginx on"
        ]
    }]
  }






$ PACKER_LOG=1 packer build packer.json 2020/06/15 14:37:13 [INFO] Packer version: 1.5.1 [go1.13.5 windows amd64] 2020/06/15 14:37:13 Attempting to open config file: C:\Users\satya\packer.config 2020/06/15 14:37:13 [WARN] Config file doesn't exist: C:\Users\satya\packer.config 2020/06/15 14:37:13 Setting cache directory: E:\packer_cache cannot determine if process is in background: Process background check error: not implemented yet 2020/06/15 14:37:13 Plugin could not be found at C:\terraform\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs (exec: "C:\\terraform\\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs": file does not exist). Checking same directory as executable. 2020/06/15 14:37:13 Current exe path: C:\terraform\packer.exe 2020/06/15 14:37:13 Creating plugin client for path: C:\terraform\packer.exe 2020/06/15 14:37:13 Starting plugin: C:\terraform\packer.exe []string{"C:\\terraform\\packer.exe", "plugin", "packer-builder-amazon-ebs"} 2020/06/15 14:37:13 Waiting for RPC address for: C:\terraform\packer.exe 2020/06/15 14:37:14 packer.exe plugin: [INFO] Packer version: 1.5.1 [go1.13.5 windows amd64] 2020/06/15 14:37:14 packer.exe plugin: Attempting to open config file: C:\Users\satya\packer.config 2020/06/15 14:37:14 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\satya\packer.config 2020/06/15 14:37:14 packer.exe plugin: Setting cache directory: E:\packer_cache 2020/06/15 14:37:14 packer.exe plugin: args: []string{"packer-builder-amazon-ebs"} 2020/06/15 14:37:14 packer.exe plugin: Plugin port range: [10000,25000] 2020/06/15 14:37:14 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000 2020/06/15 14:37:14 packer.exe plugin: Waiting for connection... 2020/06/15 14:37:14 Received tcp RPC address for C:\terraform\packer.exe: addr is 127.0.0.1:10000 2020/06/15 14:37:14 packer.exe plugin: Serving a plugin connection... 2020/06/15 14:37:14 Plugin could not be found at C:\terraform\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell (exec: "C:\\terraform\\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell": file does not exist). Checking same directory as executable. 2020/06/15 14:37:14 Current exe path: C:\terraform\packer.exe 2020/06/15 14:37:14 Creating plugin client for path: C:\terraform\packer.exe 2020/06/15 14:37:14 Starting plugin: C:\terraform\packer.exe []string{"C:\\terraform\\packer.exe", "plugin", "packer-provisioner-shell"} 2020/06/15 14:37:14 Waiting for RPC address for: C:\terraform\packer.exe 2020/06/15 14:37:15 packer.exe plugin: [INFO] Packer version: 1.5.1 [go1.13.5 windows amd64] 2020/06/15 14:37:15 packer.exe plugin: Attempting to open config file: C:\Users\satya\packer.config 2020/06/15 14:37:15 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\satya\packer.config 2020/06/15 14:37:15 packer.exe plugin: Setting cache directory: E:\packer_cache 2020/06/15 14:37:15 packer.exe plugin: args: []string{"packer-provisioner-shell"} 2020/06/15 14:37:15 packer.exe plugin: Plugin port range: [10000,25000] 2020/06/15 14:37:15 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000 2020/06/15 14:37:15 Received tcp RPC address for C:\terraform\packer.exe: addr is 127.0.0.1:10000 2020/06/15 14:37:15 packer.exe plugin: Waiting for connection... 2020/06/15 14:37:15 packer.exe plugin: Serving a plugin connection... 2020/06/15 14:37:15 Build debug mode: false 2020/06/15 14:37:15 Force build: false 2020/06/15 14:37:15 On error: 2020/06/15 14:37:15 Preparing build: amazon-ebs amazon-ebs: output will be in this color. 2020/06/15 14:37:15 Waiting on builds to complete... 2020/06/15 14:37:15 Starting build run: amazon-ebs 2020/06/15 14:37:15 Running builder: amazon-ebs 2020/06/15 14:37:15 [INFO] (telemetry) Starting builder amazon-ebs 2020/06/15 14:37:15 packer.exe plugin: Found region us-east-1 2020/06/15 14:37:15 packer.exe plugin: [INFO] AWS Auth provider used: "StaticProvider" 2020/06/15 14:37:15 packer.exe plugin: [INFO] (aws): No AWS timeout and polling overrides have been set. Packer will default to waiter-specific delays and timeouts. If you would like to customize the length of time between retries and max number of retries you may do so by setting the environment variables AWS_POLL_DELAY_SECONDS and AWS_MAX_ATTEMPTS to your desired values. ==> amazon-ebs: Prevalidating any provided VPC information ==> amazon-ebs: Prevalidating AMI Name: DevOpsClass-Build-2020-06-15T21-37-14Z 2020/06/15 14:37:16 packer.exe plugin: Using AMI Filters { 2020/06/15 14:37:16 packer.exe plugin: ImageIds: ["ami-01d025118d8e760db"] 2020/06/15 14:37:16 packer.exe plugin: } amazon-ebs: Found Image ID: ami-01d025118d8e760db 2020/06/15 14:37:17 packer.exe plugin: [INFO] Finding AZ and VpcId for the given subnet 'subnet-0365d6c1d3d38427f' 2020/06/15 14:37:17 packer.exe plugin: [INFO] AvailabilityZone found: 'us-east-1a' ==> amazon-ebs: Creating temporary keypair: packer_5ee7ea0b-44d4-fbfe-feaf-32b13b5bf60d 2020/06/15 14:37:18 packer.exe plugin: Using specified security groups: [sg-04cc6e9056d120f4f] ==> amazon-ebs: Launching a source AWS instance... ==> amazon-ebs: Adding tags to source instance amazon-ebs: Adding tag: "Name": "Packer Builder" amazon-ebs: Instance ID: i-09603a88b05cea7fc ==> amazon-ebs: Waiting for instance (i-09603a88b05cea7fc) to become ready... 2020/06/15 14:37:36 packer.exe plugin: [INFO] Not using winrm communicator, skipping get password... ==> amazon-ebs: Using ssh communicator to connect: 192.168.1.160 2020/06/15 14:37:36 packer.exe plugin: [INFO] Waiting for SSH, up to timeout: 5m0s ==> amazon-ebs: Waiting for SSH to become available... 2020/06/15 14:37:36 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:37:51 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:37:56 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:38:11 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:38:16 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:38:31 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:38:36 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:38:51 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:38:56 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:39:11 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:39:16 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:39:31 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:39:36 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:39:51 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:39:56 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:40:11 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:40:16 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:40:31 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:40:36 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:40:51 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:40:56 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:41:11 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:41:16 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:41:31 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:41:36 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:41:51 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:41:56 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:42:11 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout 2020/06/15 14:42:16 packer.exe plugin: Using ssh_host value: 192.168.1.160 2020/06/15 14:42:31 packer.exe plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.1.160:22: i/o timeout ==> amazon-ebs: Timeout waiting for SSH. 2020/06/15 14:42:36 packer.exe plugin: [DEBUG] SSH wait cancelled. Exiting loop. ==> amazon-ebs: Terminating the source AWS instance... ==> amazon-ebs: Cleaning up any extra volumes... ==> amazon-ebs: No volumes to clean up, skipping ==> amazon-ebs: Deleting temporary keypair... 2020/06/15 14:43:09 [INFO] (telemetry) ending amazon-ebs 2020/06/15 14:43:09 machine readable: error-count []string{"1"} Build 'amazon-ebs' errored: Timeout waiting for SSH. ==> Some builds didn't complete successfully and had errors: 2020/06/15 14:43:09 machine readable: amazon-ebs,error []string{"Timeout waiting for SSH."} ==> Builds finished but no artifacts were created. 2020/06/15 14:43:09 [INFO] (telemetry) Finalizing. ==> Some builds didn't complete successfully and had errors: --> amazon-ebs: Timeout waiting for SSH. ==> Builds finished but no artifacts were created. 2020/06/15 14:43:10 waiting for all plugin processes to complete... 2020/06/15 14:43:10 C:\terraform\packer.exe: plugin process exited 2020/06/15 14:43:10 C:\terraform\packer.exe: plugin process exited

Wilken Rivera

unread,
Jun 15, 2020, 8:04:12 PM6/15/20
to packe...@googlegroups.com

Hello Satya,

It looks like you might've shared your AWS access keys. if you haven't already please deactivate those keys to prevent unexpected user access and potential security issues. In the future please look into using environment variables for setting your access keys - see https://www.packer.io/docs/templates/user-variables/#usage


With that being said, I see you are using an existing security group. Have you confirmed that the security group allows inbound SSH access? 


Wilken

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/de99360c-c7d2-44d7-ba92-ec02fb777904o%40googlegroups.com.

satya mallipeddi

unread,
Jun 15, 2020, 11:02:27 PM6/15/20
to packe...@googlegroups.com
@Wiken thanks for reaching out, i have checked the iGW and security group its open to the internet. but still  i am getting same errors with SSH is unable to connect with the server that it has created.

Reply all
Reply to author
Forward
0 new messages