π AWS API Gateway API Execution Logging in CloudWatch is not enabled π’
- Contextual name: π API Execution Logging in CloudWatch is not enabled π’
- ID:
/ce/ca/aws/apigateway/api-execution-logging
- Located in: π AWS API Gateway
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
PERFORMANCE
RELIABILITY
Similar Policiesβ
- Internal
dec-x-2ac6c302
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-2ac6c302 | 1 |
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
AWS API Gateway should have API Execution Logging enabled in CloudWatch to support effective monitoring and troubleshooting. Enabling execution logging in CloudWatch provides insight into API requests, error rates, and latency, helping detect and respond to issues promptly.
Rationaleβ
Enabling API execution logging in CloudWatch helps monitor API usage and performance, as well as identify and troubleshoot issues in real-time. It enhances visibility into API traffic patterns, execution errors, and latencies, facilitating better management of APIs.
Impactβ
Enabling CloudWatch logging may increase CloudWatch costs due to additional logging data.
Auditβ
This policy will mark an AWS API Gateway API as
INCOMPLIANT
if theCloudWatch Logging Level
field in a related API Stage object is either empty or set to OFF.For API Gateway HTTP APIs (identified by the
Protocol Type
field set to HTTP), the policy object will be marked asINAPPLICABLE
because HTTP APIs do not support execution logging.
Remediationβ
Remediationβ
Prerequisitesβ
To enable CloudWatch Logs, grant API Gateway permission to read and write logs to CloudWatch in your account. The managed policy
AmazonAPIGatewayPushToCloudWatchLogs
(ARN:arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs
) provides the necessary permissions:{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams",
"logs:PutLogEvents",
"logs:GetLogEvents",
"logs:FilterLogEvents"
],
"Resource": "*"
}
]
}To set up these permissions:
- Create an IAM role with
apigateway.amazonaws.com
as the trusted entity.- Attach the above policy to the IAM role.
- Set the IAM role ARN in the
cloudWatchRoleArn
property of yourAccount
. Note that you must configure thecloudWatchRoleArn
separately for each AWS Region where you wish to enable CloudWatch Logs.... see more