EC2 knife bootstrap

I have created an EC2 instance with the help of the following command from my on-prem setup:

knife ec2 server create -I ami-04763b3055de4860b -f t2.micro -Z us-east-1a -N knifeNode -x ubuntu --sudo --associate-public-ip

Here is the output for the command.

Generated keypair file: /root/chef-repo/.chef/ubuntu-841f8b09decea1af003b.pem

Waiting for EC2 to create the instance
Instance ID: i-0bc992001e61139ed
Flavor: t2.micro
Image: ami-04763b3055de4860b
Region: us-east-1
Availability Zone: us-east-1a
Security Group Ids: sg-03e76fffa750dd077
AWS Tags: Name: knifeNode
SSH Key: ubuntu-841f8b09decea1af003b
T2/T3 Unlimited: Disabled

Subnet ID: subnet-0f4d29db599f3f0de
Tenancy: default
Public DNS Name: ec2-54-226-153-171.compute-1.amazonaws.com
Private IP Address: 172.17.11.196

Waiting for sshd access to become available
SSH Target Address: ec2-54-226-153-171.compute-1.amazonaws.com(public_dns_name)
.done

SSH Target Address: ec2-54-226-153-171.compute-1.amazonaws.com(public_dns_name)
Connecting to ec2-54-226-153-171.compute-1.amazonaws.com
The authenticity of host 'ec2-54-226-153-171.compute-1.amazonaws.com (54.226.153.171)' can't be established.
fingerprint is SHA256:UBzK5G86Zf368Lx/nG+nQHdczq5MVIziAURuVhWLe8c.

Are you sure you want to continue connecting
? (Y/N) y
Node knifeNode exists, overwrite it? (Y/N) y
Client knifeNode exists, overwrite it? (Y/N) y
Creating new client for knifeNode
Creating new node for knifeNode
Bootstrapping ec2-54-226-153-171.compute-1.amazonaws.com
[ec2-54-226-153-171.compute-1.amazonaws.com] -----> Installing Chef Omnibus (stable/15)
downloading https://omnitruck.chef.io/chef/install.sh
to file /tmp/install.sh.1918/install.sh
[ec2-54-226-153-171.compute-1.amazonaws.com] trying wget...
[ec2-54-226-153-171.compute-1.amazonaws.com] ubuntu 16.04 x86_64
Getting information for chef stable 15 for ubuntu...
downloading https://omnitruck.chef.io/stable/chef/metadata?v=15&p=ubuntu&pv=16.04&m=x86_64
to file /tmp/install.sh.1922/metadata.txt
[ec2-54-226-153-171.compute-1.amazonaws.com] trying wget...
[ec2-54-226-153-171.compute-1.amazonaws.com] sha1 69f56b4913d225575b27b853c84f8a933d4bb172
sha256 bbf9787c5bb5c6df860767fee8e4a5c5b57cc9e5604f132f5d6f699048d2ad94
url https://packages.chef.io/files/stable/chef/15.5.9/ubuntu/16.04/chef_15.5.9-1_amd64.deb
version 15.5.9
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] downloaded metadata file looks valid...
[ec2-54-226-153-171.compute-1.amazonaws.com] downloading https://packages.chef.io/files/stable/chef/15.5.9/ubuntu/16.04/chef_15.5.9-1_amd64.deb
to file /tmp/install.sh.1922/chef_15.5.9-1_amd64.deb
[ec2-54-226-153-171.compute-1.amazonaws.com] trying wget...
[ec2-54-226-153-171.compute-1.amazonaws.com] Comparing checksum with sha256sum...
[ec2-54-226-153-171.compute-1.amazonaws.com] Installing chef 15
installing with dpkg...
[ec2-54-226-153-171.compute-1.amazonaws.com] Selecting previously unselected package chef.
[ec2-54-226-153-171.compute-1.amazonaws.com] (Reading database ... 51385 files and directories currently installed.)
[ec2-54-226-153-171.compute-1.amazonaws.com] Preparing to unpack .../chef_15.5.9-1_amd64.deb ...
[ec2-54-226-153-171.compute-1.amazonaws.com] Unpacking chef (15.5.9-1) ...
[ec2-54-226-153-171.compute-1.amazonaws.com] Setting up chef (15.5.9-1) ...
[ec2-54-226-153-171.compute-1.amazonaws.com] Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io
[ec2-54-226-153-171.compute-1.amazonaws.com] Starting the first Chef Infra Client Client run...
[ec2-54-226-153-171.compute-1.amazonaws.com] +---------------------------------------------+
:heavy_check_mark: 2 product licenses accepted.
+---------------------------------------------+
[ec2-54-226-153-171.compute-1.amazonaws.com] Starting Chef Infra Client, version 15.5.9
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:27+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode, retry 1/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:32+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode, retry 2/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:37+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode, retry 3/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:42+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode, retry 4/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:47+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode, retry 5/5
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] ================================================================================
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] Chef encountered an error attempting to load the node data for "knifeNode"
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] ================================================================================
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com]

[ec2-54-226-153-171.compute-1.amazonaws.com] Networking Error:
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] -----------------
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode - Failed to open TCP connection to testchefserver.gklocal.com:443 (getaddrinfo: Name or service not known)

[ec2-54-226-153-171.compute-1.amazonaws.com]

[ec2-54-226-153-171.compute-1.amazonaws.com] Your chef_server_url may be misconfigured, or the network could be down.

[ec2-54-226-153-171.compute-1.amazonaws.com]

[ec2-54-226-153-171.compute-1.amazonaws.com] Relevant Config Settings:
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] -------------------------
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] chef_server_url "https://testchefserver.gklocal.com/organizations/trainocatein"

[ec2-54-226-153-171.compute-1.amazonaws.com]

[ec2-54-226-153-171.compute-1.amazonaws.com] System Info:
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] ------------
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] chef_version=15.5.9

[ec2-54-226-153-171.compute-1.amazonaws.com] ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

[ec2-54-226-153-171.compute-1.amazonaws.com] program_name=/usr/bin/chef-client

[ec2-54-226-153-171.compute-1.amazonaws.com] executable=/opt/chef/bin/chef-client
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com]

[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] Running handlers:
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:52+00:00] ERROR: Running exception handlers
[ec2-54-226-153-171.compute-1.amazonaws.com] Running handlers complete

[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:52+00:00] ERROR: Exception handlers complete
[ec2-54-226-153-171.compute-1.amazonaws.com] Chef Infra Client failed. 0 resources updated in 26 seconds
[ec2-54-226-153-171.compute-1.amazonaws.com]
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:52+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 1/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:53:57+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 2/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:02+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 3/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:07+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 4/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:12+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 5/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:17+00:00] WARN: Error while reporting run start to Data Collector. URL: https://testchefserver.gklocal.com/organizations/trainocatein/data-collector Exception: No HTTP Code -- Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector - Failed to open TCP connection to testchefserver.gklocal.com:443 (getaddrinfo: Name or service not known)
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:17+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 1/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:22+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 2/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:27+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 3/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:32+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 4/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:37+00:00] ERROR: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector, retry 5/5
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:42+00:00] WARN: Error while reporting run start to Data Collector. URL: https://testchefserver.gklocal.com/organizations/trainocatein/data-collector Exception: No HTTP Code -- Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/data-collector - Failed to open TCP connection to testchefserver.gklocal.com:443 (getaddrinfo: Name or service not known)
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:42+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:42+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[ec2-54-226-153-171.compute-1.amazonaws.com] [2019-11-19T05:54:42+00:00] FATAL: SocketError: Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode - Failed to open TCP connection to testchefserver.gklocal.com:443 (getaddrinfo: Name or service not known)
ERROR: The following error occurred on ec2-54-226-153-171.compute-1.amazonaws.com:
ERROR:

@trainocate.in

The below error says instance failed to connect to the chef server URL. Please validate the security group added to the instance has connection to chef server via 443.

[ec2-54-226-153-171.compute-1.amazonaws.com] Error connecting to https://testchefserver.gklocal.com/organizations/trainocatein/nodes/knifeNode - Failed to open TCP connection to testchefserver.gklocal.com:443 (getaddrinfo: Name or service not known)