Ubuntu - Add Key To System

One can easily add a key pair to your own system so that you do not have to keep specifying it with the

-i
switch. For example, I have a dev key for AWS EC2 which I call
dev_default.pem
. Every time I would log into an ec2 instance, I would have to specify
ssh ubuntu@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com -i /absolute/path/to/my/key/dev_default.pem



To add the keypair, simply run this command once:

ssh-add /path/to/key.pem

Now you can just log into your instances like so:

ssh ubuntu@ec2-xxx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com

No comments:

Post a Comment