Athena workgroups publish query metrics to CloudWatch. This evaluation determines whether each workgroup has query activity logging enabled in CloudWatch.
Risk
Without CloudWatch query logging, risky or anomalous queries go unobserved, weakening confidentiality and integrity. Compromised or insider accounts can exfiltrate data and alter datasets without timely detection, hampering forensics and containment.
prowler aws --checks athena_workgroup_logging_enabled
Recommendation
Enable and enforce CloudWatch query logging for all workgroups (PublishCloudWatchMetricsEnabled
).
- Apply least privilege to logs and encrypt at rest
- Set retention and anomaly alerts
- Correlate with CloudTrail for user attribution
- Centralize logs to a monitoring account
Remediation
aws athena update-work-group --work-group <WORKGROUP_NAME> --configuration-updates PublishCloudWatchMetricsEnabled=true
# CloudFormation to enable CloudWatch logging for an Athena workgroup
Resources:
AthenaWorkGroup:
Type: AWS::Athena::WorkGroup
Properties:
Name: <example_resource_name>
WorkGroupConfiguration:
PublishCloudWatchMetricsEnabled: true # Critical: Enables CloudWatch logging for the workgroup
# Enable CloudWatch logging for an Athena workgroup
resource "aws_athena_workgroup" "example" {
name = "<example_resource_name>"
configuration {
publish_cloudwatch_metrics_enabled = true # Critical: Enables CloudWatch logging
}
}
- Open the AWS Management Console and go to Amazon Athena
- In the left pane, click Workgroups and select the target workgroup
- Click Edit
- Check Publish query metrics to AWS CloudWatch
- Click Save
Source Code
Resource Type
AwsAthenaWorkGroup
References
- https://docs.aws.amazon.com/athena/latest/ug/security-logging-monitoring.html
- https://docs.aws.amazon.com/athena/latest/ug/athena-cloudwatch-metrics-enable.html
- https://stackoverflow.com/questions/68896809/how-to-save-queries-executed-by-athena-in-logsgroup-cloudwatch
- https://support.icompaas.com/support/solutions/articles/62000233405-ensure-that-logging-is-enabled-for-amazon-athena-workgroups-to-capture-query-activity-
- https://docs.aws.amazon.com/securityhub/latest/userguide/athena-controls.html#athena-4