Description
API Gateway v2 supports clientCertificateId only on WebSocket API stages. Use it when the HTTPS backend authenticates API Gateway by client certificate. Caller HTTPS and caller authentication have separate settings.
Potential impact
- A backend that requires a certificate may reject connections if it is missing or expired.
- A backend without certificate checks or other authentication may accept direct connections.
Remediation
Set the stage certificate and configure the backend to verify it. Update backend trust and rotate the certificate before expiry. Confirm that the backend rejects unauthenticated connections.
Examples
The excerpts reference a WebSocket API (exampleApi) and an aws:apigateway:ClientCertificate (exampleClientCertificate). Other stage and deployment settings are omitted.
Before
yaml
resources:
example:
type: aws:apigatewayv2:Stage
properties:
apiId: ${exampleApi.id}
After
yaml
resources:
example:
type: aws:apigatewayv2:Stage
properties:
apiId: ${exampleApi.id}
clientCertificateId: ${exampleClientCertificate.id}
clientCertificateId selects the certificate the gateway presents to the backend.