{"id":747,"date":"2024-02-26T04:58:58","date_gmt":"2024-02-26T04:58:58","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=747"},"modified":"2024-02-26T04:58:58","modified_gmt":"2024-02-26T04:58:58","slug":"setup-ssl-tls-aws-certificate-manager","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=747","title":{"rendered":"Setup SSL\/TLS With AWS Certificate Manager"},"content":{"rendered":"<p>In this blog, we will look at the components of the AWS certificate manager and how this helps to minimize the creation and management of SSL\/TLS certificates.<\/p>\n<p>First, let&#8217;s start with a brief introduction to AWS Certificate Manager.<\/p>\n<p>To demonstrate AWS certificate manager SSL setup we will do the following.<\/p>\n<ol>\n<li>Create Certificated on ACM<\/li>\n<li>Validate Domain ownership<\/li>\n<li>Setup a apache webserver<\/li>\n<li>Deploy a Loadbalancer with the ACM certificate and attach the webserver to the loadblancer.<\/li>\n<li>Map Domain name with Application Load Balancer CNAME<\/li>\n<li>Validate Domain TLS.<\/li>\n<\/ol>\n<h2 id=\"prerequisites\">Prerequisites<\/h2>\n<p>To follow this blog you should have the following.<\/p>\n<ol>\n<li>A valid AWS account with admin permissions<\/li>\n<li>A valid domain name hosted on AWS Route53 or other domain name providers.<\/li>\n<\/ol>\n<h2 id=\"what-is-aws-certificate-manager\"><strong>What is AWS Certificate Manager?<\/strong><\/h2>\n<p>AWS Certificate Manager where users can request for public <a href=\"https:\/\/devopscube.com\/create-self-signed-certificates-openssl\/\">SSL\/TLS certificates<\/a> and manage them easily. You can also import third-party certificates to ACM.<\/p>\n<p>These certificates can be used only with <strong>AWS internal resources<\/strong>, such as load balancer, CloudFront, Cognito, Bean Stack, API Gateway, etc. You cannot install the certificates created by ACM on any application or web server.<\/p>\n<p>It is a region-based service so you cannot use the ACM certificates created in a region with resources in other regions except for Cloudfront.<\/p>\n<p>To use the certificate in a different region, you need to import the certificate to that region.<\/p>\n<blockquote><p><strong>Note<\/strong>: Public SSL\/TLS certificates requested through ACM are completely free. However, if you want to use Private CA, you can check the <a href=\"https:\/\/aws.amazon.com\/private-ca\/pricing\/?ref=devopscube.com\" rel=\"noreferrer noopener\">pricing from here.<\/a><\/p><\/blockquote>\n<h2 id=\"setup-ssltls-with-aws-certificate-manager\"><strong>Setup SSL\/TLS with AWS Certificate Manager<\/strong><\/h2>\n<p>Here is a simple example of how to generate an SSL\/TLS certificate and attach it to an Application Load Balancer.<\/p>\n<h3 id=\"step-1-request-acm-public-certificates\">Step 1: Request ACM Public Certificates<\/h3>\n<p>Navigate to the ACM console in the AWS Management Console.<\/p>\n<p>Select the Request option.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-82-13.png\" class=\"kg-image\" alt=\"ACM certificate request\" loading=\"lazy\" width=\"693\" height=\"464\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-82-13.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-82-13.png 693w\"><\/figure>\n<p>Choose Request a Public Certificate and click next.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-83-11.png\" class=\"kg-image\" alt=\"ACM request public certificate\" loading=\"lazy\" width=\"586\" height=\"477\"><\/figure>\n<p>Provide a fully qualified domain name to prove the identity of the website.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-84-13.png\" class=\"kg-image\" alt=\"ACM domain name\" loading=\"lazy\" width=\"587\" height=\"290\"><\/figure>\n<p>Next choose a validation method<\/p>\n<p>DNS and Email-based validation are available. In DNS validation, DNS records will be generated. For this demo, we are choosing DNS validation.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-85-7.png\" class=\"kg-image\" alt=\"ACM domain validaation\" loading=\"lazy\" width=\"576\" height=\"250\"><\/figure>\n<p>Next, choose the appropriate key algorithm<\/p>\n<p>RSA and EDCSA are the two supported encryption algorithms available to generate certificates. I will choose RSA.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-86-8.png\" class=\"kg-image\" alt=\"ACM certificate algorithm\" loading=\"lazy\" width=\"583\" height=\"265\"><\/figure>\n<p>Next, add the required tags and click request.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-87-7.png\" class=\"kg-image\" alt=\"ACM tags\" loading=\"lazy\" width=\"586\" height=\"507\"><\/figure>\n<h3 id=\"step-2-dns-record-validation\">Step 2: DNS record validation<\/h3>\n<p>Once you request for the certification, you will see a successful notification as shown below.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-89-4.png\" class=\"kg-image\" alt=\"ACM successful notification.\" loading=\"lazy\" width=\"642\" height=\"219\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-89-4.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-89-4.png 642w\"><\/figure>\n<p>Click the view certificate option and you will see the pending validation for DNS as shown below.<\/p>\n<p>You need to update the CNAME record to the domain name server for domain validation.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-91-7.png\" class=\"kg-image\" alt=\"ACM pending validation for DNS\" loading=\"lazy\" width=\"1147\" height=\"760\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-91-7.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w1000\/2025\/03\/image-91-7.png 1000w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-91-7.png 1147w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>If your DNS is hosted on Route53 you can directly click the <strong>Create Records in Route53<\/strong> option as shown above.<\/p>\n<blockquote><p><strong>Note: <\/strong>If you are hosting domain name outside AWS, you need to manually add the CNAME record to your DNS settings in the respective DNS provider.<\/p><\/blockquote>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-93-6.png\" class=\"kg-image\" alt=\"Create Records in Route53\" loading=\"lazy\" width=\"1059\" height=\"434\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-93-6.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w1000\/2025\/03\/image-93-6.png 1000w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-93-6.png 1059w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>ACM will generate a CNAME DNS record and update it in Route53 automatically. Once created you will see the success message as shown below.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-95-5.png\" class=\"kg-image\" alt=\"CNAME DNS record update it in Route53 automatically.\" loading=\"lazy\" width=\"827\" height=\"459\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-95-5.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-95-5.png 827w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>You can also verify this from the route53 dashbaord. You should see the ACM CNAME added to the DNS records.<\/p>\n<h2 id=\"step-3-attach-the-certificate-to-the-aws-services\">Step 3: Attach the certificate to the AWS services<\/h2>\n<blockquote><p><strong>Note<\/strong>: Setting up webserver &amp; application load balancer steps are out of scope of this guide. However, you can use the highlevel steps to setup the webserver\/application and application load balancer on your own.<\/p><\/blockquote>\n<p>For this tutorial demo, I have created an <a href=\"https:\/\/devopscube.com\/use-aws-cli-create-ec2-instance\/\">EC2 instance<\/a> that runs an Apache web server with the default web page.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-97-6.png\" class=\"kg-image\" alt=\"EC2 instance that runs an Apache web server\" loading=\"lazy\" width=\"820\" height=\"544\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-97-6.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-97-6.png 820w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>Now we can see the webserver, at present <strong>does not have TLS enabled<\/strong>.<\/p>\n<blockquote><p>To use ACM certificate with the webserver, we have to create a application load blancer and attach to the webserver ec2 instance. Because only with few AWS services you can make use the ACM certificates. You can check the list of supported services <a href=\"https:\/\/docs.aws.amazon.com\/acm\/latest\/userguide\/acm-services.html?ref=devopscube.com\" rel=\"noreferrer noopener\">from here<\/a>.<\/p><\/blockquote>\n<p>When creating the application load balancer, in the settings you will get the <strong>option to add the ACM certificates.<\/strong><\/p>\n<p>Create an application load balancer for this instance. In the ALB settings under secure listener settings, you will get the option to use the certificate from the ACM as shown below.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-98-4.png\" class=\"kg-image\" alt=\"option to use certificate from the ACM in load balancer\" loading=\"lazy\" width=\"704\" height=\"497\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-98-4.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-98-4.png 704w\"><\/figure>\n<h3 id=\"step-4-map-domain-name-to-load-balancer\">Step 4: Map Domain Name to Load Balancer<\/h3>\n<p>The next step is to map the domain name to the Load Balancer CNAME.<\/p>\n<p>If you are using Route53, you can use the alias option to map the load balancer CNAME as shown below.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-99-7.png\" class=\"kg-image\" alt=\"alias option to map the load balancer CNAME\" loading=\"lazy\" width=\"700\" height=\"752\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-99-7.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-99-7.png 700w\"><\/figure>\n<p>If you are using other DNS providers, you have to create a CNAME entry with the load balancer DNS endpoint.<\/p>\n<h3 id=\"step-5-validate-domain-tls\">Step 5: Validate Domain TLS<\/h3>\n<p>Once the DNS is mapped with the load balancer, you should be able to access the webserver over DNS with TLS from ACM as shown below.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-100-6.png\" class=\"kg-image\" alt=\"access the webserver over DNS with TLS from ACM\" loading=\"lazy\" width=\"956\" height=\"656\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-100-6.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-100-6.png 956w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<h2 id=\"about-acm-certificates\">About ACM Certificates<\/h2>\n<p>Following are the important information you should know about ACM Certificates.<\/p>\n<ol>\n<li><strong>AWS Trust Service<\/strong> is a Certificate authority where AWS generates public certificates when we request ACM.<\/li>\n<li>Most browsers, such as Google Chrome, Explorer, Safari, and Firefox trust certificates that are generated by ACM.<\/li>\n<li>ACM helps to add additional names for certificates. For example, if the primary certificate name is <code>devopsproject.dev<\/code>, we can add another name <code>demo.devopsproject.dev<\/code> with this certificate.<\/li>\n<li>ACM follows the X.509 standard to produce the certificates.<\/li>\n<li>ACM supports RSA and EDCSA algorithms to generate certificates. The key sizes for RSA are 1024, 2048, 3072, and 4096. The key sizes for EDCSA are 256, 384, and 521.<\/li>\n<li>ACM Certificates are valid for <strong>13 months (395 days<\/strong>).<\/li>\n<li>ACM <strong>renews certificates<\/strong> automatically if you use DNS validation and CNAME record remains in place.<\/li>\n<li>For manual renewal , ACM will notify us 45 days before the expiration. For renewal, ACM verifies the domain ownership using DNS records and also ensures the certificates are currently in use. For email-validated certificates, a notification will be sent to the email, the owner can renew the certificate by clicking the link.<\/li>\n<\/ol>\n<p>To generate an SSL\/TLS certificate, a pair of keys is required (public and private). The public key is a part of the certificate.<\/p>\n<p>ACM will <strong>generate a key pair<\/strong> if you request to Certificates and it will securely store the private key in the <strong>AWS Key Management System.<\/strong><\/p>\n<p>When we integrate this certificate with AWS services, AWS KMS provides the encrypted private key and a <strong>grant<\/strong> that AWS KMS created to decrypt the private key.<\/p>\n<p>This is how AWS maintains the security between certificates and services. To learn more about the <strong>AWS KMS grant<\/strong>, please visit the <a href=\"https:\/\/docs.aws.amazon.com\/kms\/latest\/developerguide\/grants.html?ref=devopscube.com\">official documentation<\/a>.<\/p>\n<h2 id=\"certificate-transparency-logging\"><strong>Certificate Transparency Logging<\/strong><\/h2>\n<p>When generating a certificate, the Certificate Authority should provide the report to the log server.<\/p>\n<p>This log is publicly available and helps to ensure the integrity of the certificates. If this one-time process wasn&#8217;t done by CA, you may see a security warning when you try to access the website.<\/p>\n<p>Enabling Certificate Transparency has been a mandatory function since 2018.<\/p>\n<p>If you are requesting a certificate to ACM, the <strong>Certificate Transparency function<\/strong> will be enabled by default, also you can not control this through AWS Console.<\/p>\n<p>But if you are using Terraform or other IAC tools to provision SSL\/TLS certificates from ACM, make sure you enable the <strong>Certificate Transparency Logging<\/strong> function.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/efs-data-sync-5.gif\" class=\"kg-image\" alt=\"\" loading=\"lazy\" width=\"800\" height=\"783\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/efs-data-sync-5.gif 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/efs-data-sync-5.gif 800w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<h2 id=\"acm-vs-aws-private-ca\"><strong>ACM Vs. AWS Private CA<\/strong><\/h2>\n<p>Certificates are generated from AWS Certificate Manager by an AWS public Certificate Authority. We can use this to secure our websites to public access.<\/p>\n<p>While the certificates which are generated by AWS Private Certificate Authority are used to secure our private network communication.<\/p>\n<p>Combining these two types of certificates is also possible. we can create an AWS Private CA and generate certificates to secure internal resources.<\/p>\n<p>Also, we can manage the lifecycle of these certificates from ACM. while we can generate public certificates directly from ACM and attach them with public-facing resources to secure communication.<\/p>\n<h2 id=\"conclusion\"><strong>Conclusion<\/strong><\/h2>\n<p>The default quota to generate ACM certificates and import certificates from outside is 2500 and this is not included with Private CA.<\/p>\n<p>You can also check out out <a href=\"https:\/\/devopscube.com\/aws-client-vpn\/\">AWS Client VPN<\/a> blog where we have used ACM to store client and server certificates.<\/p>\n<p>To know more about the quota, please refer to the <a href=\"https:\/\/docs.aws.amazon.com\/acm\/latest\/userguide\/acm-limits.html?ref=devopscube.com\">official documentation.<\/a><\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/setup-ssl-tls-aws-certificate-manager\/\" target=\"_blank\" rel=\"noopener noreferrer\">Setup SSL\/TLS With AWS Certificate Manager \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/setup-ssl-tls-aws-certificate-manager\/<\/p>\n","protected":false},"author":1,"featured_media":748,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-747","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=747"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/747\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/748"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}