Get rid of .pem file to SSH on your AWS EC2 instance
Let’s say you want to setup a Gitlab server on AWS and you need to do a
git clone using
SSH protocol. You will be annoyed by the
.pem file. To get rid of it (or more simply hide it) you can follow this procedure:
The pem file contains a private key. Simply extract it and add it to your system.
Copy the private key to the .ssh folder:
cp /path/to/your/cert.pem ~/.ssh/id_rsa_gitlab_ec2
Generate a public key from the .pem file:
ssh-keygen -y -f /path/to/your/cert.pem > ~/.ssh/id_rsa_gitlab_ec2.pub
Add the private key to ssh-agent:
# Start ssh-agent
Now try to connect to you EC2 instance via SSH:
git clone .... All good !