Lesson 2 of 3 Data Protection and Encryption

Using AWS CloudHSM and AWS Certificate Manager

Some requirements go beyond KMS: dedicated, single-tenant hardware for keys, or full control over cryptographic operations. And every TLS connection needs a certificate that must be issued, deployed and renewed. This lesson explains AWS CloudHSM and when to choose it over KMS, and AWS Certificate Manager and AWS Private CA for public and private certificates, including validation, automatic renewal and expiry monitoring.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe AWS CloudHSM clusters, the shared responsibility for keys and users, and typical use cases.
  • Compare AWS KMS and AWS CloudHSM.
  • Explain how ACM issues, validates, deploys and renews public certificates, and the limitations of imported certificates.
  • Describe AWS Private CA and how certificate expiry is monitored.
  • Explain how certificates are defined in CloudFormation and why issuance or renewal can fail.

AWS CloudHSM

AWS CloudHSM provides dedicated hardware security modules (HSMs), validated at FIPS 140-3 Level 3, in the customer's VPC. HSMs are grouped in a cluster across Availability Zones, which synchronises keys between them; for high availability, a cluster should have at least two HSMs in different AZs. AWS manages the hardware, but the customer manages the HSM users, keys and cryptographic operations, and AWS has no access to the keys. Applications use industry-standard interfaces: PKCS#11, Java JCE, Microsoft CNG and OpenSSL.

Use cases include SSL/TLS offload for web servers, Oracle Transparent Data Encryption, a private certificate authority's signing keys, document signing, and backing a KMS custom key store so that AWS services encrypt with keys held in single-tenant HSMs. Because the customer owns the keys and users, losing the credentials of the HSM crypto officers means losing the keys; CloudHSM backups are taken automatically and can be copied to other Regions.

AWS KMS
TenancyMulti-tenant HSMs managed by AWS
Key controlPolicies; AWS operates the service
IntegrationNative with most AWS services
AvailabilityManaged, Regional
Typical requirementEncryption with access control and auditing
Choose when Most encryption needs on AWS.
AWS CloudHSM
TenancySingle-tenant HSMs in your VPC
Key controlYou manage users and keys; AWS has no access
IntegrationStandard APIs; AWS services through a KMS custom key store
AvailabilityYou size the cluster across AZs
Typical requirementSingle-tenant HSM, full control, specific APIs
Choose when Regulations requiring dedicated HSMs or direct cryptographic control.
Sort into groups

KMS or CloudHSM?

Exam skills 6.2.4

Choose between AWS KMS and AWS CloudHSM for each requirement.

Log in to try this activity Interactive activities are free with an account.

AWS Certificate Manager

AWS Certificate Manager (ACM) provisions and manages TLS certificates. Public certificates issued by ACM are free for use with integrated services, including Elastic Load Balancing, CloudFront and API Gateway, where ACM deploys them without the private key ever being exposed. ACM certificates are Regional; certificates for CloudFront must be requested in us-east-1, and edge-optimised API Gateway custom domains also use us-east-1.

Before issuing a public certificate, ACM requires domain validation. DNS validation adds a CNAME record to the domain, which ACM checks; if the record remains, ACM renews the certificate automatically before expiry as long as it is in use. Email validation sends approval emails to domain contacts, and renewal requires another approval, so DNS validation is preferred for automation; with Route 53, ACM can create the record itself. Public certificates can also be exported for use on other servers, at a charge.

Imported certificates, from a third-party authority, can be used with integrated services but are not renewed by ACM; the customer must obtain and reimport a new certificate before expiry.

AWS Private CA and Expiry Monitoring

AWS Private CA creates private certificate authority hierarchies for internal TLS, mutual TLS between services, IAM Roles Anywhere trust anchors and device certificates. Private certificates can be issued through ACM, which then manages their renewal for integrated services, or directly for other uses. Short-lived certificate mode reduces cost for certificates valid for days.

Certificate expiry causes outages. ACM publishes the DaysToExpiry metric per certificate in CloudWatch and sends ACM Certificate Approaching Expiration events to EventBridge, by default 45 days before expiry, and AWS Health notifies about renewal problems. The AWS Config rule acm-certificate-expiration-check reports certificates expiring within a configured number of days. Together these allow automated alerts or reimport workflows for imported certificates.

CertificateRenewalMonitoring
ACM public, DNS validated, in useAutomaticDaysToExpiry; renewal events
ACM public, email validatedRequires email approvalExpiry events and Health notifications
ImportedManual reimportExpiry events, DaysToExpiry, Config rule
Private (ACM with Private CA)Automatic for managed certificatesDaysToExpiry; events
True or false

Certificates without outages

Exam skills 6.2.4 · 6.2.2

Check four facts about ACM certificates and expiry.

Log in to try this activity Interactive activities are free with an account.

Certificates as Code and Troubleshooting Issuance

Certificates are part of the infrastructure and belong in the same templates as the resources that use them. In CloudFormation, an AWS::CertificateManager::Certificate with DNS validation and a HostedZoneId in its domain validation options makes CloudFormation create the validation record in Route 53 itself. The stack waits until the certificate is issued, so a listener or distribution in the same stack can reference it safely.

ApiCertificate:
  Type: AWS::CertificateManager::Certificate
  Properties:
    DomainName: api.example.com
    SubjectAlternativeNames: [www.api.example.com]
    ValidationMethod: DNS
    DomainValidationOptions:
      - DomainName: api.example.com
        HostedZoneId: Z0123456789ABCDEFGHIJ

When the DNS zone is hosted outside Route 53, the stack waits in CREATE_IN_PROGRESS until someone adds the CNAME record, and it fails after a timeout if nobody does, a frequent cause of slow or failed first deployments. The following table lists the usual reasons why a certificate stays in PENDING_VALIDATION or fails to renew.

SymptomCauseRemedy
Certificate stays in PENDING_VALIDATIONThe validation CNAME is missing or was added to the wrong zoneAdd the exact CNAME from the certificate details to the authoritative zone
Request fails with a CAA errorA DNS CAA record does not authorise Amazon to issue for the domainAdd a CAA record allowing amazon.com (or the related Amazon CA domains)
Renewal status PENDING_AUTO_RENEWAL does not completeThe validation CNAME was deleted after issueRestore the CNAME; ACM retries validation
Certificate not renewedThe certificate is not associated with any AWS resource, so it is ineligible for managed renewalAssociate it with a resource or request a new one when needed
Certificate not visible to a serviceThe certificate is in a different Region from the resourceRequest it in the resource's Region, or in us-east-1 for CloudFront
Worked example

Eliminating Certificate Outages

A company suffered two outages from expired certificates: one imported certificate on an ALB and one ACM certificate that failed to renew because the validation email was not approved. It also needs mutual TLS between internal services.

  1. Replace imported certificates

    Request ACM public certificates with DNS validation in Route 53 for the ALB domains, so renewal is automatic.

  2. Fix validation

    Revalidate the email-validated certificates with DNS validation.

  3. Monitor

    Create an EventBridge rule on ACM expiry events and a Config rule with a 30-day threshold, both notifying the platform team.

  4. Internal TLS

    Create a private CA in AWS Private CA and issue private certificates through ACM for internal load balancers and service mutual TLS.

Check yourself

A CloudFront distribution cannot use a certificate that was requested in ACM in eu-west-1. Why?

Show answer

CloudFront uses certificates from ACM in us-east-1 only. The certificate must be requested or imported in us-east-1.

Exam Tips

Remember for the exam

  • CloudHSM gives single-tenant FIPS 140-3 Level 3 HSMs in your VPC; you manage keys and users; use two or more HSMs across AZs; it can back a KMS custom key store.
  • Choose KMS for most encryption with AWS integration; choose CloudHSM for dedicated HSM or direct control requirements.
  • ACM public certificates with DNS validation renew automatically while in use; imported certificates do not renew.
  • CloudFront certificates must be in us-east-1; ACM certificates are Regional.
  • Monitor expiry with DaysToExpiry, ACM EventBridge events and the acm-certificate-expiration-check Config rule.
  • With DNS validation and a HostedZoneId, CloudFormation creates the validation record; missing CNAMEs and CAA records block issuance and renewal.