# CfnComputeNodeGroupProps

Properties for defining a `CfnComputeNodeGroup`.

Extends: CfnComputeNodeGroupProps
Used as props by: CfnComputeNodeGroup

- Source: Generated code
- Type last changed: v2.274.0 · 20 Oct 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_pcs as pcs } from 'aws-cdk-lib';
const cfnComputeNodeGroupProps: pcs.CfnComputeNodeGroupProps = {
  clusterId: 'clusterId',
  iamInstanceProfileArn: 'iamInstanceProfileArn',
  instanceConfigs: [{
    instanceType: 'instanceType',
  }],
  scalingConfiguration: {
    maxInstanceCount: 123,
    minInstanceCount: 123,
  },
  subnetIds: ['subnetIds'],

  // the properties below are optional
  amiId: 'amiId',
  customLaunchTemplate: {
    version: 'version',

    // the properties below are optional
    templateId: 'templateId',
  },
  name: 'name',
  nodeLifecycleActions: {
    stages: {
      nodeBootstrapped: [{
        name: 'name',
        scriptSource: {
          scriptLocation: 'scriptLocation',

          // the properties below are optional
          checksum: 'checksum',
          s3VersionId: 's3VersionId',
        },

        // the properties below are optional
        arguments: ['arguments'],
        executionPolicy: 'executionPolicy',
        onError: 'onError',
      }],
      nodeReady: [{
        name: 'name',
        scriptSource: {
          scriptLocation: 'scriptLocation',

          // the properties below are optional
          checksum: 'checksum',
          s3VersionId: 's3VersionId',
        },

        // the properties below are optional
        arguments: ['arguments'],
        executionPolicy: 'executionPolicy',
        onError: 'onError',
      }],
    },

    // the properties below are optional
    scriptCachingPolicy: 'scriptCachingPolicy',
  },
  purchaseOption: 'purchaseOption',
  slurmConfiguration: {
    gresCustomSettings: [{
      gresCustomSettingsKey: 'gresCustomSettings',
    }],
    scaleDownIdleTimeInSeconds: 123,
    slurmCustomSettings: [{
      parameterName: 'parameterName',
      parameterValue: 'parameterValue',
    }],
  },
  spotOptions: {
    allocationStrategy: 'allocationStrategy',
  },
  tags: {
    tagsKey: 'tags',
  },
};
```

## Properties

- `amiId`: string — The ID of the Amazon Machine Image (AMI) that AWS PCS uses to launch instances.

  If not provided, AWS PCS uses the AMI ID specified in the custom launch template.

- `clusterId`: string (required) — The ID of the cluster of the compute node group.

- `customLaunchTemplate`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnComputeNodeGroup.CustomLaunchTemplateProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_pcs.CfnComputeNodeGroup.CustomLaunchTemplateProperty.html) — An Amazon EC2 launch template AWS PCS uses to launch compute nodes.

- `iamInstanceProfileArn`: string (required) — The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances.

  The role contained in your instance profile must have the `pcs:RegisterComputeNodeGroupInstance` permission and the role name must start with `AWSPCS` or must have the path `/aws-pcs/` . For more information, see [IAM instance profiles for AWS PCS](https://docs.aws.amazon.com//pcs/latest/userguide/security-instance-profiles.html) in the *AWS PCS User Guide* .

- `instanceConfigs`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnComputeNodeGroup.InstanceConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_pcs.CfnComputeNodeGroup.InstanceConfigProperty.html)[] (required) — A list of EC2 instance configurations that AWS PCS can provision in the compute node group.

- `name`: string — The name that identifies the compute node group.

- `nodeLifecycleActions`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnComputeNodeGroup.NodeLifecycleActionsProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_pcs.CfnComputeNodeGroup.NodeLifecycleActionsProperty.html) — Custom scripts that run at defined points in a compute node's lifecycle.

- `purchaseOption`: string — Specifies how EC2 instances are purchased on your behalf.

  AWS PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see [Amazon EC2 billing and purchasing options](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-purchasing-options.html) in the *Amazon Elastic Compute Cloud User Guide* . For more information about AWS PCS support for Capacity Blocks, see [Using Amazon EC2 Capacity Blocks for ML with AWS PCS](https://docs.aws.amazon.com/pcs/latest/userguide/capacity-blocks.html) in the *AWS PCS User Guide* . If you don't provide this option, it defaults to On-Demand.

- `scalingConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnComputeNodeGroup.ScalingConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_pcs.CfnComputeNodeGroup.ScalingConfigurationProperty.html) (required) — Specifies the boundaries of the compute node group auto scaling.

- `slurmConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnComputeNodeGroup.SlurmConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_pcs.CfnComputeNodeGroup.SlurmConfigurationProperty.html) — Additional options related to the Slurm scheduler.

- `spotOptions`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnComputeNodeGroup.SpotOptionsProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_pcs.CfnComputeNodeGroup.SpotOptionsProperty.html) — Additional configuration when you specify `SPOT` as the `purchaseOption` for the `CreateComputeNodeGroup` API action.

- `subnetIds`: string[] (required) — The list of subnet IDs where instances are provisioned by the compute node group.

  The subnets must be in the same VPC as the cluster.

- `tags`: { [key: string]: string } — 1 or more tags added to the resource.

  Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.
