Connection ec2 instance operation timeout error using ssh - amazon-ec2

After creating a new instance,I am trying to access my instance like below:
ssh -i private_key.pem root#my_instance_public_domain
but the operation is timing out,I have updated the private key file permission using
chmod 400
and also edited default security group by adding a new in bound rule,selecting SSH and source Ip as 1.12.34.0/32
but getting port 22: Operation timed out .
what I am missing.
Thanks in advance

For testing to get this working you'll probably want to set your rule to 0.0.0.0/0.

Related

Getting error instalingl wget in RHEL EC2 instance

Getting this message when trying to install wget in RHEL EC2 instance. How to resolve this?
Error: Failed to download metadata for repo 'rhui-client-config-server-8': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://rhui3.ap-south-1.aws.ce.redhat.com/pulp/mirror/protected/rhui-client-config/rhel/server/8/x86_64/os [Connection timed out after 30000 milliseconds]
If you set up SSH for the EC2 instance, try and SSH into the machine, and try
curl -I https://www.google.com
and if it times out, you perhaps can't connect to the internet.
You need to check if the relevant Security Group has an outbound rule allowing connections to the internet:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html?icmpid=docs_ec2_console#security-group-rules
There are a few useful hints in https://access.redhat.com/discussions/4656371 as well, if the issue is related to your subscription.

unable to access aws instance through ssh

Whenever I try to access AWS instance by using ssh I the following error:
Connection blocked because server only allows public key authentication. Please contact your network administrator.
Connection to ec2-54-214-97-39.us-west-2.compute.amazonaws.com closed by remote
host.
Connection to ec2-54-214-97-39.us-west-2.compute.amazonaws.com
closed.
I am accessing by ssh enabled command prompt:
chmod 400 virtue.pem
ssh -i "file.pem" ubuntu#ec2-publicIp.us-west-2.compute.amazonaws.com
I am unable to access aws instance vitual machine .
The error is like the one mentioned here:
https://laracasts.com/discuss/channels/servers/ssh-key-no-longer-working
You need confirm that file.pem is the correct key to access to the instances, and use chmod 400 to give permissions to the .pem in your computer. you can view the logs in the AWS console to verify if there is any message about ssh access.
You can launch other instance with other .pem or detach root volume and attach to other instance to validate the config files
This may be a problem caused by (man-in-the-middle attack).
Change your network to a private one and retry!

Error while connecting to AWS EMR cluster from mac

I'm trying to create 3 node AWS EMR cluster. I have also create a key to connect to cluster from macOS with command :
ssh -i ~/Downloads/BigdataKey.pem hadoop#ec2-xx-xx-xx-xx.ap-south-1.compute.amazonaws.com
But its giving error :
192:Downloads nageshsinghchauhan$ ssh -i ~/Downloads/BigdataKey.pem hadoop#ec2-xx-xx-xx-xx.ap-south-1.compute.amazonaws.com
ssh: connect to host ec2-xx-xx-xx-xx.ap-south-1.compute.amazonaws.com port 22: Operation timed out
Any one please help me out, I'm trying this for the first time using macOS.
The solution I found is that:
Go to EC2 security groups and and open "ElasticMapReduce-master".
Under Inbound tab, click edit.
Add rule, and provide Type = All TCP, port range = 0-65535, source = MyIP.
now go to terminal and provide permission as :chmod 400 my-key-pair.pem
Last step, try SSH to your cluster via your key from mac.
It's Done :)

Why am I getting a connectionTimeout error while trying to update my chef node?

I keep getting this error on the Chef tutorial while trying to update my node. Its very strange because I was able to bootstrap in and ssh in using the same credentials. I have also confirmed that my security for inbound ports for 80, 20 and 443 were open. For the life of me I can't understand why it's holding up here. I am using MacOSX and terminal with an AWS virtual.
WARNING: Failed to connect to 172.31.46.107 -- Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
knife ssh 'name:node1-centos' 'sudo chef-client' --ssh-user centos --identity-file /Users/gavindevops/.ssh/GavinChefKeyPair.pem --attribute ipaddress
SSH uses port 22. Was that a typo in the question or in the security group?
Okay so turns out even if you're using key based authentication, scroll down to the user name and password instructions part of the tutorial because it tells you to use "cloud.public_hostname" in place of "ipaddress" if you are using a service like AWS.

permission denied (public key) -aws interface

I'm kind of new to bash programming, but I decided to take an online class in which we create a t1 micro instance through AWS and ssh in and do all of our work there. I had been sshing through an alias I had made just fine for about a month, then I took a short hiatus for about two weeks. When I came back I got the permission denied(public access) message. I have looked at other threads and gone into my .ssh files and compared files and the like. It might have something to do with the fact that I generated new key pairs on the t1 micro instance, but I don't know how to fix it. When I debug with ssh -v key.pem I get:
OpenSSH_5.2p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /Users/myName/.ssh/config
debug1: Reading configuration data /etc/ssh_config
ssh: Could not resolve hostname key.pem: nodename nor servname provided,
or not known
It's clearly an issue with one of the systems not recognizing the key pair, but I can't resolve it. Thanks everyone, all comments welcome.
the problem is your ssh command
what you want to run is
ssh -i key.pem [user]#[servername]

Resources