Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the ElasticSearch Domains Should Be Encrypted misconfiguration in AWS using the AWS console, follow these steps:
  1. Log in to the AWS Management Console.
  2. Navigate to the Amazon ElasticSearch Service.
  3. Select the Elasticsearch domain you want to remediate.
  4. Click on the “Edit” button in the “Encryption” section.
  5. Select the “Encrypt” option.
  6. Choose the KMS key that you want to use for encryption.
  7. Click on the “Save” button to apply the changes.
Once you have completed these steps, the ElasticSearch domain will be encrypted using the KMS key that you selected, and the misconfiguration will be remediated.

To remediate ElasticSearch domains that are not encrypted in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI and navigate to the AWS Elasticsearch service.
  2. Check the status of your Elasticsearch domains by running the following command:
  1. Identify the domain that needs to be encrypted and run the following command to update the domain configuration:
This will enable encryption at rest for the Elasticsearch domain.
  1. Verify that the domain is now encrypted by running the following command:
This should return a response that includes the following:
This confirms that the domain is now encrypted at rest.
  1. Repeat these steps for any other Elasticsearch domains that need to be encrypted.
Note: It is important to ensure that all Elasticsearch domains are encrypted to protect sensitive data.
To remediate the ElasticSearch Domains Should Be Encrypted misconfiguration for AWS using Python, you can follow the below steps:
  1. Install the AWS SDK for Python (Boto3) using pip:
  1. Import the necessary libraries:
  1. Set up the AWS credentials:
  1. Create an AWS ElasticSearch client:
  1. Get a list of all ElasticSearch domains:
  1. For each domain, check if it is encrypted:
  1. Run the Python script to remediate the misconfiguration.
Note: Make sure to replace the placeholders YOUR_AWS_ACCESS_KEY_ID, YOUR_AWS_SECRET_ACCESS_KEY, and YOUR_AWS_REGION_NAME with your AWS credentials and region name.
Enabling encrypt_at_rest is irreversible in AWS and will trigger a blue/green deployment; the domain remains the same Terraform resource and is not replaced, but configuration updates are blocked while the deployment runs.For verification, terraform plan should show encrypt_at_rest.enabled changing from false (or being added) to true, and if you set it, kms_key_id changing from null (or absent) to "KMS_KEY_ID_OR_ARN".