# ZoneAwarenessConfig

Specifies zone awareness configuration options.

- 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#L107)

## Example

TypeScript:

```ts
const domain = new Domain(this, 'Domain', {
  version: EngineVersion.OPENSEARCH_1_3,
  ebs: {
    volumeSize: 10,
    volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3,
  },
  zoneAwareness: {
    enabled: true,
    availabilityZoneCount: 3,
  },
  capacity: {
    multiAzWithStandbyEnabled: true,
    masterNodes: 3,
    dataNodes: 3,
  },
});
```

Python:

```python
from aws_cdk.aws_opensearchservice import EbsOptions, ZoneAwarenessConfig, CapacityConfig
domain = Domain(self, "Domain",
    version=EngineVersion.OPENSEARCH_1_3,
    ebs=EbsOptions(
        volume_size=10,
        volume_type=ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3
    ),
    zone_awareness=ZoneAwarenessConfig(
        enabled=True,
        availability_zone_count=3
    ),
    capacity=CapacityConfig(
        multi_az_with_standby_enabled=True,
        master_nodes=3,
        data_nodes=3
    )
)
```

Java:

```java
Domain domain = Domain.Builder.create(this, "Domain")
        .version(EngineVersion.OPENSEARCH_1_3)
        .ebs(EbsOptions.builder()
                .volumeSize(10)
                .volumeType(EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3)
                .build())
        .zoneAwareness(ZoneAwarenessConfig.builder()
                .enabled(true)
                .availabilityZoneCount(3)
                .build())
        .capacity(CapacityConfig.builder()
                .multiAzWithStandbyEnabled(true)
                .masterNodes(3)
                .dataNodes(3)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var domain = new Domain(this, "Domain", new DomainProps {
    Version = EngineVersion.OPENSEARCH_1_3,
    Ebs = new EbsOptions {
        VolumeSize = 10,
        VolumeType = EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3
    },
    ZoneAwareness = new ZoneAwarenessConfig {
        Enabled = true,
        AvailabilityZoneCount = 3
    },
    Capacity = new CapacityConfig {
        MultiAzWithStandbyEnabled = true,
        MasterNodes = 3,
        DataNodes = 3
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
domain := awscdk.NewDomain(this, jsii.String("Domain"), &DomainProps{
	Version: awscdk.EngineVersion_OPENSEARCH_1_3(),
	Ebs: &EbsOptions{
		VolumeSize: jsii.Number(10),
		VolumeType: ec2.EbsDeviceVolumeType_GENERAL_PURPOSE_SSD_GP3,
	},
	ZoneAwareness: &ZoneAwarenessConfig{
		Enabled: jsii.Boolean(true),
		AvailabilityZoneCount: jsii.Number(3),
	},
	Capacity: &CapacityConfig{
		MultiAzWithStandbyEnabled: jsii.Boolean(true),
		MasterNodes: jsii.Number(3),
		DataNodes: jsii.Number(3),
	},
})
```

## Properties

- `availabilityZoneCount`: number — If you enabled multiple Availability Zones (AZs), the number of AZs that you want the domain to use.

  **Default:** 2 if zone awareness is enabled.

  Valid values are 2 and 3.

- `enabled`: boolean = false — Indicates whether to enable zone awareness for the Amazon OpenSearch Service domain.

  When you enable zone awareness, Amazon OpenSearch Service allocates the nodes and replica
  index shards that belong to a cluster across two Availability Zones (AZs)
  in the same region to prevent data loss and minimize downtime in the event
  of node or data center failure. Don't enable zone awareness if your cluster
  has no replica index shards or is a single-node cluster. For more information,
  see [Configuring a Multi-AZ Domain](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html)
  in the Amazon OpenSearch Service Developer Guide.
