Hey Rickard,
I did created a new keypair and launched ec2. Later I was able to ssh with
the same key.

I need to run again the packer build with flag you mentioned and will get
back to you.
Thank you for responding.

-Santosh

On Fri, Feb 15, 2019 at 2:48 PM Rickard von Essen <
[email protected]> wrote:

> Can you verify that you can create a new keypair and launch an instance
> with it and ssh to it with only that key?
>
> Also when you run packer build add the -on-error=ask argument which will
> give you some time to verify the network setup and check system console
> output for errors.
>
> On Fri, Feb 15, 2019 at 10:12 AM Santosh Kumar Ratnala <
> [email protected]> wrote:
>
>> I have created ec2 instance from the AWS console using the AMI generated
>> from the stage 1.
>> I am able to ssh it.
>>
>> On Thu, Feb 14, 2019 at 8:27 PM Rickard von Essen <
>> [email protected]> wrote:
>>
>>> Most likely your AMI built from a ISO doesn't function correctly. Launch
>>> one with the cli and successfully connect to it with ssh. If you have
>>> problems check the system console log.
>>>
>>> On Thu, Feb 14, 2019, 09:59 <[email protected] wrote:
>>>
>>>>
>>>>
>>>> On Thursday, February 14, 2019 at 2:21:06 PM UTC+5:30,
>>>> [email protected] wrote:
>>>>>
>>>>> Dear All,
>>>>> I am trying to create an Amazon base image using the centoOS 7.6 iso
>>>>> from
>>>>>
>>>>> https://mirrors.edge.kernel.org/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
>>>>> I am able to get the AMI as ami-XXXXX with out any problem.
>>>>>
>>>>> Now using this output AMI ami-XXXXX, I want to create a another base
>>>>> AMI with some custom configuration, which I want to distribute across my
>>>>> org.
>>>>>
>>>>> I am getting everytime the following issue
>>>>> [image: screen shot 2019-02-13 at 7 16 46 pm]
>>>>>
>>>>>
>>>>> Following in my json
>>>>>
>>>>> {
>>>>>   "variables": {
>>>>>     "region": "XXXX",
>>>>>     "creator": "{{env `USER`}}",
>>>>>     "ami_name": "centos-7-base-ami-{{timestamp}}",
>>>>>     "source_ami_id": "XXXXX",
>>>>>     "instance_type": "c5.large",
>>>>>     "aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
>>>>>     "aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
>>>>>     "encrypted": "true"
>>>>>   },
>>>>>   "builders": [
>>>>>     {
>>>>>       "access_key": "{{user `aws_access_key`}}",
>>>>>       "secret_key": "{{user `aws_secret_key`}}",
>>>>>       "iam_instance_profile": "packer",
>>>>>       "type": "amazon-ebs",
>>>>>       "region": "XXXX",
>>>>>       "source_ami": "{{user `source_ami_id`}}",
>>>>>       "instance_type": "{{user `instance_type`}}",
>>>>>       "ssh_username": "centos",
>>>>>       "ami_name": "{{user `ami_name`}}",
>>>>>       "ami_description": "CentOS 7 Base AMI",
>>>>>       "associate_public_ip_address": true
>>>>>     }
>>>>>   ],
>>>>>   "provisioners": [
>>>>>     {
>>>>>       "type": "shell",
>>>>>       "script": "test.sh",
>>>>>       "expect_disconnect": true
>>>>>     },
>>>>>     {
>>>>>       "type": "shell",
>>>>>       "script": "cleanup.sh"
>>>>>     },
>>>>>     {
>>>>>       "type": "ansible-local",
>>>>>       "playbook_file": "ansible/centOS-7.6-base-ami.yaml",
>>>>>       "role_paths": [
>>>>>                 "ansible/roles/"
>>>>>             ],
>>>>>       "playbook_dir": "ansible"
>>>>>     }
>>>>>
>>>>>   ],
>>>>>   "post-processors": [
>>>>>     {
>>>>>       "type": "manifest",
>>>>>       "output": "manifest.json",
>>>>>       "strip_path": true
>>>>>     }
>>>>>   ]
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Please help me to resolve this error, It is driving me nuts
>>>>>
>>>>
>>>>
>>>> ```
>>>> detail logs of
>>>> PACKER_LOG=1 packer build -debug
>>>> amazon_machine_images/CentOS/7.6-base-ami.json
>>>> ```
>>>>
>>>> ```
>>>> 2019/02/12 22:29:10 Preparing build: amazon-ebs
>>>> amazon-ebs output will be in this color.
>>>>
>>>> 2019/02/12 22:29:10 Debug enabled, so waiting for build to finish:
>>>> amazon-ebs
>>>> 2019/02/12 22:29:10 Starting build run: amazon-ebs
>>>> 2019/02/12 22:29:10 Running builder: amazon-ebs
>>>> 2019/02/12 22:29:10 [INFO] (telemetry) Starting builder amazon-ebs
>>>> 2019/02/12 22:29:10 packer: 2019/02/12 22:29:10 Found region us-east-1
>>>> 2019/02/12 22:29:10 packer: 2019/02/12 22:29:10 [INFO] AWS Auth
>>>> provider used: "SharedConfigCredentials:
>>>> /Users/rsantoshkumar/.aws/credentials"
>>>> 2019/02/12 22:29:10 packer: 2019/02/12 22:29:10 [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 AMI Name: centos-7-base-ami-1549990750
>>>>
>>>> 2019/02/12 22:29:14 packer: 2019/02/12 22:29:14 Using AMI Filters {
>>>> 2019/02/12 22:29:14 packer:   ImageIds: ["ami-09ff87be70382f68f"]
>>>> 2019/02/12 22:29:14 packer: }
>>>> ==> amazon-ebs: Pausing after run of step 'StepPreValidate'. Press
>>>> enter to continue.     amazon-ebs: Found Image ID: ami-09ff87be70382f68f
>>>> ==> amazon-ebs: Pausing after run of step 'StepSourceAMIInfo'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Pausing after run of step 'StepNetworkInfo'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Creating temporary keypair:
>>>> packer_5c62fb5e-c21c-07cc-6549-ef01fc919339
>>>>     amazon-ebs: Saving key for debug purposes: ec2_amazon-ebs.pem
>>>> ==> amazon-ebs: Pausing after run of step 'StepKeyPair'. Press enter to
>>>> continue.
>>>> ==> amazon-ebs: Creating temporary security group for this instance:
>>>> packer_5c62fb69-2002-0353-2f71-7edf16fa0ecc
>>>> 2019/02/12 22:29:21 packer: 2019/02/12 22:29:21 [DEBUG] Waiting for
>>>> temporary security group: sg-0f76a5c4e77ceaae6
>>>> 2019/02/12 22:29:22 packer: 2019/02/12 22:29:22 [DEBUG] Found security
>>>> group sg-0f76a5c4e77ceaae6
>>>> ==> amazon-ebs: Authorizing access to port 22 from 0.0.0.0/0 in the
>>>> temporary security group...
>>>> ==> amazon-ebs: Pausing after run of step 'StepSecurityGroup'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Pausing after run of step 'StepCleanupVolumes'. Press
>>>> enter to continue.
>>>> ==> 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-0697a87d73b9b0433
>>>> ==> amazon-ebs: Waiting for instance (i-0697a87d73b9b0433) to become
>>>> ready...
>>>>     amazon-ebs: Public DNS: ec2-3-91-67-118.compute-1.amazonaws.com
>>>>     amazon-ebs: Public IP: 3.91.67.118
>>>>     amazon-ebs: Private IP: 172.31.27.168
>>>> ==> amazon-ebs: Pausing after run of step 'StepRunSourceInstance'.
>>>> Press enter to continue.
>>>> 2019/02/12 22:29:46 packer: 2019/02/12 22:29:46 [INFO] Not using winrm
>>>> communicator, skipping get password...
>>>> ==> amazon-ebs: Pausing after run of step 'StepGetPassword'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Using ssh communicator to connect: 3.91.67.118
>>>> 2019/02/12 22:29:48 packer: 2019/02/12 22:29:48 [INFO] Waiting for SSH,
>>>> up to timeout: 5m0s
>>>> ==> amazon-ebs: Waiting for SSH to become available...
>>>> 2019/02/12 22:30:03 packer: 2019/02/12 22:30:03 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:30:23 packer: 2019/02/12 22:30:23 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:30:43 packer: 2019/02/12 22:30:43 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:31:03 packer: 2019/02/12 22:31:03 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:31:23 packer: 2019/02/12 22:31:23 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:31:43 packer: 2019/02/12 22:31:43 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:32:03 packer: 2019/02/12 22:32:03 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:32:23 packer: 2019/02/12 22:32:23 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:32:43 packer: 2019/02/12 22:32:43 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:33:03 packer: 2019/02/12 22:33:03 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:33:23 packer: 2019/02/12 22:33:23 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:33:43 packer: 2019/02/12 22:33:43 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:34:03 packer: 2019/02/12 22:34:03 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:34:23 packer: 2019/02/12 22:34:23 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:34:43 packer: 2019/02/12 22:34:43 [DEBUG] TCP connection
>>>> to SSH ip/port failed: dial tcp 3.91.67.118:22: i/o timeout
>>>> 2019/02/12 22:34:48 ui error: ==> amazon-ebs: Timeout waiting for SSH.
>>>> ==> amazon-ebs: Timeout waiting for SSH.
>>>> 2019/02/12 22:34:48 packer: 2019/02/12 22:34:48 [DEBUG] SSH wait
>>>> cancelled. Exiting loop.
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepGetPassword'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepRunSourceInstance'.
>>>> Press enter to continue.
>>>> ==> amazon-ebs: Terminating the source AWS instance...
>>>>
>>>>
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepCleanupVolumes'.
>>>> Press enter to continue. ==> amazon-ebs: Cleaning up any extra volumes...
>>>> ==> amazon-ebs: Destroying volume (vol-01bc24588a63bb5be)...
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepSecurityGroup'.
>>>> Press enter to continue. ==> amazon-ebs: Deleting temporary security
>>>> group...
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepKeyPair'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Deleting temporary keypair...
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepNetworkInfo'. Press
>>>> enter to continue.
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepSourceAMIInfo'.
>>>> Press enter to continue.
>>>> ==> amazon-ebs: Pausing before cleanup of step 'StepPreValidate'. Press
>>>> enter to continue.
>>>> 2019/02/12 22:50:50 [INFO] (telemetry) ending amazon-ebs
>>>> (virtpy3) rsantoshkumar at ALIPL0485 in ~/acquia-ws/is-base-images on
>>>> master*
>>>> $ packer build  amazon_machine_images/CentOS/7.6-base-ami.json
>>>> amazon-ebs output will be in this color.
>>>>
>>>> ==> amazon-ebs: Prevalidating AMI Name: centos-7-base-ami-1549992459
>>>>     amazon-ebs: Found Image ID: ami-09ff87be70382f68f
>>>> ==> amazon-ebs: Creating temporary keypair:
>>>> packer_5c63020b-e96a-0877-5397-e49b13a37ee0
>>>> ==> amazon-ebs: Creating temporary security group for this instance:
>>>> packer_5c630210-c3c6-9ce2-dafe-439b3813fc83
>>>> ==> amazon-ebs: Authorizing access to port 22 from 0.0.0.0/0 in the
>>>> temporary security group...
>>>> ==> 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-06424edb4cdefc0f6
>>>> ==> amazon-ebs: Waiting for instance (i-06424edb4cdefc0f6) to become
>>>> ready...
>>>> ==> amazon-ebs: Using ssh communicator to connect: 54.152.174.226
>>>> ==> amazon-ebs: Waiting for SSH to become available...
>>>> ==> amazon-ebs: Timeout waiting for SSH.
>>>> ==> amazon-ebs: Terminating the source AWS instance...
>>>> ==> amazon-ebs: Cleaning up any extra volumes...
>>>> ==> amazon-ebs: Destroying volume (vol-0ae070b1850908ad6)...
>>>> ==> amazon-ebs: Deleting temporary security group...
>>>> ==> amazon-ebs: Deleting temporary keypair...
>>>> Build 'amazon-ebs' errored: Timeout waiting for SSH.
>>>>
>>>> ==> Some builds didn't complete successfully and had errors:
>>>> --> amazon-ebs: Timeout waiting for SSH.
>>>>
>>>> ==> Builds finished but no artifacts were created.
>>>> ```
>>>>
>>>> --
>>>> 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/mitchellh/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 [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/packer-tool/30333b98-f595-4c54-939a-9fd993319ab4%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/packer-tool/30333b98-f595-4c54-939a-9fd993319ab4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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/mitchellh/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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/packer-tool/CALz9Rt8WPBfe5708GryUfypE-Z6gFgTw_7dLMbwmgU6R2_-58w%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt8WPBfe5708GryUfypE-Z6gFgTw_7dLMbwmgU6R2_-58w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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/mitchellh/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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/packer-tool/CACA%3Dnfi2wRfsRBMSEFZ5ZxD90hABaX%2BNNz559nZzd6S4ndSj0A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/packer-tool/CACA%3Dnfi2wRfsRBMSEFZ5ZxD90hABaX%2BNNz559nZzd6S4ndSj0A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/mitchellh/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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/CALz9Rt8RN_JhEvXpGyVbA-%3Da-ZkmzyVivWxC7v%3DyX3-D0C_4%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt8RN_JhEvXpGyVbA-%3Da-ZkmzyVivWxC7v%3DyX3-D0C_4%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/mitchellh/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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CACA%3DnfiyE2JTR%2BP0U36SoSgtCvf28negKQoBR6QxfgaM%2B2ykuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to