SkillSprout
Chapter 9 · Lesson 1
Intermediate
5 min read

TLS Certificates, ACM, Private CA and SSH Keys

Overview

Encryption in transit protects data moving between clients and services using TLS. TLS relies on certificates that prove a server's identity. AWS Certificate Manager (ACM) issues and renews public certificates for integrated services, and AWS Private Certificate Authority (Private CA) lets you run your own internal CA for private hostnames, devices and mutual TLS.

A certificate is a passport. The CA is the passport office; browsers trust passports from well-known offices. ACM is a free public passport office that also renews your passport automatically, while Private CA is your company's ID badge office whose badges only your own systems accept.

Developers also create SSH key pairs for EC2 access, and should know when to avoid them in favour of Systems Manager Session Manager or EC2 Instance Connect.

Key Concepts

  • ACM public certificates are free, validated by DNS (preferred) or email, and renew automatically while attached to integrated services.
  • ACM integrates with ELB, CloudFront, API Gateway, App Runner, Elastic Beanstalk and CloudFormation; you cannot export public ACM private keys to install on EC2.
  • CloudFront and edge-optimised API Gateway need certificates in us-east-1; other services use certificates in their own Region.
  • AWS Private CA issues private certificates for internal services, containers, IoT and VPN, with rotation and revocation (CRL/OCSP).
  • Imported certificates from other CAs are not renewed by ACM; you must reimport before expiry and monitor with EventBridge or CloudWatch DaysToExpiry.
  • Mutual TLS (mTLS) authenticates both sides; API Gateway custom domains support it with a truststore in S3.
  • EC2 key pairs (RSA or ED25519) authenticate SSH; AWS stores only the public key. Lose the private key and you cannot recover it.
  • Use Session Manager or EC2 Instance Connect to avoid long-lived SSH keys and open port 22.

Detailed Notes

Where certificates terminate

LayerCertificate sourceNotes
CloudFrontACM in us-east-1Also set minimum TLS version in the security policy
ALB / NLB (TLS listener)ACM or importedMultiple certificates with SNI
API Gateway custom domainACMRegional or edge-optimised
EC2 web server directlyLet's Encrypt, private CA or importedACM public keys cannot be exported
Internal servicesAWS Private CAExportable via IssueCertificate

Requesting an ACM certificate

bash
aws acm request-certificate --domain-name api.example.com \
  --subject-alternative-names "*.example.com" --validation-method DNS
aws acm describe-certificate --certificate-arn arn:aws:acm:eu-west-1:111122223333:certificate/abc \
  --query "Certificate.DomainValidationOptions[0].ResourceRecord"

Create the returned CNAME in Route 53 (CloudFormation can do this automatically when the hosted zone is in the account). As long as that record stays, ACM renews the certificate about 60 days before expiry.

yaml
Cert:
  Type: AWS::CertificateManager::Certificate
  Properties:
    DomainName: api.example.com
    ValidationMethod: DNS
    DomainValidationOptions:
      - DomainName: api.example.com
        HostedZoneId: !Ref HostedZoneId

Generating your own certificate request and keys

Sometimes you must create the key yourself, for example to get a certificate from an external CA or Private CA.

bash
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr -subj "/CN=internal.example.local"
aws acm-pca issue-certificate --certificate-authority-arn arn:aws:acm-pca:eu-west-1:111122223333:certificate-authority/xyz \
  --csr fileb://server.csr --signing-algorithm SHA256WITHRSA \
  --validity Value=90,Type=DAYS

Keep the private key out of version control and store it in Secrets Manager or an HSM-backed service. Import an externally issued certificate with aws acm import-certificate --certificate fileb://cert.pem --private-key fileb://key.pem --certificate-chain fileb://chain.pem.

Monitoring expiry

ACM publishes a DaysToExpiry metric and ACM Certificate Approaching Expiration events to EventBridge (starting 45 days before). Create an alarm or rule that notifies the owning team. Failed DNS validation is the usual reason an auto-renewal does not happen.

EC2 key pairs and alternatives

bash
aws ec2 create-key-pair --key-name dev-key --key-type ed25519 \
  --query KeyMaterial --output text > dev-key.pem
chmod 400 dev-key.pem
ssh -i dev-key.pem ec2-user@203.0.113.10

The private key is shown only once. Better options: Session Manager (no inbound ports, IAM-controlled, logged in CloudTrail and S3) and EC2 Instance Connect (pushes a temporary public key for 60 seconds). Restrict port 22 in security groups to known CIDRs when SSH is unavoidable.

In-transit rules of thumb

Require HTTPS with an S3 bucket policy condition aws:SecureTransport, use TLS 1.2+ security policies on load balancers and API Gateway, enable HTTPS-only on CloudFront viewer protocol policy, and use TLS for database connections (RDS CA bundle, require_secure_transport).

json
{"Effect":"Deny","Principal":"*","Action":"s3:*",
 "Resource":["arn:aws:s3:::my-bucket","arn:aws:s3:::my-bucket/*"],
 "Condition":{"Bool":{"aws:SecureTransport":"false"}}}

Real World Example

A fintech had an outage when a manually imported certificate for its ALB expired over a weekend. They replaced it with an ACM public certificate validated through DNS, which renews automatically, and created an EventBridge rule for approaching-expiry events on the few imported certificates that remain. Internal gRPC services now use Private CA certificates for mTLS, and engineers connect to instances through Session Manager instead of shared SSH keys.

Architecture Diagram

Certificate flow
Architecture
TLS
BrowserHTTPS
CloudFront / ALBACM cert
Internal servicePrivate CA cert
ACM / Private CA

ACM certificates terminate TLS at managed edges; Private CA secures internal calls.

  1. 1The browser connects over TLS to the edge, which presents an ACM certificate.
  2. 2ACM validates domain ownership by DNS and renews automatically.
  3. 3Internal services authenticate each other with Private CA certificates.
  4. 4Expiry events notify owners of imported certificates.

Best Practices

  • ✓Use ACM with DNS validation so renewal is automatic.
  • ✓Monitor DaysToExpiry and expiry events for imported certificates.
  • ✓Enforce TLS 1.2 or higher and HTTPS-only policies on every endpoint.
  • ✓Prefer Session Manager or Instance Connect to long-lived SSH keys.
  • ✓Keep private keys in Secrets Manager or HSM-backed storage, never in source control.

Common Interview Questions

Exam Tips

DVA-C02 focus

  • CloudFront certificates must be requested in us-east-1.
  • Automatic renewal applies to ACM-issued certificates, not imported ones.
  • Private internal hostnames or mTLS with your own CA point to AWS Private CA.
  • S3 HTTPS enforcement uses the aws:SecureTransport condition.

Finished this lesson?

0 of 46 lessons done · 0% of the course