Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the issue of EKS clusters not having logging enabled in AWS using the AWS console, please follow the below steps:
  1. Log in to the AWS Management Console.
  2. Navigate to the Amazon EKS console.
  3. Select the EKS cluster that you want to enable logging for.
  4. Click on the “Configuration” tab.
  5. Under the “Logging” section, click on the “Edit” button.
  6. Select the “Enable logging” checkbox.
  7. Choose the “Create a new S3 bucket” option or select an existing S3 bucket from the dropdown menu.
  8. Enter a unique name for the S3 bucket.
  9. Click on the “Save” button to save the changes.
Once the above steps are completed, the EKS cluster will have logging enabled, and logs will be stored in the specified S3 bucket.

To remediate the misconfiguration “EKS Clusters Should Have Logging Enabled” for AWS using AWS CLI, follow the below steps:
  1. Open the AWS CLI on your local machine.
  2. Check the current status of logging for your EKS cluster by running the following command:
    This command will return the current logging status of your EKS cluster.
  3. If the logging is not enabled, run the following command to update the logging status:
    This command will enable logging for your EKS cluster.
  4. Verify that the logging is enabled by running the following command again:
    This command should return the updated logging status of your EKS cluster.
By following these steps, you can remediate the misconfiguration “EKS Clusters Should Have Logging Enabled” for AWS using AWS CLI.
To remediate the misconfiguration of EKS clusters not having logging enabled, you can use the following steps in Python:
  1. First, you need to import the necessary libraries for AWS SDK for Python (Boto3) and EKS service:
  1. Next, you need to create an AWS session and EKS client:
  1. Then, you can use the describe_cluster function to get the logging configuration of the EKS cluster:
  1. If logging_enabled is False, you can use the update_cluster_config function to enable logging:
  1. Finally, you can print a message to confirm that logging has been enabled:
Note: Make sure you have the necessary permissions and credentials to access the EKS cluster and enable logging.
This matches the CLI behavior by enabling all available EKS control plane log types; it will overwrite any previous logging configuration on apply but does not force cluster replacement (Terraform will perform an in-place update that can take several minutes).To verify, terraform plan should show an in-place update (~) to aws_eks_cluster.THIS_CLUSTER with enabled_cluster_log_types changing from its current value to the full list above.