# Ensure API Gateway V2 has Access Logging enabled.

- Source: https://support.icompaas.com/support/solutions/articles/62000233325-ensure-api-gateway-v2-has-access-logging-enabled-
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [AWS Checks New Version](https://support.icompaas.com/support/solutions/62000112673) › [AWS New Checks](https://support.icompaas.com/support/solutions/folders/62000169206)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

### Profile Applicability:

-   Level 1
    

### Description:

API Gateway V2 allows you to manage and monitor HTTP, WebSocket, and other API services. Access logging provides detailed logs of API requests and responses, including headers, query parameters, and response times. Enabling Access Logging is critical for auditing, debugging, and ensuring that the API traffic is being monitored for security, performance, and troubleshooting purposes.

### Rationale:

Enabling Access Logging for API Gateway V2 helps capture essential request and response information for security and operational monitoring. It assists with audit trails, troubleshooting, and performance analysis. Access logs can also help detect potential security incidents, unauthorized access attempts, or misuse of the API. Having Access Logging enabled ensures that you have a record of all interactions with your API, which is essential for compliance and security monitoring.

### Impact:

Pros:

-   Security Monitoring: Logs all interactions with your API, which is useful for detecting malicious or unauthorized access attempts.
    
-   Operational Insights: Provides insights into the usage patterns, response times, and errors that can help optimize performance.
    
-   Compliance: Helps meet compliance requirements by keeping detailed access logs for auditing purposes.
    
-   Troubleshooting: Enables easier identification and resolution of issues in the API service.
    

Cons:

-   Storage Costs: Storing logs in CloudWatch Logs can incur additional storage costs.
    
-   Log Volume: A high volume of API requests can generate a large amount of log data, which may require management or filtering to ensure relevant information is captured.
    

### Default Value:

By default, API Gateway V2 does not have Access Logging enabled. Access logging must be explicitly configured for each API stage to ensure that request and response data is logged to CloudWatch Logs.

### Pre-requisite:

-   AWS IAM Permissions:
    
    -   apigatewayv2:UpdateStage
        
    -   logs:CreateLogGroup
        
    -   logs:CreateLogStream
        
    -   logs:PutLogEvents
        
-   AWS CLI installed and configured.
    
-   Familiarity with API Gateway V2, CloudWatch Logs, and IAM roles.
    

### Remediation:

### Test Plan:

#### Using AWS Console:

1.  Sign in to the AWS Management Console.
    
2.  Navigate to API Gateway V2 under Services.
    

    ![](https://support.icompaas.com/assets/kb/6c33baa2e447f370.png)

3.  In the API Gateway section, select APIs.
    

         ![](https://support.icompaas.com/assets/kb/35b7042ae0f08369.png)

4.  Choose the API for which you want to check Access Logging.
    

   ![](https://support.icompaas.com/assets/kb/944219ac7f5ab034.png)

5.  In the Stages section, select the stage you want to verify.
    

     ![](https://support.icompaas.com/assets/kb/8dd600d0f9bbd071.png)

6.  Under the Logs/Tracing section, verify that Access Logging is enabled:
    
    -   If Access Logging is enabled, a valid CloudWatch Log Group will be configured.
        
    -   If Access Logging is not enabled, it will show as not configured.
        

     ![](https://support.icompaas.com/assets/kb/513ad3142ff12470.png)

7.  To enable Access Logging, click Edit and configure a CloudWatch Log Group and Log Format.
    

    ![](https://support.icompaas.com/assets/kb/f06cc8e8313857d2.png)

8.  Save the changes.
    

    ![](https://support.icompaas.com/assets/kb/ac22ad9ad502bc5a.png)

#### Using AWS CLI:

To check if Access Logging is enabled for a stage, use the following command:

aws apigatewayv2 get-stage --api-id <api-id> --stage-name <stage-name>

1.   In the output, look for the Access Log Settings field:
    
    -   If Access Log Settings is configured with a CloudWatch Log Group, Access Logging is enabled.
        

To enable Access Logging, use the following command:

aws apigatewayv2 update-stage --api-id <api-id> --stage-name <stage-name> --access-log-settings '{"destinationArn":"arn:aws:logs:<region>:<account-id>:log-group:<log-group>","format":"$context.identity.sourceIp - $context.identity.user"}'

 Replace the placeholders <region>, <account-id>, <log-group>, <api-id>, and <stage-name> with the appropriate values.

  

### Implementation Steps:

#### Using AWS Console:

1.  Sign in to the AWS Management Console.
    
2.  Navigate to API Gateway V2.
    

      ![](https://support.icompaas.com/assets/kb/7b9a06de69673963.png)

3.  Select APIs and choose the relevant API.
    

    ![](https://support.icompaas.com/assets/kb/4c9d94baf4909daf.png)

4.  Go to Stages and select the stage for which you want to enable logging.
    

    ![](https://support.icompaas.com/assets/kb/089d5a4f30cda8cd.png)

5.  Under Logs/Tracing, click Edit.
    

 ![](https://support.icompaas.com/assets/kb/e18a2e9dd25f09be.png)

6.  Enable Access Logging by selecting a CloudWatch Log Group and setting the desired log format.
    

     ![](https://support.icompaas.com/assets/kb/4c786fceeb8ac68d.png)

Example log format:  
$context.identity.sourceIp - $context.identity.user

7.  Save the changes.
    

#### Using AWS CLI:

To check the current Access Logging configuration:

aws apigatewayv2 get-stage --api-id <api-id> --stage-name <stage-name>

To enable Access Logging for a specific stage:

aws apigatewayv2 update-stage --api-id <api-id> --stage-name <stage-name> --access-log-settings '{"destinationArn":"arn:aws:logs:<region>:<account-id>:log-group:<log-group>","format":"$context.identity.sourceIp - $context.identity.user"}'

1.  Confirm that logging is enabled and that logs are being written to the specified CloudWatch Log Group.
    

### Backout Plan:

If enabling Access Logging causes issues with API performance or log management:

1.  Identify the affected API Gateway V2 stage.
    

Revert the Access Logging configuration by setting the destination Arn to null:

aws apigatewayv2 update-stage --api-id <api-id> --stage-name <stage-name> --access-log-settings '{"destinationArn":null}'

2.  Verify that the API service is functioning as expected without access logging.
    

### References:

-   [Amazon API Gateway Logging Documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html)
    
-   [AWS CLI: update-stage](https://docs.aws.amazon.com/cli/latest/reference/apigatewayv2/update-stage.html)
    
-   [AWS CLI: get-stage](https://docs.aws.amazon.com/cli/latest/reference/apigatewayv2/get-stage.html)
    

### CIS Controls Mapping:

<table style="border:none;border-collapse:collapse;font-family:&quot;Helvetica Neue&quot;"><tbody style="font-family:&quot;Helvetica Neue&quot;"><tr style="height:38.5pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><td dir="ltr" style="width:16.6667%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><br style="font-family:&quot;Helvetica Neue&quot;">version</span></span></span></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:10.7939%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0)">Control ID</span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:54.6657%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0)">Control Description</span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:700">IG1</span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:700">IG2</span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:700">IG3</span></strong></p></td></tr><tr style="height:38.5pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><td dir="ltr" style="width:16.6667%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;">&nbsp; &nbsp; &nbsp;</strong>v8</td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:10.7939%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">3.4</span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:54.6657%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">Encrypt Data on End-User Devices – Ensure data encryption during file system access.</span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td></tr><tr style="height:52pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><td dir="ltr" style="width:16.6667%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;">&nbsp; &nbsp; &nbsp;</span></strong><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;">v8</span></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:10.7939%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">6.7</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:54.6657%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">Implement Application Layer Filtering and Content Control – Ensure appropriate content filtering is applied to sensitive files.</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td></tr><tr style="height:38.5pt;font-family:&quot;Helvetica Neue&quot;"><td dir="ltr" style="width:16.6667%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;">&nbsp; &nbsp; &nbsp;&nbsp;</span></strong><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;">v8</span></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:10.7939%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">6.8</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:54.6657%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">Define and Maintain Role-Based Access Control – Implement and manage role-based access for file systems.</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;width:5.9192%;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><strong style="font-family:&quot;Helvetica Neue&quot;"><span style="font-size:14px;font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;;color:rgb(0, 0, 0);font-weight:400">●</span></span></strong></p></td></tr></tbody></table>

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
