ERROR REFERENCE
API Gateway needs endpoint access mode
Endpoint access mode is required for the specified security policy
means API Gateway rejected an enhanced SecurityPolicy_*
without an explicit endpoint access mode. This is a template or
transformed-resource mismatch, not an IAM denial.
WHAT IT MEANS
The TLS policy and endpoint mode must be declared together
Resource handler returned message: "Endpoint access mode is required for the specified security policy (Service: ApiGateway, Status Code: 400)"
API Gateway treats policies beginning with SecurityPolicy_
as enhanced security policies. A REST API or custom domain using one
must also declare EndpointAccessMode, either directly on
the resource or through the supported OpenAPI extension.
NEXT CHECK
Set the access mode on the resource that owns the policy
-
Find the policy. Check the SAM or CloudFormation
resource and confirm whether
SecurityPolicystarts withSecurityPolicy_; also check a custom-domain resource if the policy is attached there. -
Declare the mode:
Use the equivalent property onEndpointAccessMode: BASIC # or STRICT, chosen for the intended traffic model SecurityPolicy: SecurityPolicy_TLS13_1_2_2021_06AWS::Serverless::Api,AWS::ApiGateway::RestApi, or the relevant domain resource. -
Verify the transformed definition. Run
sam buildand inspect the generated CloudFormation or OpenAPI; if the API is OpenAPI-defined, preservex-amazon-apigateway-endpoint-access-mode. Do not change IAM for this validation error.
AUTOMATE THE TRIAGE
Keep the handoff in your normal workflow
SAM Doctor recognizes this API Gateway validation marker with high confidence and points at the resource property that needs inspection. It runs locally; no AWS access, no log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- API Gateway deployment started before the API had any methods — inspect method and deployment ordering.
- A resource did not stabilize — follow the nested handler message when the wrapper is a wait timeout.
- API Gateway security policies — official endpoint access mode and enhanced-policy requirements.