This rule ensures that API Gateway stage logging is enabled to maintain security standards.
Rule | API Gateway stage logging should be enabled |
Framework | NIST 800-171 Revision 2 |
Severity | ✔ High |
Rule Description
The rule requires enabling API Gateway stage logging for NIST 800-171 Revision 2 compliance. API Gateway stage logging helps in monitoring and auditing the API Gateway service to ensure compliance with the security controls defined in NIST 800-171 Revision 2.
When API Gateway stage logging is enabled, it records detailed information about API calls made to the API Gateway stage, including the source IP address, user identity, requested API methods, response codes, and other relevant details. This logging data is crucial for security analysis and incident response.
Troubleshooting Steps
If API Gateway stage logging is not enabled or properly configured, you may encounter the following issues:
Lack of visibility into API calls: Without stage logging, it becomes challenging to track and analyze the API calls made to the API Gateway stage. This can hinder incident detection and investigation.
Difficulty in compliance assessment: To ensure compliance with NIST 800-171 Revision 2, API Gateway stage logging is necessary. Failing to enable stage logging can result in non-compliance.
Necessary Codes
To enable API Gateway stage logging for NIST 800-171 Revision 2 compliance, you need to configure the logging settings of your API Gateway stage using AWS Command Line Interface (CLI) commands.
Step-by-Step Guide for Remediation
Follow these step-by-step instructions to enable API Gateway stage logging for NIST 800-171 Revision 2:
Step 1: Install and Configure AWS CLI (if not already done)
If you haven't already installed the AWS CLI, download and install it according to your operating system. Refer to the official AWS CLI documentation for installation instructions.
Once installed, open a terminal or command prompt and run the following command to configure the AWS CLI with your AWS account credentials:
aws configure
Step 2: Enable API Gateway Stage Logging
Open a terminal or command prompt.
Run the following AWS CLI command to enable logging for your API Gateway stage:
aws apigateway update-stage --rest-api-id <rest_api_id> --stage-name <stage_name> --patch-operations '[{"op": "add", "path": "/logging/loglevel", "value": "INFO"}]'
Replace
<rest_api_id>
with the ID of your API Gateway REST API and <stage_name>
with the name of the API Gateway stage you want to enable logging for.Step 3: Verify Logging Configuration
After executing the command, wait for a few minutes for the configuration to take effect.
To verify the logging configuration, use the following command:
aws apigateway get-stage --rest-api-id <rest_api_id> --stage-name <stage_name> --query 'logging'
Replace
<rest_api_id>
and <stage_name>
with the respective values."dataTraceEnabled"
field. If its value is true
, it means logging is successfully enabled for the API Gateway stage.Conclusion
Enabling API Gateway stage logging is crucial for NIST 800-171 Revision 2 compliance. By following the above steps, you can ensure that the necessary logging is configured for your API Gateway stage, allowing you to fulfill the requirements of NIST 800-171 Revision 2 and enhance your overall security posture.