AWS > Sam >

Enable Http Api Access Logging

MEDIUM
Source
Trivy
ID
AVD-AWS-0116

SAM HTTP API stages for V1 and V2 should have access logging enabled

API Gateway stages should have access log settings block configured to track all access to a particular stage. This should be applied to both v1 and v2 gateway stages.

Impact

Follow the appropriate remediation steps below to resolve the issue.

Enable logging for API Gateway stages

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Resources:
  GoodExample:
    Type: AWS::Serverless::HttpApi
    Properties:
      AccessLogSettings:
        DestinationArn: gateway-logging
        Format: json
      Name: Good SAM API example
      StageName: Prod
      Tracing: Activey