Running a Startup on AWS? Get Funding With AWS JumpStart. Click Here to Learn More

2021 Fillmore Street #1128


24/7 solutions

Creating A New AWS EC2 Key for a Third Party Developer

The following is a free step by step guide on how to correctly create a new AWS EC2 Key for a third party developer.

Creating A New AWS EC2 Key For A 3rd Party Developer


An instance launch requires a key pair to be entered. Setting up an SSH connection to the instance requires a key pair to be provided. A new key pair can be generated, or you can use an existing one. Linux instances have an entry in /.ssh/authorized_keys created using the public key you provided at launch. For SSH login to your Linux instance, you must provide the matching private key in addition to the public key.

The public key is stored on your instance by Amazon EC2, and the private key is stored by you. It’s crucial that you keep your private key safe, as anyone in possession of it can connect to your instances. You’ll need to enter a key pair whenever you start a new instance. A key pair can be generated on Amazon EC2. Amazon EC2 also supports importing public keys generated with a third-party tool. Unfortunately, if you lose your private key and can’t recreate it, there’s nothing Amazon EC2 can do to help you. Even if you’ve misplaced the private key, it’s possible to still establish a connection to instances.

How to create: 

Using Amazon Elastic Compute Cloud (EC2) to generate a key pair

  • In order to access Amazon EC2, go to
  • Key Pairs can be found on the sidebar under Network & Security.
  • Pick New key pair to create.
  • Select Name and give the key pair a meaningful name. You can give your public key a custom name in Amazon EC2, and it will be linked to that name. There is a limit of 255 valid ASCII characters for a key’s name. Avoid using any spaces before or after the value.
  • Select either RSA or ED25519 as the Key pair type.
  • Select the private key storage format you prefer. Select pem if you want to save the private key in an OpenSSH-compatible format. Select the ppk format to save the private key in a format compatible with PuTTY.
  • Select Add tag, then provide the tag’s key and value to associate it with the public key. Iterate this process for all labels.
  • Select the New Key Pair option.
  • To access the private key file, your browser will automatically download it. The file’s base name is the name you gave your key pair, and the file’s extension is decided by the file format you used. Make sure to put away the private key file.
  • In order to ensure that only you can access your private key file, run the following command from a Mac or Linux computer running an SSH client before attempting to connect to your Linux instance.
chmod 400 key-pair-name.pem

A connection with this key pair to your instance will be denied if the necessary permissions are not specified. Error: Private key file not secured.

Use a third-party tool to generate a key pair, and then transfer the public key to Amazon EC2.

If you don’t want to use the Amazon EC2 interface, you can generate an RSA or ED25519 key pair elsewhere and then import the public key into Amazon EC2.

Key pair requirements

  • RSA and ED25519 are the types that work. DSA keys are not supported by Amazon EC2.

  • Formats that can be used:

  • Standard OpenSSH public key format (as stored in /.ssh/authorized_keys). The EC2 Instance Connect API supports SSH connections in both the traditional format and the newer, more secure SSH2 format.
  • PEM or PPK is the only acceptable format for an SSH private key.

  • (Only RSA) DER file format, encoded in Base64

  • This is for RSA users only: In accordance with RFC 4716, the format for SSH public keys is as follows:

  • Three lengths (1024, 2048, and 4096) are supported. The EC2 Instance Connect API supports SSH connections with lengths of 2048 and 4096.

How to create 

  • Use whatever third-party tool you like to produce a key pair. Such as, you can use ssh-keygen (a tool provided with the standard OpenSSH installation). You can also generate an RSA or ED25519 key pair using the standard libraries provided by many programming languages, including Java, Ruby, Python, and many more. (Private keys need to be in either the PEM or PPK format). 
  • Make a copy of the public key on your computer. My key pair is stored in /.ssh/ It makes no difference what kind of file extension this has.
  • You can either use the.pem or.ppk file extension to save the private key locally. Use my-key-pair.pem or my-key-pair.ppk as an example. (Put away the private key file somewhere secure. When creating an instance, you’ll be asked for your public key’s name, and each time you connect to the instance, you’ll need to enter the private key that goes along with it).

After you have generated your key pair, you can import your public key into Amazon EC2 in one of the following ways.

Inserting the Public Key into Amazon EC2


To access Amazon EC2, go to the console at
Access the Key Pairs menu item on the left-hand panel.
Pick the option to Import key pair.
A public key’s name should be something that accurately describes it, therefore use this field to do so. Any number of valid ASCII characters may be used in the name. No spaces before or after the expression are allowed.
Select your public key from the file system by using the Browse button, or copy and paste its contents into the Public key contents area.
Choose to import the key pair.
Make that the imported public key is present in the key pair list.

Label a Public Key

Public keys can be imported to Amazon EC2 or generated there, and then labeled with metadata to make them easier to organize and manage.

Tags can be viewed, added, and removed using the following ways.

  • Navigate to the Amazon EC2 control panel at
  • Select Key Pairs from the drop-down menu.
  • First, pick a public key to work with, and then go to Actions > Manage tags.
  • If the public key has any tags associated with it, you may view them on the Manage tags page.
  • Select Add tag, and then provide the key and value for the new tag. For each key, you can assign up to fifty tags. Please refer to the Tag limits page for further details.
  • Select the tag you want to remove and click the Remove button.
  • Click the Save button.
Cody Kelly
Cody Kelly

Cody is an experienced Marketing Specialist with over a decade worth of experience in marketing and client success. He creates and optimizes content, articles and guides to help businesses of all sizes grow. With a background in marketing, hospitality, and finance, Cody has consistently increased profitability for clients with strategic planning while delivering first class service.

Related Articles

How to Setup AWS Control Tower in Your Environment

How to Setup AWS Control Tower in Your Environment

High control and governance is a large focal point of Amazon’s Cloud services. Another solid service for maintaining the wellbeing and compliance of any AWS service is Control Tower, helping to further simplify governance with enough room to integrate third-party software for scaling. Its main function is for the construction and monitoring of new AWS environments regardless of size and complexity.

Get Marketing Help Through AWS’ Marketing Central

Get Marketing Help Through AWS’ Marketing Central

The most important step in marketing is the first step: gathering the data needed. Anything gathered during this phase will dictate everything from what is developed and how it is marketed. Having the right sponsorship and resources can significantly improve this process. Amazon’s Marketing Partner Network, a resource sponsorship program, helps to gather data on target customers and accelerate the process with additional AWS resources, tools, and ML training.

Developing E-Commerce with Amazon Web Services

Developing E-Commerce with Amazon Web Services

Amazon continues to innovate with internet retail and how the customer’s experience is enhanced digitally. AWS continues to lead in fostering innovation and support of enterprises and retailers through the use of microservices, an API-first mentality, and cloud-native infrastructure. This has helped lay the groundwork for more sustainable online storefronts and provided customers with better services.

Download our 10-Step Cloud Migration ChecklistYou'll get direct access to our full-length guide on Google Docs. From here, you will be able to make a copy, download the content, and share it with your team.