π AWS API Gateway API Access Logging in CloudWatch is not enabled π’
- Contextual name: π API Access Logging in CloudWatch is not enabled π’
- ID:
/ce/ca/aws/apigateway/api-access-logging
- Located in: π AWS API Gateway
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Internal
dec-x-d75f6d86
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-d75f6d86 | 1 |
Logicβ
- π§ prod.logic.yaml π π’
- π AWS API Gateway API
- π§ͺ test-data.json
Descriptionβ
Descriptionβ
It is recommended for AWS API Gateway APIs to have access logging configured and enabled. Access logging records request and response data such as IP addresses, request methods, and user agents in Amazon CloudWatch Logs, creating a centralized location to analyze API usage and detect suspicious activity.
Rationaleβ
Enabling access logging for API Gateway in AWS is essential for monitoring API usage patterns, debugging issues, and meeting compliance requirements. Access logs provide a crucial data source for identifying unusual patterns, tracking specific actions, and establishing accountability by capturing the specifics of each API call.
Impactβ
If API Gateway access logging is not enabled, it may lead to insufficient visibility into API interactions, hindering timely detection of security breaches or misconfigurations. It can also impair root cause analysis for performance or functional issues, creating obstacles in incident response and remediation.
Enabling access logging could introduce an increase in logging costs and require additional data management.
... see more
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