Skip to Content
Asterrr's Handbook
Service cheat sheets

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.

Log sourcesAWS account (one Region)log filesSQL queryschemagrantsstreamindexencryptCloudTrailCloudWatch LogsS3 log bucketGlue DataCatalogLake FormationAthenaData FirehoseOpenSearchdomainKMS key
Athena reads log files in S3 through the Glue Data Catalog. OpenSearch receives a stream through Data Firehose. KMS protects both stores.

Service table

ServiceWhat it isExam factSecurity controls
Amazon AthenaServerless SQL over data in S3. Schemas live in the Glue Data CatalogQuery history is kept 45 days. Save a query to keep it longer. Source data is never modifiedIAM 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 ServiceManaged OpenSearch domains for search, log analytics and dashboardsEncryption at rest cannot be turned off once on. Deleting the KMS key makes the domain unreachableVPC 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

ItemBehavior
Algorithm and keysAES-256 with a symmetric KMS key. Asymmetric keys are not supported
What is encryptedIndexes including UltraWarm, OpenSearch logs, swap files, application directory data, automated snapshots
What is notManual snapshots (encrypt the snapshot bucket instead), slow logs and error logs (encrypt the CloudWatch Logs group)
Existing domainsCan be enabled on OpenSearch or Elasticsearch 6.7 and later. Not allowed while UltraWarm or cold storage is on
DisablingNot possible. Snapshot, create a new domain, migrate
Key rotationAutomatic KMS rotation is fine. Manual rotation by swapping keys is not supported
Disabled or deleted keyDomain 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

NeedPick
Occasional investigation of CloudTrail or VPC Flow Logs already in S3, no serversAthena
Always-on dashboards, alerting and near real-time search over streamed logsOpenSearch Service
Row or column level permissions on a shared log lakeAthena with Lake Formation
Per-index or per-field permissions inside a search clusterOpenSearch 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.

GuardDuty findings are often exported to S3 and queried with Athena. Compute and messaging neighbors are on Application integration.

Further reading

On this page