Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are step‑by‑step console instructions to enable encryption at rest and encryption in transit for Amazon OpenSearch Service / Amazon Elasticsearch Service (the managed service often called “AWS Elasticsearch”).
If you tell me whether you’re on the OpenSearch or legacy Elasticsearch console and whether the domain is in a VPC or public, I can tailor the exact console menu/field names for your environment.
Important: Some encryption options cannot be changed on an existing domain. If the options are grayed out, you must create a new domain with encryption enabled and migrate data.
1. Check Current Encryption Settings
- Sign in to the AWS Management Console.
- Go to Amazon OpenSearch Service (or “Amazon Elasticsearch Service” if you’re on an older console).
- In the left pane, choose Domains.
- Click your domain name.
- On the domain’s detail page:
- Look at Security or Encryption sections:
- Encryption at rest: check if it’s Enabled.
- Node-to-node encryption: check if it’s Enabled.
- Domain endpoint: verify if it’s using HTTPS only.
- Look at Security or Encryption sections:
2. Enable Encryption (New Domain – Recommended if Current One Isn’t Encrypted)
2.1 Create a New Domain with Encryption
- In the OpenSearch Service console, click Create domain.
- Engine version: choose your required OpenSearch/Elasticsearch version.
- Domain name: enter a unique name (e.g.,
my-secure-domain). - Continue through:
- Network:
- Choose VPC access if possible (recommended).
- Data nodes: choose instance type and count.
- Network:
2.2 Enable Encryption at Rest
- Scroll to the Data protection or Encryption section.
- Check Enable encryption at rest.
- Choose a KMS key:
- Use the AWS managed key or
- Choose a customer-managed CMK in KMS.
- (Optional) Enable Auto-Tune and other performance settings as needed.
2.3 Enable Node-to-Node Encryption (In-Transit Within the Cluster)
- In the same security/encryption section, check Enable node-to-node encryption.
- This encrypts traffic between cluster nodes.
2.4 Enforce HTTPS for Client Connections (In Transit from Clients)
-
In the Domain endpoint or Network/“Security” section:
- Ensure Require HTTPS is selected (or equivalent option that disallows HTTP).
- If there’s an Endpoint security or TLS policy field, select a modern TLS policy (e.g.,
Policy-Min-TLS-1-2-2019-07).
-
Configure access policy:
- Use fine-grained access control + IAM, or
- Restrict by VPC and security groups, or
- If using a public endpoint, restrict by IAM and/or source IP.
- Click Next, review all settings, then click Create.
3. Migrate Data from Old Domain to New Secure Domain
- Once the new domain is Active, note its HTTPS endpoint.
-
From an EC2 instance, container, or your workstation (with network access to both domains), use:
- reindex from remote (if supported by your version), or
- A tool such as Logstash, Elasticsearch/OpenSearch reindex APIs, or a custom script:
- Read from
http(s)://old-domain-endpoint - Write to
https://new-domain-endpoint
- Read from
-
Update:
- Application configuration
- Lambda functions
- Log shippers (Filebeat, Fluentd, CloudWatch Logs subscription filters, etc.) to use the new domain’s HTTPS endpoint.
-
Validate:
- Index and document counts between old and new domains.
- Application functionality and performance.
- When fully migrated and tested, delete the old (unencrypted) domain from the console.
4. If You Must Modify an Existing Domain
- In the OpenSearch Service console, open your domain.
- Click Edit (or Edit domain).
- Look for:
- Encryption at rest: Try to select Enable encryption at rest and choose a KMS key.
- Node-to-node encryption: Try to select Enable.
- Require HTTPS: Ensure it is turned on.
- If any are grayed out or locked, AWS does not allow changing them in-place for that domain → you must use the new domain + migration approach above.
- Save/Apply changes and wait for the domain to finish updating.
5. Verify Encryption
- On the domain’s details page:
- Encryption at rest: shows Enabled with the KMS key.
- Node-to-node encryption: shows Enabled.
- Endpoint: begins with
https://and Only HTTPS allowed.
- From a client:
- Ensure all connections use the HTTPS endpoint.
- Confirm TLS negotiation (e.g., using
curl -v https://your-domain-endpoint).
If you tell me whether you’re on the OpenSearch or legacy Elasticsearch console and whether the domain is in a VPC or public, I can tailor the exact console menu/field names for your environment.
Using CLI
Using CLI
For Amazon Elasticsearch / OpenSearch, encryption at rest and in-transit cannot be turned on for an existing domain. You must create a new domain with encryption enabled, migrate data, then cut over.Below are concise, CLI-focused steps.
Use this JSON to copy any important settings (instance type, count, EBS size, access policy, etc.) into the new domain command.
To use a specific KMS key for encryption at rest:Wait for the domain to be active:Repeat until it returns
Confirm:
Repeat for all indices (you can keep same index names if desired).
Update all applications, Lambdas, etc. to use:
If instead you actually meant ElastiCache, say so and I’ll give the corresponding
1. Capture current domain config (for reference)
2. Create a new domain with encryption enabled
Key options:--encryption-at-rest-options Enabled=true--node-to-node-encryption-options Enabled=true--domain-endpoint-options EnforceHTTPS=true,TLSecurityPolicy=Policy-Min-TLS-1-2-2019-07
false.3. Verify encryption settings
EncryptionAtRestOptions.Enabled = trueNodeToNodeEncryptionOptions.Enabled = trueDomainEndpointOptions.EnforceHTTPS = true
4. Migrate data from old to new domain
Use reindex-from-remote via the Elasticsearch/OpenSearch API (not CLI) from the new domain, for each index:5. Update clients to use HTTPS endpoint of new domain
From CLI, get the endpoint:- The HTTPS endpoint of
NEW_DOMAIN_NAME - TLS 1.2–compatible clients
6. Decommission old domain
Once you have:- Verified data in the new domain
- Switched all traffic to the new domain
- Observed stable operations
If instead you actually meant ElastiCache, say so and I’ll give the corresponding
aws elasticache CLI steps.Using Python
Using Python
You’re mixing two different services in the question, so I’ll answer for what you explicitly asked: AWS Elasticsearch / OpenSearch Service (not ElastiCache).For Amazon Elasticsearch / OpenSearch, “encrypted at rest and in transit” means:
If
Wait for the domain to become active:
Repeat for all indices. Validate data, aliases, index settings, etc.
This enforces in-transit encryption for clients; node-to-node and at-rest must have been enabled at creation time.
- At rest:
EncryptAtRestOptions.Enabled = True - Node-to-node:
NodeToNodeEncryptionOptions.Enabled = True - Client-to-domain (in transit): HTTPS-only endpoint (
DomainEndpointOptions.EnforceHTTPS = True)
1. Prerequisites
- Install boto3 and configure AWS credentials:
- Use Python 3 and import boto3:
2. Check current domain encryption settings
Encrypt at rest or Node-to-node is False or missing, you must create a new domain.3. Create a new encrypted domain (recommended path)
3.1. Decide on new domain name and region
3.2. Read configuration from existing domain
3.3. Create new domain with encryption enabled
4. Migrate data from old (unencrypted) to new (encrypted) domain
Use a migration method like:- reindex from remote (if supported by your engine version), or
- Logstash, or
- a custom Python script using
elasticsearch/opensearch-pyclient.
- Get endpoints:
- Use an HTTP client (e.g.,
requests) oropensearch-pyto call_reindexfrom target domain:
5. Switch traffic and delete old domain
- Update any clients, apps, or DNS records to use the new domain endpoint (
https://<new-endpoint>). - Test thoroughly.
- Delete the old domain once you’re sure:
6. If encryption is already enabled but HTTPS is not
You can update the endpoint options in-place:Summary
- Use
create_elasticsearch_domainwith:EncryptionAtRestOptions.Enabled = TrueNodeToNodeEncryptionOptions.Enabled = TrueDomainEndpointOptions.EnforceHTTPS = True
- If encryption wasn’t enabled originally, create a new domain and migrate data.
- Manage all of this via boto3 as shown above.
Using Terraform
Using Terraform
encrypt_at_rest.enabled or node_to_node_encryption.enabled from false to true forces replacement of the OpenSearch/Elasticsearch domain, which can cause downtime unless you manage cutover (e.g., with blue/green or DNS).To verify, terraform plan should show encrypt_at_rest.enabled = true, node_to_node_encryption.enabled = true, and domain_endpoint_options.enforce_https = true, with a resource replacement if you are enabling these on an existing unencrypted domain.
