AWS EC2
SSL Certificate
AWS Certificate Manager
Cloud Security
AWS Tutorial

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

The AWS Certificate Manager (ACM) makes it straightforward to provision, manage, and deploy Secure Sockets Layer/Transport Layer Security (SSL/TLS) certificates on AWS services. This service facilitates the task by automating some of the more complex aspects of manual certificate SSL certificate management. In this article, we'll go through the steps needed to add an SSL certificate to an AWS EC2 instance leveraging the AWS Certificate Manager.

Step 1: Prerequisites

Before delving into the process of adding an SSL certificate using AWS Certificate Manager, ensure you meet the following prerequisites:

  1. AWS Account: You need an active AWS account with the authorization to interact with AWS Certificate Manager and other AWS services.
  2. Domain Name: The domain for which you want to issue the SSL certificate must be registered.
  3. AWS CLI: Having the AWS Command Line Interface installed and configured can be incredibly beneficial for managing services.

Step 2: Request an SSL Certificate

AWS ACM supports both public and private certificates. To request a certificate via AWS ACM, follow these steps:

Requesting a Public Certificate

  1. Navigate to ACM Console:
    • Access the AWS Certificate Manager through the console search bar or via services.
  2. Request Certificate:
    • Select Request a Certificate.
    • Choose Request a public certificate and click "Next".
  3. Add Domain Names:
    • Enter the fully qualified domain name (FQDN), for example, www.example.com. You can add multiple domain names to the certificate if needed.
  4. Validation Method:
    • Choose from either DNS validation or Email validation. DNS validation is typically quicker and more reliable for automatic renewals.
  5. Add Tags:
    • Optionally, add tags for better resource management and tracking.
  6. Review:
    • Review the entries and, if everything looks good, click Confirm and request.

Validation

  • If you chose DNS validation, you'll need to add a CNAME record to your DNS configuration as instructed.
  • If you opted for Email validation, ACM will send an email to the domain owner that has to be confirmed.

Step 3: Install the Certificate on your EC2 Instance

With the certificate issued and validated, it's time to install it on your EC2 instance. Follow these steps:

  1. Load Balancer (recommended):
    • Using an AWS Elastic Load Balancer (ELB) allows the SSL certificate to be more easily managed.
    • Navigate to AWS EC2 Console: Go to EC2 Dashboard and choose Load Balancers.
    • Create/Select a Load Balancer: If you have an existing one, skip this step. Otherwise, create a new load balancer.
    • Configure Listener: Specify HTTPS as a protocol and associate the created SSL certificate from ACM.
  2. Direct Installation to EC2 (if not using ELB):
    • SSH into your EC2 instance.
    • Install necessary packages: Generally, tools like certbot for Let's Encrypt, or install an application like Apache or Nginx if not already installed.
    • Configure your webserver to use the certificate:
      • Locate the certificate and private key files stored by ACM.
      • Assign these in your webserver's configuration file (for example: /etc/httpd/conf.d/ssl.conf for Apache or /etc/nginx/nginx.conf for Nginx).
  3. Verify SSL on the Website:
    • Use well-known tools like SSL Labs' SSL Test or command-line utilities like curl to verify correct SSL setup.
    • Check for valid certificate installation and encryption standards.

Step 4: Automate the Renewal Process

One of the significant advantages of using ACM is automation in certificate renewal. AWS ACM automatically renews certificates that are associated with services like AWS Elastic Load Balancing, Amazon CloudFront, and more.

To ensure seamless renewal, verify that:

  • The DNS validation record remains unchanged.
  • The domain ownership is properly maintained.

Additional Considerations

  • Cost: AWS does not charge you for public SSL certificates managed with AWS ACM.
  • Security: Regularly update and patch your EC2 instance and security groups to bolster security against threats.
  • Cross-Region Certificate Use: ACM certificates are regional. They need to be issued specifically in the region of your service deployment.

Summary Table

StepTaskImportant Points
1PrerequisitesAWS Account required Domain Name ready
2Request CertificateChoose DNS validation for easier management Review details before submission
3Install on EC2Use Load Balancer for easy management Configure SSL on webserver directly if required
4Automate RenewalACM handles automatic renewals Maintain domain ownership for DNS validation

By following these steps and keeping in mind the best practices shared, you can securely manage SSL certificates on AWS with minimal overhead, ensuring a secure connection for your users.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design