TLS certificate has a short RSA key

Use an RSA key of at least 2048 bits supported by the service.

Description

Check that the TLS certificate’s RSA key is at least 2048 bits (256 bytes). Use the strength requirements for the selected algorithm when evaluating ECDSA or another key type.

Potential impact

A short RSA key weakens server authentication and may fall below your organization’s security requirements.

Remediation

Reissue the certificate with a key size supported by the API Gateway endpoint and its clients. After deployment, connect to the service domain and verify the new certificate’s key size, hostname and expiry.

Examples

The edge-optimized domain excerpts show only certificate_body. The 4096-bit example assumes an externally issued certificate. Verify the PEM and matching private key, and supply the name and chain needed for registration.

Before

hcl
resource "aws_api_gateway_domain_name" "example" {
  certificate_body = file("./rsa1024.pem")
  domain_name      = "api.example.com"
}

After

hcl
resource "aws_api_gateway_domain_name" "example" {
  certificate_body = file("./rsa4096.pem")
  domain_name      = "api.example.com"
}

References