Basically I need to be able to connect from one EC2 instance to another using SSH. I run the command
ssh -i path-to-pem-file ec2-user@dns-address-of-ec2-instance, and it times out.
I set my security group to allow SSH inbound from the public IP address of my second EC2 instance, but it still doesn't work. I know that everything should be fine because when I set my SSH inbound traffic to "allow from anywhere" I can connect with no problems. Also I can connect to the EC2 instance from a home machine (I added my IP address to the security group) without any problems.
Obviously I can't leave my inbound traffic open to "allow from anywhere", but I can't seem to connect when I limit it to just the IP address of the second EC2 instance. Maybe the public IP address isn't what I should be putting into the security group?
I can't seem to ping it either; it just times out. Here is the result of
ssh -vv -i path-to-pem-file ec2-user@dns-address-of-ec2-instance
OpenSSH_6.2p2, OpenSSL 1.0.1h-fips 5 Jun 2014 debug1: Reading configuration data /home/ec2-user/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 50: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to dns-address [IP Address different from public ip] port 22. debug1: connect to address [IP Address different from public ip] port 22: Connection timed out ssh: connect to host dns-address port 22: Connection timed out