Review Redshift audit logging

Export Redshift audit logs to an appropriate destination.

Description

Send Redshift audit logs to S3 or CloudWatch Logs to retain connection and user activity records for investigation.

Potential impact

Without an external copy, older access or administrative activity may fall outside the records retained by the database.

Remediation

Set the cluster and destination in aws_redshift_logging. For cloudwatch, specify the log types in log_exports. To record SQL activity, also enable enable_user_activity_logging on the cluster. Verify an exported event, such as a new connection for connectionlog. Restrict readers and set retention.

Examples

The example adds S3 delivery for the existing cluster. Supply the bucket and delivery policy and pass compatible node and cluster types through the variables. Use a managed production credential in place of the sample password and protect Terraform state.

Before

hcl
resource "aws_redshift_cluster" "example" {
  cluster_identifier = "tf-redshift-cluster"
  database_name      = "mydb"
  master_username    = "foo"
  master_password    = "Mustbe8characters"
  node_type          = var.redshift_node_type
  cluster_type       = var.redshift_cluster_type
}

After

hcl
resource "aws_redshift_cluster" "example" {
  cluster_identifier = "tf-redshift-cluster"
  database_name      = "mydb"
  master_username    = "foo"
  master_password    = "Mustbe8characters"
  node_type          = var.redshift_node_type
  cluster_type       = var.redshift_cluster_type
}

resource "aws_redshift_logging" "example" {
  cluster_identifier   = aws_redshift_cluster.example.id
  log_destination_type = "s3"
  bucket_name          = aws_s3_bucket.logs.id
}

References