# CapacityConfig

Configures the capacity of the cluster such as the instance type and the number of instances.

- Source: [`aws-opensearchservice/lib/domain.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts#L34)
- Type last changed: v2.182.0 · 5 Mar 2025

## Example

TypeScript:

```ts
import * as opensearch from 'aws-cdk-lib/aws-opensearchservice';

const domain = new Domain(this, 'Domain', {
  version: EngineVersion.OPENSEARCH_1_3,
  capacity: {
    nodeOptions: [
      {
        nodeType: opensearch.NodeType.COORDINATOR,
        nodeConfig: {
          enabled: true,
          count: 2,
          type: 'm5.large.search',
        },
      },
    ],
  },
})
```

Python:

```python
import aws_cdk.aws_opensearchservice as opensearch

domain = Domain(self, "Domain",
    version=EngineVersion.OPENSEARCH_1_3,
    capacity=opensearch.CapacityConfig(
        node_options=[opensearch.NodeOptions(
            node_type=opensearch.NodeType.COORDINATOR,
            node_config=opensearch.NodeConfig(
                enabled=True,
                count=2,
                type="m5.large.search"
            )
        )
        ]
    )
)
```

Java:

```java
import software.amazon.awscdk.services.opensearchservice.*;

Domain domain = Domain.Builder.create(this, "Domain")
        .version(EngineVersion.OPENSEARCH_1_3)
        .capacity(CapacityConfig.builder()
                .nodeOptions(List.of(NodeOptions.builder()
                        .nodeType(NodeType.COORDINATOR)
                        .nodeConfig(NodeConfig.builder()
                                .enabled(true)
                                .count(2)
                                .type("m5.large.search")
                                .build())
                        .build()))
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.OpenSearchService;

var domain = new Domain(this, "Domain", new DomainProps {
    Version = EngineVersion.OPENSEARCH_1_3,
    Capacity = new CapacityConfig {
        NodeOptions = new [] { new NodeOptions {
            NodeType = NodeType.COORDINATOR,
            NodeConfig = new NodeConfig {
                Enabled = true,
                Count = 2,
                Type = "m5.large.search"
            }
        } }
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import opensearch "github.com/aws/aws-cdk-go/awscdk"

domain := awscdk.NewDomain(this, jsii.String("Domain"), &DomainProps{
	Version: awscdk.EngineVersion_OPENSEARCH_1_3(),
	Capacity: &CapacityConfig{
		NodeOptions: []NodeOptions{
			&NodeOptions{
				NodeType: opensearch.NodeType_COORDINATOR,
				NodeConfig: &NodeConfig{
					Enabled: jsii.Boolean(true),
					Count: jsii.Number(2),
					Type: jsii.String("m5.large.search"),
				},
			},
		},
	},
})
```

## Properties

- `dataNodeInstanceType`: string = r5.large.search — The instance type for your data nodes, such as `m3.medium.search`. For valid values, see [Supported Instance Types](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html) in the Amazon OpenSearch Service Developer Guide.

- `dataNodes`: number = 1 — The number of data nodes (instances) to use in the Amazon OpenSearch Service domain.

- `masterNodeInstanceType`: string = r5.large.search — The hardware configuration of the computer that hosts the dedicated master node, such as `m3.medium.search`. For valid values, see [Supported Instance Types](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html) in the Amazon OpenSearch Service Developer Guide.

- `masterNodes`: number — The number of instances to use for the master node.

  **Default:** no dedicated master nodes

- `multiAzWithStandbyEnabled`: boolean — Indicates whether Multi-AZ with Standby deployment option is enabled.

  **Default:** multi-az with standby if the feature flag `ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY` is true, no multi-az with standby otherwise

  For more information, see [Multi-AZ with
  Standby](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html#managedomains-za-standby)

- `nodeOptions`: [NodeOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_opensearchservice.NodeOptions.html)[] — Additional node options for the domain.

  **Default:** no additional node options

- `warmInstanceType`: string = ultrawarm1.medium.search — The instance type for your UltraWarm node, such as `ultrawarm1.medium.search`. For valid values, see [UltraWarm Storage Limits](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#limits-ultrawarm) in the Amazon OpenSearch Service Developer Guide.

- `warmNodes`: number — The number of UltraWarm nodes (instances) to use in the Amazon OpenSearch Service domain.

  **Default:** no UltraWarm nodes
