Analytics services
Athena and OpenSearch Service as security log analysis tools, with their encryption and access controls.
Two analytics services show up in security scenarios. Athena queries logs where they already sit in S3. OpenSearch Service indexes logs for search, dashboards and alerting. Neither one collects logs. Another service must deliver them.
Service table
| Service | What it is | Exam fact | Security controls |
|---|---|---|---|
| Amazon Athena | Serverless SQL over data in S3. Schemas live in the Glue Data Catalog | Query history is kept 45 days. Save a query to keep it longer. Source data is never modified | IAM plus S3 and Glue permissions. Lake Formation for fine-grained access. Query results go to an S3 location per workgroup and can be encrypted. TLS 1.2 required. aws:CalledVia limits access to calls made through Athena. CloudTrail logs API calls |
| Amazon OpenSearch Service | Managed OpenSearch domains for search, log analytics and dashboards | Encryption at rest cannot be turned off once on. Deleting the KMS key makes the domain unreachable | VPC or public endpoint. Resource and identity policies. Fine-grained access control. SAML, Cognito or JWT for Dashboards. KMS encryption at rest with a symmetric key. TLS 1.2 required |
Exam trap
The query history retention of 45 days is not the retention of query results. Results are ordinary S3 objects in the workgroup output location and stay until you delete or expire them. Apply the bucket policy and encryption you would put on any log bucket.
Athena details
- Data protection covers four things. Source data in S3, table metadata in the Glue Data Catalog, query results and query history. Metadata in Glue can be encrypted separately.
- Workgroups set a result location per team and restrict who can view saved queries.
- Access needs three layers. The caller needs Athena permissions, read access on the source bucket and Glue catalog access. If the data is encrypted with KMS the caller also needs decrypt rights.
- Lake Formation adds fine-grained permissions on catalog resources when Athena queries registered data.
OpenSearch encryption at rest
| Item | Behavior |
|---|---|
| Algorithm and keys | AES-256 with a symmetric KMS key. Asymmetric keys are not supported |
| What is encrypted | Indexes including UltraWarm, OpenSearch logs, swap files, application directory data, automated snapshots |
| What is not | Manual snapshots (encrypt the snapshot bucket instead), slow logs and error logs (encrypt the CloudWatch Logs group) |
| Existing domains | Can be enabled on OpenSearch or Elasticsearch 6.7 and later. Not allowed while UltraWarm or cold storage is on |
| Disabling | Not possible. Snapshot, create a new domain, migrate |
| Key rotation | Automatic KMS rotation is fine. Manual rotation by swapping keys is not supported |
| Disabled or deleted key | Domain becomes inaccessible. AWS cannot recover the data. Alarm on KMSKeyError and KMSKeyInaccessible |
Legacy
Older study material says encryption at rest must be chosen at domain creation. That is outdated. Existing domains on 6.7 or later can enable it.
Which one to use
| Need | Pick |
|---|---|
| Occasional investigation of CloudTrail or VPC Flow Logs already in S3, no servers | Athena |
| Always-on dashboards, alerting and near real-time search over streamed logs | OpenSearch Service |
| Row or column level permissions on a shared log lake | Athena with Lake Formation |
| Per-index or per-field permissions inside a search cluster | OpenSearch fine-grained access control |
Exam signal
"Query logs in S3 without provisioning anything" is Athena. "Visualize and alert on log streams" is OpenSearch Dashboards fed by Data Firehose or a CloudWatch Logs subscription.
Related
GuardDuty findings are often exported to S3 and queried with Athena. Compute and messaging neighbors are on Application integration.
Further reading
- https://docs.aws.amazon.com/athena/latest/ug/security.html
- https://docs.aws.amazon.com/athena/latest/ug/security-data-protection.html
- https://docs.aws.amazon.com/opensearch-service/latest/developerguide/security.html
- https://docs.aws.amazon.com/opensearch-service/latest/developerguide/encryption-at-rest.html
- https://docs.aws.amazon.com/opensearch-service/latest/developerguide/data-protection.html