The Amazon OpenSearch m-family latest generation policy flags Amazon OpenSearch Service domains on previous-generation m3 instance types and recommends m5 or newer. An m5.2xlarge.search node costs about 25% less per month than an m3.2xlarge.search node in US East (N. Virginia). Both nodes have 8 vCPUs, and m5 adds 2 GiB of memory and gp3 storage support. Apply this policy to any aws_opensearch_domain or aws_elasticsearch_domainwhose cluster_config uses an m3 instance type.
Attribute | Detail |
|---|---|
Cloud Provider | Amazon Web Services (AWS) |
Resource Type | Amazon OpenSearch Service domains on general-purpose m-family nodes |
Terraform Attribute |
|
Non-compliant Values |
|
Compliant Value | The m5 equivalent, such as |
Cost Impact | About 25% lower on-demand cost per node moving |
Why This Policy Matters
How It Helps Reduce Cloud Costs
Amazon OpenSearch Service bills every node by the hour for as long as the domain runs. Search and log analytics domains usually run around the clock, so the hourly node rate becomes a fixed monthly cost.
Amazon OpenSearch m-family nodes are general-purpose. They balance vCPU and memory, which makes them a common default for mixed search and indexing workloads.
AWS lists m3 as a previous-generation family in Amazon OpenSearch Service. The m3 family pairs an older processor with small local SSD storage.
Amazon OpenSearch m3 nodes also block several domain features. AWS states that m3 instance types do not support encryption at rest, fine-grained access control, or cross-cluster search.
Staying on m3 means paying a higher hourly rate for less memory and fewer features. Domains still on m3 are usually old domains that were created years ago and never revisited.
Potential Savings
The Amazon OpenSearch m-family generation upgrade saves money because an m5 node costs less per hour than the m3 node it replaces. The m5 node also has slightly more memory.
Instance type | vCPUs | Memory | Storage | On-demand hourly (US East) | Approx. monthly |
|---|---|---|---|---|---|
| 8 | 30 GiB | 2 x 80 GB local SSD, or EBS | $0.752 | $549 |
| 8 | 32 GiB | EBS only (gp2 or gp3) | $0.566 | $413 |
Monthly figures assume 730 hours at US East (N. Virginia) on-demand rates. Prices vary by region and purchase option.
Moving one m3.2xlarge.search node to m5.2xlarge.search saves about $136 per month, or roughly $1,630 per year. EBS storage on the m5 node is billed separately per GB.
m5 nodes support gp3 volumes. AWS prices gp3 on Amazon OpenSearch Service 9.6% lower per GB than gp2, which adds a small storage saving on top.
Implementation Guide
Infrastructure-as-Code Example (Terraform)
The following examples show an Amazon OpenSearch Service domain on previous-generation m3 nodes, and the corrected configuration on m5.
Non-compliant configuration: OpenSearch domain on m3 data nodes
This configuration pays about $549 per month per node for an older processor and 30 GiB of memory. This is a common source of wasted spend in log and search domains that were sized years ago.
Compliant configuration: OpenSearch domain on m5 data nodes
The only Terraform change is the instance_type value. The ebs_options block must stay enabled, because m5 nodes have no local instance storage.
If the m3 domain uses local instance storage today, the ebs_options block will show ebs_enabled = false. Set ebs_enabled = true and add a volume_size that covers the current index size before changing the instance type.
Newer Terraform code uses the aws_opensearch_domain resource, where the version attribute is engine_version. The fix is identical there: change instance_type inside cluster_config from the m3 value to the m5 value.
Step-by-Step Fix Instructions
Search Terraform code for
instance_typevalues that start withm3.onaws_opensearch_domainandaws_elasticsearch_domainresources.Check shared modules,
.tfvarsfiles, and variable defaults. The instance type often sits in avariable "instance_type"default rather than in the resource block.Check the engine version. m5 nodes require Elasticsearch 5.1 or later, or any OpenSearch version, so older domains need an engine upgrade first.
Check the storage setup. If
ebs_enabled = false, enable EBS and sizevolume_sizefor the current index data. Them5.2xlarge.searchEBS limit is 1.5 TiB on gp2 and 3 TiB on gp3.Change
instance_typeto the m5 value with the same size suffix and runterraform plan. Confirm the plan shows an in-place update tocluster_config, not a domain replacement.Apply the change to a non-production Amazon OpenSearch Service domain first. AWS launches new nodes, migrates shards, then terminates the old nodes, so watch cluster health in Amazon CloudWatch until it completes.
Roll the change to production during a low-traffic period, after taking a manual snapshot.
Add Infracost to CI/CD so new m3 instance types are flagged in pull requests before they merge.
Best Practices
Pin approved Amazon OpenSearch Service instance types in shared Terraform modules with a
validationblock, so m3 values fail atterraform plan.Migrate development and staging domains first. These carry the least risk if shard migration takes longer than expected.
Take a manual snapshot of the domain before the change. The node migration is designed to keep data intact, but a snapshot is the fallback.
Treat the gp2 to gp3 volume change as a separate pull request. Smaller changes make each migration easier to review and roll back.
Default to m5 for a like-for-like x86 replacement. Choose m7i, m7g, or m8g when the domain runs a supported engine version and needs a current-generation processor.
Tools and Scripts
How does Infracost detect previous-generation Amazon OpenSearch m-family nodes automatically?
The Amazon OpenSearch m-family latest generation policy is available in Infracost, including in the free trial. Enable FinOps policies in Infracost Cloud and run Infracost in CI/CD. Each pull request that adds or changes an OpenSearch domain on an m3 instance type then gets a finding in the PR comment. The finding names the exact file and line to change.
The same Infracost pull request comment shows the estimated monthly cost of the change. Reviewers see what a three-node m3.2xlarge.search domain costs before it merges, not on next month's AWS bill.
Infracost also scans connected repositories for m3 instance types already in code. FinOps and platform teams can burn down that backlog and measure progress over time. Infracost tracks new issues prevented in pull requests separately from existing issues fixed.
Teams can set the policy to warn engineers or block pull requests. The policy can also be limited to new resources only, so an unrelated pull request does not force a migration of an existing domain.
To find m3 instance types in a Terraform codebase:
To list running Amazon OpenSearch Service domains with their data node types and engine versions using the AWS CLI:
If a domain is managed by Terraform, change instance_type in code rather than in the AWS console. Otherwise the next terraform apply sets the old instance type again.
Examples of Impact
Savings from the Amazon OpenSearch m-family upgrade are moderate per node, but they add up across domains that run all year.
Illustrative example: a log analytics domain. A platform team runs six m3.2xlarge.search data nodes for application logs. Moving them to m5.2xlarge.search cuts on-demand cost by about $815 per month, roughly $9,780 per year.
Illustrative example: a product search domain. A team runs a three-node m3.2xlarge.search domain for catalog search. One instance_type change in Terraform saves about $407 per month at US East on-demand rates, with no client code changes.
(These are illustrative scenarios, not specific customer accounts.)
Considerations and Caveats
The Amazon OpenSearch m-family upgrade is low effort for most domains, but storage and engine version need checking first.
No local storage on m5. m5 nodes use EBS only. Domains on m3 local SSD must enable EBS, which adds a per-GB storage charge.
Engine version floor. m5 requires Elasticsearch 5.1 or later, or any OpenSearch version, so Elasticsearch 1.5 and 2.3 domains need an engine upgrade first. Elasticsearch 6.7 and earlier moved to paid Extended Support on November 7, 2025.
One-way change on newer versions. On OpenSearch or Elasticsearch 6.7 and later, a domain that leaves m3 cannot switch back.
m5 is not the end state. AWS now lists m5 as previous generation in Amazon OpenSearch Service. Current-generation options include m7i, m7g, and m8g.
Reserved instances do not move. Amazon OpenSearch Service reserved instances apply to one instance type, so check reservation coverage before switching.
Related Policies and Concepts
Amazon EC2 - consider using latest generation instances for m family instances: the same generation upgrade for self-managed general-purpose EC2 instances.
Amazon OpenSearch - consider using Graviton instances: the Arm-based cost change for OpenSearch domains, a natural next step after leaving m3.
Amazon OpenSearch - consider using latest generation instances for r family instances: the generation upgrade for memory-optimized OpenSearch nodes.
Amazon OpenSearch - consider using latest generation instances for i family instances: the generation upgrade for storage-optimized OpenSearch nodes.
OpenSearch - consider upgrading version to avoid extended support costs: an engine upgrade that often pairs with leaving m3. Domains on m3 tend to run old Elasticsearch versions.
Frequently Asked Questions (FAQs)
Is this policy supported in Infracost?
Yes. The Amazon OpenSearch m-family latest generation policy is supported in Infracost and available in the free trial. Infracost flags Amazon OpenSearch Service domains that use m3 instance types in pull request comments, so the team can change the instance type before merge.
Can this policy be customized?
Yes. Teams choose which policies are enabled in Infracost Cloud, including the Amazon OpenSearch m-family latest generation policy. Each policy can warn engineers or block the pull request. It can also be limited to new resources only, so existing OpenSearch domains are not forced into a migration.
Does Infracost automatically fix violations?
No. Infracost reports each Amazon OpenSearch Service domain on an m3 instance type, with the file and line to change. Changing the instance type, adding EBS storage, and scheduling the migration is a decision the team makes and applies.
Is this policy cloud-agnostic?
No. The Amazon OpenSearch m-family latest generation policy targets Amazon OpenSearch Service through the aws Terraform provider. Self-managed OpenSearch on EC2 falls under the Amazon EC2 m-family policy, and other clouds use different resource names.
How much does moving from m3.2xlarge.search to m5.2xlarge.search save?
Moving one Amazon OpenSearch m3.2xlarge.search node to m5.2xlarge.search saves about 25% at US East (N. Virginia) on-demand rates. That is roughly $136 per node per month, or about $1,630 per node per year. The m5 node also has 2 GiB more memory.
Can an Amazon OpenSearch domain switch back to m3 after moving to m5?
Usually not. Amazon OpenSearch Service does not allow adding or modifying m3 instances on domains running OpenSearch or Elasticsearch 6.7 and later. If an Amazon OpenSearch Service domain on those versions leaves m3, it cannot switch back.
Should Amazon OpenSearch m3 nodes move to m5 or to a newer m-family generation?
Move Amazon OpenSearch m3 nodes to m5 for a like-for-like x86 replacement with a known saving. AWS now lists m5 as previous generation too. Choose m7i, m7g, or m8g when the Amazon OpenSearch Service domain runs a supported engine version and needs a current-generation processor.
How often should I review Amazon OpenSearch Service instance generations?
Teams running Infracost in CI/CD get an Amazon OpenSearch m-family check on every pull request that touches an OpenSearch domain. For domains already running, a quarterly review of Amazon OpenSearch Service instance generations is a reasonable cadence for most teams.
Create Free Account
This policy is supported in Infracost and available in the free trial. Sign up today and scan your code using our entire library of FinOps policies.