AWS EC2 tcping tcping examples tcping.exe

Ping Amazon EC2 Server Instances – How To

By default Amazon EC2 instances don’t respond to ICMP requests, i.e. ping.  Of course there are several reasons why one may want to ping an Amazon EC2 instance, including verifying if it is online and to test latency.  As with most things there is more than one approach to this issue.

First, you could enable ICMP through Amazon security groups.  This can be done easily with the Amazon Management console, ElasticFox or EC2 command line tools.  You could open it up to the whole world:

ec2-authorize default -P icmp -t -1:-1 -s

. . . or, specific IP addresses or ranges:

ec2-authorize default -P icmp -t -1:-1 -s <IP Address>

Another approach would be to use TCPing (works with both Linux and Windows – see Ping Over TCP with tcping.exe in Windows or tcping for Linux).  I like to use this method because you can test general connectivity over specific ports.  For example you could use


to test connectivity to the specified server over the default port 80.  Or you could specify a port, like 22 for SSH or 3389 for RDP:

tcping 22

One method I use to determine when an EC2 instance that is first starting comes online, or when a restarting instance is again online (either from a reboot or bundling the EC2 instance), is to use tcping to send a ping continuously every second.  You could use the command:

tcping -t -i 1

This very useful as you can essentially track the progress of the instance coming online, then becoming available.  At first you will receive the message, “Connection timed out. . .”  This indicates that tcping is not getting a response at all, i.e. that the instance cannot be reached.  Once the instance starts, but the OS isn’t fully available the message, “Connection refused. . .” will be the result.  This means tcping can reach the machine (the network card and TCP/IP stack are available), however, the port you are probing, 80 in this case, isn’t accepting connections.  Then, when it’s available (on the specified port) it will respond with the message, “Port is open. . .”

I like to use the interval of 1 second as it is useful in determining how long an instance was offline and the duration of each stage.

For more info see the following posts.

Linux tcp ping tcping tcping examples

tcping for Linux

tcping does a TCP connect to the given ip/port combination. The user can specify a timeout in seconds. This is useful in shell scripts running in firewalled environments. Often SYNs are just being dropped by firewalls, thus connection establishment will be retried several times (for minutes) until a TCP timeout is reached. With tcping it is possible to check first if the desired port is reachable and then start connection establishment.

Exit codes:

  • -1: an error occured.
  • 0: port is open
  • 1: port is closed
  • 2: user timeout

Syntax: tcping [-q] [-t timeout_sec] [-u timeout_usec]

  • -q : quiet mode, do not output anything (except error messages)
  • -t : timeout in seconds
  • -u : timeout in microseconds

Download tcping for Linux:

tcping runs under Linux, OpenBSD, Solaris 7/8/9, Solaris 2.6, AIX, and maybe others. Just try.

See also:

tcp ping tcping examples tcping.exe

Ping Over TCP with tcping.exe in Windows

tcping.exe (tcp ping) is a small console application that operates similarly to ‘ping’, however it works over a tcp port. Works with all versions of Windows – Windows 7, Windows Vista, Windows XP, Windows 2008, Windows 2003.

Download tcping.exe.

tcping example:


Probing - Port is open - time=26.241ms
Probing - Port is open - time=20.022ms
Probing - Port is open - time=23.272ms
Probing - Port is open - time=24.594ms

Ping statistics for
     4 probes sent.
     4 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 20.022ms, Maximum = 26.241ms, Average = 23.532ms

tcping options

tcping.exe by Eli Fulkerson
Please see for updates.
Usage: tcping [-t] [-d] [-i interval] [-n times] server-address [server-port]

         -t   : ping continuously until stopped via control-c
         -n 5 : for instance, send 5 pings
         -i 5 : for instance, ping every 5 seconds
         -d   : include date and time on each line
         -b 1 : enable beeps (1 for on-down, 2 for on-up,
                              3 for on-change, 4 for always)

        If you don't pass server-port, it defaults to 80.


  • Win32 Console. Runs on XP, Vista, Windows 7, Windows 2008, etc.


  • C++ – Makefile included for Visual Studio.


See also: