Can we directly import ppk key as EC2 public key or it needs to be converted to PEM format and then imported as public key
Based on the official documentation it is not supported, you have to convert it first.
From the docs ( https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html ):
The following formats are supported:
- OpenSSH public key format (the format in ~/.ssh/authorized_keys). If you connect using SSH while using the EC2 Instance Connect API, the SSH2 format is also supported.
– Base64 encoded DER format
SSH public key file format as specified in RFC4716
SSH private key file format must be PEM (for example, use ssh-keygen -m PEM to convert the OpenSSH key into the PEM format)