# NodeGroupConfigurationProperty

`NodeGroupConfiguration` is a property of the `AWS::ElastiCache::ReplicationGroup` resource that configures an Amazon ElastiCache (ElastiCache) Valkey or Redis OSS cluster node group.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticache as elasticache } from 'aws-cdk-lib';
const nodeGroupConfigurationProperty: elasticache.CfnReplicationGroup.NodeGroupConfigurationProperty = {
  nodeGroupId: 'nodeGroupId',
  primaryAvailabilityZone: 'primaryAvailabilityZone',
  replicaAvailabilityZones: ['replicaAvailabilityZones'],
  replicaCount: 123,
  slots: 'slots',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticache as elasticache

node_group_configuration_property = elasticache.CfnReplicationGroup.NodeGroupConfigurationProperty(
    node_group_id="nodeGroupId",
    primary_availability_zone="primaryAvailabilityZone",
    replica_availability_zones=["replicaAvailabilityZones"],
    replica_count=123,
    slots="slots"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticache.*;

NodeGroupConfigurationProperty nodeGroupConfigurationProperty = NodeGroupConfigurationProperty.builder()
        .nodeGroupId("nodeGroupId")
        .primaryAvailabilityZone("primaryAvailabilityZone")
        .replicaAvailabilityZones(List.of("replicaAvailabilityZones"))
        .replicaCount(123)
        .slots("slots")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElastiCache;

var nodeGroupConfigurationProperty = new NodeGroupConfigurationProperty {
    NodeGroupId = "nodeGroupId",
    PrimaryAvailabilityZone = "primaryAvailabilityZone",
    ReplicaAvailabilityZones = new [] { "replicaAvailabilityZones" },
    ReplicaCount = 123,
    Slots = "slots"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

nodeGroupConfigurationProperty := &NodeGroupConfigurationProperty{
	NodeGroupId: jsii.String("nodeGroupId"),
	PrimaryAvailabilityZone: jsii.String("primaryAvailabilityZone"),
	ReplicaAvailabilityZones: []*string{
		jsii.String("replicaAvailabilityZones"),
	},
	ReplicaCount: jsii.Number(123),
	Slots: jsii.String("slots"),
}
```

## Properties

- `nodeGroupId`: string — Either the ElastiCache supplied 4-digit id or a user supplied id for the node group these configuration values apply to.

- `primaryAvailabilityZone`: string — The Availability Zone where the primary node of this node group (shard) is launched.

- `replicaAvailabilityZones`: string[] — A list of Availability Zones to be used for the read replicas.

  The number of Availability Zones in this list must match the value of `ReplicaCount` or `ReplicasPerNodeGroup` if not specified.

- `replicaCount`: number — The number of read replica nodes in this node group (shard).

- `slots`: string — A string of comma-separated values where the first set of values are the slot numbers (zero based), and the second set of values are the keyspaces for each slot.

  The following example specifies three slots (numbered 0, 1, and 2): `0,1,2,0-4999,5000-9999,10000-16,383` .

  If you don't specify a value, ElastiCache allocates keys equally among each slot.

  When you use an `UseOnlineResharding` update policy to update the number of node groups without interruption, ElastiCache evenly distributes the keyspaces between the specified number of slots. This cannot be updated later. Therefore, after updating the number of node groups in this way, you should remove the value specified for the `Slots` property of each `NodeGroupConfiguration` from the stack template, as it no longer reflects the actual values in each node group. For more information, see [UseOnlineResharding Policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-useonlineresharding) .
