We can extract ssh public key from pem file using the "ssh-keygen" command itself.
This can be achieved by the following simple steps.
Step1: Go to the location where the .pem file stored.
Step2: Run the below given command.
#ssh-keygen -y -f key.pem > key.pub
Here we need to replace the "key.pem" with the corresponding file name.
The extracted public key will be available in the file "key.pub" within the same folder.