SSH Key Pairs are required by most Cloud Infrastructure (Infrastructure as a Service) providers for use in authenticating the root or admin level users for various UNIX or Linux compute instances and compute shapes as well as for other IaaS provider management systems (i.e. Amazon Web Services – AWS LightSail, Oracle Cloud Infrastructure – OCI console access, etc…) The procedures below will walk you through creating your own SSH Key Pair using a Mac OS X operating system.
Launch the terminal.app
Backup any existing SSH Key Pairs you might want to save or ensure the target directory/folder is unique from the default location on the Mac ( /home/.ssh)
Run the ssh-keygen command at your shell and answer the prompts. It will run interactively by default (prompting you for the appropriate information as needed). The name of the Key Pair we are using for this tutorial is RSA-KEY and will be located under the directory /tmp/oci-stuff/.ssh
ssh-keygen /tmp/oci-stuff/.ssh/RSA-KEY *** ***
Optionally you can enter all of the details in a single command line. There are several parameters required at a minimum. -t <key type>, -N <passphrase>, -b <number of bits in key>, -C <key name>, and -f <filename>
ssh-keygen -t rsa -N “yourPassphraseGoesHere” -b 2048 -C “RSA-KEY” -f /tmp/oci-stuff/.ssh/RSA-KEY
Once the SSH Key Pair has been created, do a quick sanity check of it’s contents:
This completes the process to generate an SSH Key Pair on the Mac OS X for use with various Cloud Infrastructure providers such as Oracle Cloud Infrastructure, Amazon Web Services, Google Cloud, etc..
It’s important to keep this SSH Key pair safe including noting the path it’s stored in and also if you opted to include a passphrase, that should also be recorded safely. The passphrase cannot be recovered if lost!
I hope you found this post helpful. As always any and all feedback is greatly appreciated and if you have further topics to suggest or any questions, please contact us and we’ll be happy to assist!