This rule requires enabling logging for API Gateway stages.
Rule | API Gateway stage logging should be enabled |
Framework | FedRAMP Low Revision 4 |
Severity | ✔ High |
Rule Description:
The rule requires enabling logging for the API Gateway stage for compliance with FedRAMP Low Revision 4. Enabling logging helps in maintaining a secure and auditable environment and ensures compliance with regulatory requirements.
Troubleshooting Steps:
If you encounter any issues while enabling logging for the API Gateway stage, follow these troubleshooting steps:
Check IAM Permissions: Ensure that you have the necessary IAM permissions to enable logging for the API Gateway stage. Check if you have the required access to the AWS Management Console or necessary permissions via AWS CLI.
Verify API Gateway Configuration: Ensure that your API Gateway is properly configured and deployed. Check if the stage configuration is accurate and if the API is functioning as expected.
Review CloudWatch Logs: If you have enabled logging but are not seeing the desired logs, verify the CloudWatch Logs configuration. Ensure that the correct log group is specified and that the log group is associated with the API Gateway stage.
Check IAM Roles and Policies: Review the IAM roles and policies associated with your API Gateway stage. Ensure that the roles have the necessary permissions to write logs to CloudWatch Logs.
Examine Execution Role: If you are using AWS Lambda functions in your API Gateway, check the execution role associated with the Lambda function. Ensure that it has IAM permissions to write logs to CloudWatch Logs.
Necessary Codes:
There are no specific codes required for enabling API Gateway stage logging. However, you may need to configure the following settings:
aws logs create-log-group --log-group-name <log-group-name>
Replace
<log-group-name>
with the desired name for your log group.aws apigateway update-stage --rest-api-id <rest-api-id> --stage-name <stage-name> --patch-operations op=add,path=/logging/dataTrace,value=true
Replace
<rest-api-id>
with the ID of your API Gateway and <stage-name>
with the name of the stage for which you want to enable logging.Step-by-Step Guide for Remediation:
Follow these steps to enable logging for the API Gateway stage:
Open the AWS Management Console and navigate to the API Gateway service.
Select the API Gateway that needs logging enabled.
Click on the desired stage for which you want to enable logging.
In the "Stage Editor" section, click on the "Logs/Tracing" tab.
Scroll down to the "Access Logging" section and click on the "Edit" button.
Enable the "Enable CloudWatch Logs" option.
Specify the log format and log level according to your requirements.
Click on the "Save changes" button to save the configuration.
If you haven't already enabled CloudWatch Logs, you can enable it by following the necessary steps mentioned earlier.
By following these steps, you will successfully enable logging for the API Gateway stage, ensuring compliance with FedRAMP Low Revision 4.