Skip to main content

More Info:

Idle AWS Redshift clusters should be terminated in order to help lower the cost of your monthly AWS bill.

Risk Level

Low

Address

Cost Optimisation

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the issue of idle Redshift clusters in AWS, follow these steps using the AWS Management Console:
  1. Sign in to the AWS Management Console: Go to the AWS Management Console (https://aws.amazon.com/console/) and sign in using your credentials.
  2. Navigate to Amazon Redshift: From the AWS Management Console, navigate to the Amazon Redshift service by typing “Redshift” in the search bar and selecting it from the options.
  3. Identify Idle Clusters: In the Amazon Redshift dashboard, identify the Redshift clusters that are idle and have no active queries or connections. You can check the “Last Modified” or “Last Backup” timestamps to identify clusters that have been inactive for a long time.
  4. Select the Idle Cluster: Click on the checkbox next to the idle Redshift cluster that you want to terminate.
  5. Terminate the Cluster: Click on the “Clusters” tab at the top of the dashboard and then click on the “Actions” dropdown menu. Select “Delete cluster” from the options.
  6. Confirm Termination: A confirmation window will appear asking you to confirm the termination of the cluster. Enter the cluster identifier in the text box and click on the “Delete” button to confirm.
  7. Monitor Deletion: Once you confirm the deletion, the idle Redshift cluster will start the termination process. Monitor the progress in the Amazon Redshift dashboard until the cluster is successfully terminated.
  8. Repeat if Necessary: Repeat the above steps for any other idle Redshift clusters that need to be terminated to avoid unnecessary costs and resource wastage.
By following these steps, you can remediate the issue of idle Redshift clusters in AWS and ensure that only active clusters are running to optimize costs and resources effectively.

To remediate the idle Redshift clusters in AWS using AWS CLI, follow these steps:Step 1: List all the Redshift clusters in your AWS account to identify the idle clusters. Run the following command in AWS CLI:
Step 2: Identify the idle Redshift clusters based on the ClusterStatus and CreateTime values. Look for clusters that have not been used for an extended period and are in the available status.Step 3: Terminate the idle Redshift clusters to save costs and resources. Run the following command in AWS CLI to delete the identified idle cluster:
Replace <cluster-identifier> with the actual identifier of the idle cluster you want to terminate.Step 4: Confirm the termination of the cluster by listing all the Redshift clusters again:
Ensure that the terminated cluster is no longer listed in the output.By following these steps, you can remediate the issue of idle Redshift clusters in AWS by terminating them using AWS CLI.
To remediate the issue of idle Redshift clusters not being terminated in AWS using Python, you can create a script that programmatically checks for idle clusters based on certain criteria (e.g., last query execution time, CPU utilization, etc.) and terminates them if they are deemed idle. Here’s a step-by-step guide on how to do this:
  1. Install Boto3: Boto3 is the AWS SDK for Python that allows you to interact with AWS services. You can install it using pip:
  2. Create a Python Script: Create a Python script (e.g., terminate_idle_redshift_clusters.py) and import the necessary libraries:
  3. Initialize Boto3: Initialize the Boto3 client for Redshift:
  4. Define Criteria for Idle Clusters: Define the criteria for identifying idle clusters. This could be based on factors like last query execution time, CPU utilization, etc.
  5. List Redshift Clusters: Use the describe_clusters method to list all Redshift clusters:
  6. Check for Idle Clusters: Iterate through the list of clusters and check if they meet the criteria for being idle:
  7. Run the Script: Run the Python script periodically (e.g., using a cron job) to check for and terminate idle Redshift clusters.
  8. Testing: Test the script in a non-production environment to ensure that it correctly identifies and terminates idle clusters without affecting active clusters.
By following these steps, you can create a Python script to automatically identify and terminate idle Redshift clusters in AWS, helping to optimize costs and resources.
To actually terminate the idle cluster, remove this aws_redshift_cluster resource from the Terraform configuration (or otherwise stop referencing it), run terraform plan to confirm the destroy operation, then terraform apply to let Terraform delete the cluster using the above final-snapshot settings.If you instead want to match the “no snapshot” CLI variant, set skip_final_snapshot = true and remove final_snapshot_identifier before running terraform destroy; this will irreversibly delete the cluster and all data with no backup.This change does not “replace” the resource; it results in its permanent destruction. Data loss is irreversible, so ensure the cluster is no longer needed and any data is backed up before applying.Verification: terraform plan should show the Redshift cluster only in the “destroy” section, e.g. Plan: 0 to add, 0 to change, 1 to destroy.

Additional Reading: