SSH Key issues on EC2 - amazon-web-services

I am moving from Google Cloud to AWS EC2. Issue I am experiencing is that I am unable to modify SSH keys in any shape or form.
This hinders testing a lot, since any bad key will cause me to redo the key assignation to the instance, etc etc.
I created the keypair directly from AWS (.pem), cannot connect through SSH (Catalina) Permission denied (publickey).
Same when I import the to AWS from my computer. AWS accepts them ok, but then SSH refuses to work.
When I was setting up Google Cloud, I had to match the comment of the public key to the username of the account. Is there anything else like that in EC2?

I would check out connect via Systems Manager service(SSM) and you can connect to your instance via the browser Connect to Linux Instance via SSM

Related

How can i remove from my server .pem security check (AWS AMAZON)

I got problem. I did opened server from the AWS EC2 AMAZON. Its gived me .pem file. With putty key generator i did changed it to .ppk file. I want to connect my server without .ppk or .pem or any like that file. How can i remove this security check point? Thanks.
Best Regards.
You need to authenticate using the private ssh key when you connect to an EC2 instance. If you don't want to do that, then there are two choices
Recommended : To use new AWS web console ssh connection to your EC2 instance
This is quite a new feature introduced by AWS to ssh into you EC2 instance from the web browser. In your EC2 view, select the instance and click on the Connect button
Not recommended Using password based authentication for a new user.
I wouldn't be providing details on this one as it is not secured to use password based authentication and your should ideally be using the ssh keys based auth.

Amazon AWS EC2 Ubuntu Instance - how to SSH?

New to Amazon AWS here. I setup a new ubuntu instance but cannot SSH to the instance. How do I find the login/password for SSH? I don't remember one being shared with me when I created that instance.
I added my IP to inbound traffic for the security group
I setup a key and am using the key with my Putty connection
I am able to get to the login step, but when I enter 'root' as the login (or any value), I get:
Server refused our key
Disconnected: No supported authentication methods available (server send: publickey)
when you deploy an EC2 instance in AWS, you'll be asked to select existing key-pair or create new one. if you choose to create new one, AWS will give you the keypair.
after new key-pair is downloaded, you need to change the key permission.
If you deploy an Ubuntu instance, the user usually ubuntu.
ssh -i key.pem ubuntu#yourinstanceIP
or you can select the instance, and you can click on Connect button.

How to connect Mac terminal with EC2 instance

I am using mac terminal and I want to connect my machine with server instance EC2 in aws with SSH. Since I am using Mac OS X is not necessary to use PUTTY. The problem is that when I download the key it is with extension .ppk but when i need to run it on terminal i need to use a command in which i have to use .pem extension . I tried to run it in that way and it said to me permission denied. Can someone help me what to do in this case? Do i have to change the permission or to convert my key from .ppk to .ppm?
You need to know the .pem file folder you download, and then follow steps below:
download the keypair(.pem file)
cd to keypair(.pem file) location (Note that you can use absolute path name for key pair instead)
chmod 400 [your_key_name].pem (Note that to make SSH work, your key must not be publicly viewable. Use this command if needed.)
ssh -i "[your_key_name].pem" ec2-user#[your ec2 dns name]
You will have to convert your "ppk" file to "pem" file follow this steps.
http://www.ramsmusings.com/2014/02/20/converting-a-putty-ppk-file-to-a-pem-file-for-accessing-aws-ec2-instances/
After you convert connect to the instance using the SSH command and converted "pem" file.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
Quick answer
Instead of working directly with SSH keys I would consider working with AWS ec2-instance-connect.
It saves you the the management of the SSH keys and is much safer then sharing SSH keys for each EC2 machine between team members.
After authentication with the aws credentials (by referring to a profile in .aws/config file or using environment variables ) you can connect to the instance very easily by providing the instance ID:
./bin/mssh <instance-ID>
Installation of this tool can be done via pip or directly from the github repo.
Additional information
Amazon EC2 Instance Connect provides a simple and secure way to connect to your instances using Secure Shell (SSH).
With EC2 Instance Connect, you use AWS Identity and Access Management (IAM) policies and principles to control SSH access to your instances, removing the need to share and manage SSH keys.
When you connect to an instance using EC2 Instance Connect, the Instance Connect API pushes a one-time-use SSH public key to the instance metadata where it remains for 60 seconds. An IAM policy attached to your IAM user authorizes your IAM user to push the public key to the instance metadata.
The SSH daemon uses AuthorizedKeysCommand and AuthorizedKeysCommandUser, which are configured when Instance Connect is installed, to look up the public key from the instance metadata for authentication, and connects you to the instance.
You can use Instance Connect to connect to your Linux instances using a
browser-based client,
the Amazon EC2 Instance Connect CLI,
or the SSH client of your choice.
(*) Amazon Linux 2 2.0.20190618 or later and Ubuntu 20.04 or later comes preconfigured with EC2 Instance Connect.
For other supported Linux distributions, you must set up Instance Connect for every instance that will support using Instance Connect. This is a one-time requirement for each instance.
Links:
Connect using EC2 Instance Connect
Securing your bastion hosts with Amazon EC2 Instance Connect

Transitioning from Amazon AWS to a different Hosting provider

This task fell on my lap and I have no experience with Amazon aws. We run a simple informational site along with redmine (as a subdomain) using amazon aws and want to switch to simple helix. I have researched how to switch providers and I haven't found any posts that show how to do this step by step. Is there a simple way to move from Amazon aws to another provider? I think it would be best to create a duplicate of what we have on amazon aws on the simple helix server before totally dropping amazon aws. As far as I know I only have log in details to EC2 Console, no ssh log in details or FTP for amazon aws.
When an AWS instance is launched a public/private key pair is specified and installed in the running instance. You can find the name of the key-pair by looking at details of the instance in the console. Check for "Key pair name".
Hopefully, you'll have the private key of that pair somewhere at hand. If it's lost I'm not sure how to recover it without tech support from Amazon.
If you have the private key then ssh is simple, just type:
ssh -i my.private.key -l ubuntu servername
or something similar and you're in.
FTP access might require opening up a port in the firewall. Look at the security group settings for the server to see what ports are open. Secure ftp is available if you can ssh into the machine using the same private key.

Cant connect to AWS

I have information for some AWS. When I log in I go to AWS management control and then I open EC2. I am just trying to make simple ssh or ftp to the server, so I can change some things on some website which is hosted there.
I added private key that I made in AWS and try to ssh to AWS but it is looking for some publik key. Where can I found that>
Thanks everyone for your help.
Once you created the machine there is no need to access AWS Console to ssh into the instance.
1) Make sure you have the pem file used to create the instance
2) Open a terminal window
3) SSH into your instance. ssh -i you_pem_file.pem root#ip_address_of_your_ec2
If you lost the pem file, well, you're kind of lost :) In this case, you can go to the EC2 AWS Console, create an AMI from the instance you have lost your PEM file, create a new keypair, and launch a new instance from the AMI with the just created keypair.