Description
Check access logging on the stage serving the REST API. CloudFormation can manage it in the deployment’s StageDescription or a separate AWS::ApiGateway::Stage. If the deployment omits it, check the stage and other records such as backend logs.
Potential impact
Missing request times and IDs make a failure harder to trace to a call. Failed delivery or short retention can leave too little history to investigate.
Remediation
Set the log group ARN in the owning resource’s AccessLogSetting. Include $context.requestId, $context.extendedRequestId, or both in the format. Configure delivery permissions, retention, and read access, then check the record for a test request. Set up execution logs and alerts separately as needed.
Examples
The excerpts require GreetingApi, its methods, and deployment dependencies. Prepare the log group and replace the example ARN.
Before
Resources:
ApiDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId: !Ref GreetingApi
StageName: prod
StageDescription:
CacheClusterEnabled: false
The prod stage’s StageDescription contains only a cache setting.
After
Resources:
ApiDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId: !Ref GreetingApi
StageName: prod
StageDescription:
AccessLogSetting:
DestinationArn: arn:aws:logs:us-east-1:123456789012:log-group:apigw-prod
Format: '{"requestId":"$context.requestId","status":"$context.status","ip":"$context.identity.sourceIp"}'
The deployment configures prod to log the request ID, status, and source IP.