How do I convert my Amazon Elastic Compute Cloud (Amazon EC2) Privacy Enhanced Mail (.pem) file to a PuTTY Private Key (.ppk) file? Or, convert a .ppk file to a .pem file?
- Aws Pem Generate Public Key
- Generate Public Key From Ec2 Pem Software
- Generate Public Key From Ec2 Pem File
- Generate Public Key From Ec2 Pem Server
- Generate Public Key From Ec2 Pem Mac
As far as I know, private key can only be retrieved at the time you create the keypair (via EC2 web management console or via API commandline). So you have to save the private key somewhere and be able to retrieve it at work in order to connect to the instance via SSH, since keypairs' public keys are automatically installed on EC2 servers when you launch them. Example 2: To retrieve an SSH public key attached to an IAM user in PEM encoded form. The following get-ssh-public-key command retrieves the specified SSH public key from the IAM user 'sofia'. The output is in PEM encoding.
Short Description
PuTTY doesn't natively support the private key format (.pem) generated by Amazon EC2. You must convert your private key into a .ppk file before you can connect to your instance using PuTTY. You can use the PuTTYgen tool for this conversion. This tool, available for both Windows and Unix operating system, can convert keys.
Resolution
Windows - install PuTTYgen
Most Windows operating systems have PuTTY installed. If your system doesn't, download and install PuTTYgen.
Windows - convert a .pem file to a .ppk file
Start PuTTYgen, and then convert the .pem file to a .ppk file. For detailed steps, see Convert Your Private Key Using PuTTYgen.
Windows - convert a .ppk file to a .pem file
- Start PuTTYgen. For Actions, choose Load, and then navigate to your .ppk file.
- Choose the .ppk file, and then choose Open.
- (Optional) For Key passphrase, enter a passphrase. For Confirm passphrase, re-enter your passphrase.
Note: Although a passphrase isn't required, you should specify one as a security measure to protect the private key from unauthorized use. Using a passphrase makes automation difficult, because human intervention is needed to log in to an instance or to copy files to an instance. - From the menu at the top of the PuTTY Key Generator, choose Conversions, Export OpenSSH Key.
Note: If you didn't enter a passphrase, you receive a PuTTYgen warning. Choose Yes. - Name the file and add the .pem extension.
- Choose Save.
Unix or Linux - install PuTTY
Install PuTTY, if it's not already on your system.
Important: A PuTTY package is provided by the Extra Packages for Enterprise Linux (EPEL) repository. You must enable the EPEL repository before you install PuTTY.
To install PuTTY, run one of the following commands:
RPM-based
Dpkg-based
Unix or Linux - convert a .pem file to a .ppk file
On the instance shell, run the puttygen command to convert your .pem file to a .ppk file:
Unix or Linux - convert a .ppk file to a .pem file
Run the puttygen command to convert a .ppk file into a .pem file:
Related Information
Anything we could improve?
Need more help?
Related Videos
Daniel shows you how to convert a private key to and from .ppk and .pem formats (3:48)
[ aws . iam ]
Description¶
Retrieves the specified SSH public key, including metadata about the key.
The SSH public key retrieved by this operation is used only for authenticating the associated IAM user to an AWS CodeCommit repository. For more information about using SSH keys to authenticate to an AWS CodeCommit repository, see Set up AWS CodeCommit for SSH Connections in the AWS CodeCommit User Guide .
See also: AWS API Documentation
See 'aws help' for descriptions of global parameters.
Synopsis¶
Options¶
--user-name (string)
The name of the IAM user associated with the SSH public key.
This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
--ssh-public-key-id (string)
The unique identifier for the SSH public key.
This parameter allows (through its regex pattern ) a string of characters that can consist of any upper or lowercased letter or digit.
--encoding (string)
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH . To retrieve the public key in PEM format, use PEM .
Possible values:
- SSH
- PEM
--cli-input-json (string)Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.
Aws Pem Generate Public Key
--generate-cli-skeleton (string)Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.
See 'aws help' for descriptions of global parameters.
Examples¶
Example 1: To retrieve an SSH public key attached to an IAM user in SSH encoded form
The following get-ssh-public-key command retrieves the specified SSH public key from the IAM user sofia. The output is in SSH encoding.
Output:
Example 2: To retrieve an SSH public key attached to an IAM user in PEM encoded form
Generate Public Key From Ec2 Pem Software
The following get-ssh-public-key command retrieves the specified SSH public key from the IAM user 'sofia'. The output is in PEM encoding.
Output:
For more information about SSH keys in IAM, see Use SSH Keys and SSH with CodeCommit in the AWS IAM User Guide.
Output¶
SSHPublicKey -> (structure)
A structure containing details about the SSH public key.
UserName -> (string)
The name of the IAM user associated with the SSH public key.
SSHPublicKeyId -> (string)
Fingerprint -> (string)
The MD5 message digest of the SSH public key.
SSHPublicKeyBody -> (string)
Generate Public Key From Ec2 Pem File
Status -> (string)
Generate Public Key From Ec2 Pem Server
The status of the SSH public key. Active means that the key can be used for authentication with an AWS CodeCommit repository. Inactive means that the key cannot be used.
UploadDate -> (timestamp)
Generate Public Key From Ec2 Pem Mac
The date and time, in ISO 8601 date-time format , when the SSH public key was uploaded.