How to add SSL certificate to AWS EC2?

Steps to Install an SSL Certificate on AWS EC2 Instance

This article will walk you through the process of installing an SSL certificate on your AWS EC2 instance.
The following instructions will show you how to install an SSL certificate on an AWS EC2 instance. You’ve arrived at the correct page. In this section, we will look at some of the conditions that must be met before we can proceed with the real AWS SSL certificate installation process.

Prerequisites: What to Do Before Installing an AWS SSL Certificate on EC2

Conditions: What to Do Before Installing an AWS SSL Certificate on an EC2 instance
Before you can install an SSL certificate on an AWS EC2 instance, you must first ensure that you have the necessary files on your computer. To verify that you have everything you need before moving on to the next step, please go through the checklist below:

SSL Certificate for the server: This is the SSL certificate that was shared with you by the CA, potentially through your registered email address.
The intermediate certificates were most likely delivered to you with your server certificate if you received the certificate in a zip package, which is most likely. If not, you may always download the CA Bundle for your certificate if you don’t have one already.
You should have control over this key, or it should be stored on the server (where you generated the certificate signing request).
As soon as you have obtained these files, you must PEM encrypt them before they can be uploaded to your Amazon Web Services account.

How to Convert Your AWS SSL Certificate to PEM-Encoded Format for EC2

EC2 Conversion Guide: How to Convert Your AWS SSL Certificate to PEM-Encoded Format
The certificates received from the CA with a “.crt” extension can be converted to the PEM format by following the instructions below (if they come with any other encoding formats like DER). This can be accomplished either through the use of an online conversion tool or through the use of the OpenSSL library.

An example of a PEM-encoded certificate is as follows:

—–GET STARTED WITH THE CERTIFICATE—–

The certificate that has been Base64 encoded

—–Finishing the CERTIFICATE—–

Aside from converting certificate files from other forms, such as pkcs#7 and Pfx, the OpenSSL library can also be used to convert certificate files from other formats.

Run the following command to convert the server certificate format to PEM format to accomplish this:

x509 -inform DER -in my certificate. crt -out my certificate.pem -outform PEM openssl x509 -inform DER

To convert the certificate chain to PEM format, use the command listed below:

Upload the Certificate to AWS Using CLI

the command OpenSSL x509 -in my-certificate-chain.crt -out my certificate-chain.pem -outform PEM is equivalent to the command

AWS will accept the certificate if it is uploaded. Using the CLI
For those of you who are familiar with the command-line interface (CLI), you can use the command below to import your certificate files. Make any necessary modifications and then run the command.

To install your SSL certificate on your AWS EC2 instance, enter the following command into your AWS account: Enter the following command into your AWS account to install your SSL certificate on your AWS EC2 instance:

upload-server-certificate –server-certificate-name my server certificate –certificate-body file:/public key cert file.pem –private-key file:/my private key.pem –certificate-chain file:/my certificate chain file.pem –certificate-chain file:/my certificate chain file.pem –certificate

Alternatively, if you choose not to use the command-line interface, you can upload your certificates by following the instructions in the following section.

Installing an SSL Certificate on an AWS EC2 Instance may be accomplished in five steps.

5 Steps to Install SSL Certificate on AWS EC2 Instance

  1. Log in to the AWS Management Console by clicking on the Login button.
  2. pick your load balancer from the navigation pane, go to Services > Compute > EC2 > Load Balancers and then click on it.
  3. On the Listeners tab, click on Edit, then Add, and then pick HTTPS as the protocol for the listener to use.
  4. To change the SSL certificate choice, select the Change button, and then from the Certificate type drop-down menu, select the Upload a new SSL certificate to AWS Identity and Access Management (IAM) option.
  5. Make sure that the certificate files are PEM encoded before pasting the contents of the appropriate certificate files into the certificate name field and clicking on Save.