Permission denied (publickey,gssapi-keyex,gssapi-with-mic) on PowerShell - amazon-web-services

I am trying to connect an AWS CentOS instance from an AWS Windows instance using PowerShell of the Windows instance. But I am getting the error "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)"
I am able to connect to the centos instance from my own windows PC using PuttY. I just don't have a Windows 10 in my PC to test with Powershell, So I created a Windows 10 instance in AWS and trying to connect through its Powershell, but in vain. I copied the private key (.pem) file from my own PC, pasted in the desktop of the Windows instance accessed through RDP and put the ssh command, but not able to connect.
Also, the security group of the linux instance has 3 Inbound rules, Allow Any IP from SSH/Port 22, HTTP/Port 80 and Any Traffic, Any IP/All Ports.(IP : 0.0.0.0/00)
Please point where i am going wrong.Thanks.
The ssh command I used :
ssh -i C:\Users\Administrator\Desktop\cent.pem centos#mydomain.compute.amazonaws.com

Related

linux rdp to EC2 windows machine - error "lost connection to the RDP server"

I created a simple EC2 instance (windows 2016), and without security group (all traffic allowed), and got public IP and DNS (created by the VPC).
Then I downloaded the rdp file from the EC2 in order to remote connect to the EC2, and got "lost connection to the RDP server...".
I use my linux (fedora) machine, and use remmina to remote connect.
I'm new with AWS, am I missing something that I need to do before I connect?
P.S. I don't have IAM role, and also I didn't use the .pem file I downloaded - I don't know if it's related.

What is the best way to run a script remotely on Windows VM instance?

For example, in Linux VM instances we can use gcloud beta ssh command to run commands remotely by downloading ssh keys using gcp credentials
Similarly, I am looking for running scripts on Windows VM instance remotely without doing RDP to an instance.
Can someone point to a solution for this problem?
If you have a Windows workstation with PowerShell, you can connect to your Windows Server instances through a remote PowerShell session. This process is similar to connecting to a Linux instance using SSH. Please review "Connecting to Windows instances using the PowerShell terminal"
https://cloud.google.com/compute/docs/instances/connecting-advanced#powershell

Connecting to an AWS instance on windows from CLI

I am trying to execute the following command on cmdline (windows) ssh -i "publicec2instance.pem" #ec2-user<>compute.amazonaws.com
but it errors out saying
Failed to add the hosts to the list of known hosts (/home/<>/.ssh/known_hosts)
I tried to install cygwin to emulate unix cmd line to run the same command but it is not recognizing ssh itself.
Could you please point me in the right direction
SSH is used to connect to Amazon Linux EC2 instances.
To connect to Amazon Windows EC2 instances, use Remote Desktop (RDP).
Here is a document that will walk you this process.
Connecting to Your Windows Instance

Amazon aws ec2 login via putty

I had successfully used putty to login into Debian-8.1 on AWS by using key file. Once I upgraded debian using the command apt-get upgrade and tried to login through putty, it shows the error which i mentioned below:
putty fatal error: network connection refused
How can i resolve this?
I think Kernal Upgrade , Reboots the system in Linux and if you have not allocated Elastic Ip to the instance , the Ip would have have changed.
Did you Check the Instance IP ? Are you able to Login via Web based Interface from EC2- Console ?

How to enable or browse web service running on EC2 on local machine?

I have EC2 instance that has port forwarding enabled for EMR cluster. Ganglia monitoring service is already running on EMR. I am able to browse Ganglia from EC2 instance with following using "text browser" Lynx.
lynx http://localhost:5000/ganglia
However, I want to access this service from my local machine ( Mac Yosemite ). I did some research and found that I need X11 port forwarding. So now I also have X11 port forwarding enabled.
echo $DISPLAY
gives me following on EC2 instance
localhost:14.0
I am also able to run "xclock" and it launches clock on my local machine.
I tried to ssh into EC2 instance with this syntax .
ssh -C -c blowfish -N -L:1050:myEc2Server:5000 myUser#myEc2Server
Then if I type http://127.0.0.1:1050/ganglia in google chrome I get message saying no data received.
Can anyone point out what is going wrong ? I tried verbose log from local machine to Ec2 instance and it has following message -
channel 2: open failed: connect failed: Connection refused
In short, I want to be able to see Ganglia from local machine. Any help is appreciated.
~Cheers
I tested an ssh command line from my own laptop (Mac Yosemite) and the following works
ssh -N -L:1050:localhost:5000 username#public-dns-of-ec2-instance
After this is connected, I verified using:
http://localhost:1050/ganglia.
In your command line above, you may just need to replace myEc2Server with localhost or 127.0.0.1.