Why cannot I ping a AWS server but connect via ssh? - bash

I have created a linux node on Amazon (AWS) machine. I can ssh into the node but I cannot do ping into its IPv4 Public IP. What should I do to fix this issue?
Works:
ssh -v -i "my_pem.pem" ubuntu#<AmazonNode's_IP>
Does not work (returns %100 failure):
ping <AmazonNode's_IP>
I have also added following setting from https://stackoverflow.com/a/30544572/2402577 but it did not helped.
Please note that when I did this setting, I can ping from another amazon node to an amazon node. But from a non-amazon node still I cannot do ping to the amazon node.
Thank you for your valuable time and help.

ICMP port is closed by default on AWS instances. You need to enable it in a security group.

Related

AWS DocumentDB ECONNRESET error with SSH tunneling from Mongo shell

I've followed the AWS DocumentDB docs for connecting outside VPC:
I created an EC2 instance in the same security group and VPC as the DocDB cluster
In the security group I opened 22 port access for my IP, and also opened port 27017 for communication inside the security so EC2 instance can SSH tunnel to the DocDB
I ran ssh -f -i "ssh-tunneling-access.pem" -L 27017:{doc-db-cluster}:27017 {ec2-instance-user}#{ec2-instance-dns} -N to open the SSH tunnel
In another terminal I tried to connect using Mongo shell with mongosh "mongodb://{credentials}!#localhost:27017/?tls=true&tlsAllowInvalidHostnames=true&tlsCAFile=rds-combined-ca-bundle.pem"
I got an error "MongoServerSelectionError: read ECONNRESET"
I'm running on Windows 11, and my terminal is Powershell Core.
Any ideas what did I miss and/or how to troubleshoot it?
First of all, make sure you can connect to DocumentDB from the EC2 instance. The security group attached to the DocumentDB cluster has to allow port 27017 with source the EC2 instance (or the security group of the EC2).
Second, is not clear from where you're initiating the tunnel. Did you execute step 3. on the Windows 11 machine? Have you installed OpenSSH on Windows?
How about using a GUI client, like Robo 3t, which has SSH tunneling support? Instructions on how to connect can be found here.

How can I access the Neptune Database from my local environment using SSH tunnel?

I have both application and network load balancer. EC2 instance and the Neptune are in the same VPC group. I am able to access the EC2 instance by using ssh username# and can access the Gremlin server there and execute queries but how can I make a tunnel out of it so that I can use it from the local environment? Let me know if you need more detail.
It's not 100% clear if you are connecting directly to EC2 or whether there is a NLB or an ALB in between. If you are connecting from a local machine via SSH directly to EC2 to build a tunnel to Neptune, a command such as this will work.
ssh -i mycreds.pem ec2-user#ec2-xx-xx-xx-xx.compute-1.amazonaws.com -N -L 8182:my-neptune-cluster.us-east-1.neptune.amazonaws.com:818
In order to get the SSL credentials to resolve you will likely need to add a line to your hosts file along the lines of:
127.0.0.1 localhost my-neptune-cluster.us-east-1.neptune.amazonaws.com

Can only connect one time to AWS EC2 instance

I launched a new AWS EC2 Ubuntu Server t2.micro instance via the AWS console. I was able to successfully connect to the instance a single time using ssh on macOS Sierra 10.12.3:
$ ssh -i ./ubuntu-server-2-17-2017.pem ubuntu#ec2-55-555-555-555.compute-1.amazonaws.com
However, when I try to connect a second time, I get a time out error:
$ ssh -i ./ubuntu-server-2-17-2017.pem ubuntu#ec2-55-555-555-555.compute-1.amazonaws.com
ssh: connect to host ec2-55-555-555-555.compute-1.amazonaws.com port 22: Operation timed out
How can I resolve this issue?
The first thing to check is that the IP address associated with the instance is still the same.
The other thing to look at, then, is the security group to see if your IP address (which maybe changed) is still allowed.

I use telnet to connect one specific domain name on port 80. it works on personal Ubuntu but not work on Amazon EC2 instance. DNS issue?

I have a Amazon EC2 instance running Ubuntu and a local personal Ubuntu computer. I use the default VPC configuration for my EC2 instance and didn't block any internet traffic from the firewall.
I can telnet Google.com 80 and Ping Google.com on my EC2 instance which means I have internet connection to the outside. I try to run
telnet nebraskalegislature.gov 80
on both machine. It succeed on my own Ubuntu
Trying 164.119.9.166...
Connected to nebraskalegislature.gov.
but it time out on my EC2 Instance
Trying 164.119.9.166...
telnet: Unable to connect to remote host: Connection timed out
I try to run dig 164.119.9.166 on both machine.
It has one answer from my own machine but there is no answer on EC2 instance.It looks like a DNS issue
Does anybody can help me this question? Please don't block me again. I am trying to ask a good question.
After I test their website connection on all Amazon EC2 subnets, I think it is their internal bugs. I test two websites which are http://legislature.vermont.gov/ and http://nebraskalegislature.gov/. The result is as following:
For http://legislature.vermont.gov/
us-east-1b (fail)
us-east-1c (pass)
us-east-1d (pass)
us-east-1e (fail)
For http://nebraskalegislature.gov/
us-east-1b (fail)
us-east-1c (pass)
us-east-1d (fail)
us-east-1e (pass)
For other region like Oregon and California. There are also some issue on their subnet which is not clearHuman beings create machine and also create bugs because of human nature

SSH freeze when connecting to AWS

Connecting to Ubuntu 14.04 server at AWS gx2.2 instance(Huge GPU one), from an Ubuntu 14.04 system with the following command:
ssh -i ~/.ssh/key.pem ubuntu#12.121.12.321
Normally it would just connect, but now it times out with this error:
ssh: connect to host 54.171.53.164 port 22: Connection timed out
I can Ctrl+C out of the freeze though.
I have tried to restart.
I have tried to sudo apt-get update.
Recheck your AWS parameters...
1) Check Public Ip associated with the Amazon ec2 instance, check whether it is the same as ip address 12.121.12.321 you are using to make connection.
2) Check the inbound rule of the security group associated with the Amazon ec2 instance. Ensure that the inbound rule has ssh access to the ip address of the machine from which you are trying to connect the Amazon ec2 instance.
3) Ensure that the pem file you file you are using is appropriate.
Hope it helps...

Resources