I have downloaded secret key in .csv format from my AWS IAM security settings. I want to use this secret key to ssh into aws ec2 instance. I tried using ssh -i but got "key too open" error. So googled and found solution to disable inheritance on secret file (windows 10). Now I am having " format not supported" error. So I tried to convert CSV into .ppk/.pem format using MobaXterm but no success. Can anyone tell me how can I ssh in AWS EC2 by using secret key in .csv format, please?
3 Answers
I think what you are saying is that you have created an IAM user, downloaded credentials for that IAM user to a CSV file, and are now trying to SSH into an EC2 instance that you launched.
The credentials you downloaded are IAM credentials (access key and secret key). They are not SSH keys. When you launched the EC2 instance, you had an opportunity to supply a keypair. If you supplied a keypair and you have the corresponding private key (a PEM file), then you can SSH to the instance with that private key, for example:
ssh -i ~/.ssh/ec2.pem hostname
The CSV of IAM credentials has nothing to do with SSH access in this case. You need the private key associated with the EC2 keypair. If you created the keypair using the EC2 console, then the PEM file was downloaded at that time.
The IAM credentials you have can be used to make AWS API calls to manage AWS resources. For example , to launch an EC2 instance, create an IAM role, or to delete a DynamoDB table. You can use them with SDKs and the awscli. These credentials are associated with an IAM user. If you usually log into the AWS Console to manage AWS resources, then you log in with a username and password but these are exchanged by the AWS backend for IAM credentials and those are used by the console when it calls the APIs on your behalf.
What you downloaded is called access key which you will use to access AWS API, SDK and CLI. read more about it aws IAM As far as login is concerned when you create an EC2 instance you are asked in the end to create a key which is of .pem format. Download it and change its permission to 600 or 400. That will resolve key too open error.
chmod 600 <path/where/you downloaded/.pem key>
Jarmod is correct, you need to download the key/pair assigned to your EC2 instance, or go create a new key/pair, attach it to the ec2 instance and then use the .PEM to access by SSH the EC2 instance. In Linux is easy, you just need to use this command to change the permission of the .pem file
chmod 400 filename.pem