Skip to content
v2.278.0

CfnComputeNodeGroupProps Struct ​

Properties for defining a CfnComputeNodeGroup.

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: {
    templateId: 'templateId',
    version: 'version',
  },
  launchTemplateMode: 'launchTemplateMode',
  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',
  securityGroupIds: ['securityGroupIds'],
  slurmConfiguration: {
    gresCustomSettings: [{
      gresCustomSettingsKey: 'gresCustomSettings',
    }],
    scaleDownIdleTimeInSeconds: 123,
    slurmCustomSettings: [{
      parameterName: 'parameterName',
      parameterValue: 'parameterValue',
    }],
  },
  spotOptions: {
    allocationStrategy: 'allocationStrategy',
  },
  sshKeyName: 'sshKeyName',
  tags: {
    tagsKey: 'tags',
  },
};
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_pcs as pcs

cfn_compute_node_group_props = pcs.CfnComputeNodeGroupProps(
    cluster_id="clusterId",
    iam_instance_profile_arn="iamInstanceProfileArn",
    instance_configs=[pcs.CfnComputeNodeGroup.InstanceConfigProperty(
        instance_type="instanceType"
    )],
    scaling_configuration=pcs.CfnComputeNodeGroup.ScalingConfigurationProperty(
        max_instance_count=123,
        min_instance_count=123
    ),
    subnet_ids=["subnetIds"],

    # the properties below are optional
    ami_id="amiId",
    custom_launch_template=pcs.CfnComputeNodeGroup.CustomLaunchTemplateProperty(
        template_id="templateId",
        version="version"
    ),
    launch_template_mode="launchTemplateMode",
    name="name",
    node_lifecycle_actions=pcs.CfnComputeNodeGroup.NodeLifecycleActionsProperty(
        stages=pcs.CfnComputeNodeGroup.NodeLifecycleStagesProperty(
            node_bootstrapped=[pcs.CfnComputeNodeGroup.NodeLifecycleScriptProperty(
                name="name",
                script_source=pcs.CfnComputeNodeGroup.ScriptSourceProperty(
                    script_location="scriptLocation",

                    # the properties below are optional
                    checksum="checksum",
                    s3_version_id="s3VersionId"
                ),

                # the properties below are optional
                arguments=["arguments"],
                execution_policy="executionPolicy",
                on_error="onError"
            )],
            node_ready=[pcs.CfnComputeNodeGroup.NodeLifecycleScriptProperty(
                name="name",
                script_source=pcs.CfnComputeNodeGroup.ScriptSourceProperty(
                    script_location="scriptLocation",

                    # the properties below are optional
                    checksum="checksum",
                    s3_version_id="s3VersionId"
                ),

                # the properties below are optional
                arguments=["arguments"],
                execution_policy="executionPolicy",
                on_error="onError"
            )]
        ),

        # the properties below are optional
        script_caching_policy="scriptCachingPolicy"
    ),
    purchase_option="purchaseOption",
    security_group_ids=["securityGroupIds"],
    slurm_configuration=pcs.CfnComputeNodeGroup.SlurmConfigurationProperty(
        gres_custom_settings=[{
            "gres_custom_settings_key": "gresCustomSettings"
        }],
        scale_down_idle_time_in_seconds=123,
        slurm_custom_settings=[pcs.CfnComputeNodeGroup.SlurmCustomSettingProperty(
            parameter_name="parameterName",
            parameter_value="parameterValue"
        )]
    ),
    spot_options=pcs.CfnComputeNodeGroup.SpotOptionsProperty(
        allocation_strategy="allocationStrategy"
    ),
    ssh_key_name="sshKeyName",
    tags={
        "tags_key": "tags"
    }
)
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.pcs.*;

CfnComputeNodeGroupProps cfnComputeNodeGroupProps = CfnComputeNodeGroupProps.builder()
        .clusterId("clusterId")
        .iamInstanceProfileArn("iamInstanceProfileArn")
        .instanceConfigs(List.of(InstanceConfigProperty.builder()
                .instanceType("instanceType")
                .build()))
        .scalingConfiguration(ScalingConfigurationProperty.builder()
                .maxInstanceCount(123)
                .minInstanceCount(123)
                .build())
        .subnetIds(List.of("subnetIds"))

        // the properties below are optional
        .amiId("amiId")
        .customLaunchTemplate(CustomLaunchTemplateProperty.builder()
                .templateId("templateId")
                .version("version")
                .build())
        .launchTemplateMode("launchTemplateMode")
        .name("name")
        .nodeLifecycleActions(NodeLifecycleActionsProperty.builder()
                .stages(NodeLifecycleStagesProperty.builder()
                        .nodeBootstrapped(List.of(NodeLifecycleScriptProperty.builder()
                                .name("name")
                                .scriptSource(ScriptSourceProperty.builder()
                                        .scriptLocation("scriptLocation")

                                        // the properties below are optional
                                        .checksum("checksum")
                                        .s3VersionId("s3VersionId")
                                        .build())

                                // the properties below are optional
                                .arguments(List.of("arguments"))
                                .executionPolicy("executionPolicy")
                                .onError("onError")
                                .build()))
                        .nodeReady(List.of(NodeLifecycleScriptProperty.builder()
                                .name("name")
                                .scriptSource(ScriptSourceProperty.builder()
                                        .scriptLocation("scriptLocation")

                                        // the properties below are optional
                                        .checksum("checksum")
                                        .s3VersionId("s3VersionId")
                                        .build())

                                // the properties below are optional
                                .arguments(List.of("arguments"))
                                .executionPolicy("executionPolicy")
                                .onError("onError")
                                .build()))
                        .build())

                // the properties below are optional
                .scriptCachingPolicy("scriptCachingPolicy")
                .build())
        .purchaseOption("purchaseOption")
        .securityGroupIds(List.of("securityGroupIds"))
        .slurmConfiguration(SlurmConfigurationProperty.builder()
                .gresCustomSettings(List.of(Map.of(
                        "gresCustomSettingsKey", "gresCustomSettings")))
                .scaleDownIdleTimeInSeconds(123)
                .slurmCustomSettings(List.of(SlurmCustomSettingProperty.builder()
                        .parameterName("parameterName")
                        .parameterValue("parameterValue")
                        .build()))
                .build())
        .spotOptions(SpotOptionsProperty.builder()
                .allocationStrategy("allocationStrategy")
                .build())
        .sshKeyName("sshKeyName")
        .tags(Map.of(
                "tagsKey", "tags"))
        .build();
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.PCS;

var cfnComputeNodeGroupProps = new CfnComputeNodeGroupProps {
    ClusterId = "clusterId",
    IamInstanceProfileArn = "iamInstanceProfileArn",
    InstanceConfigs = new [] { new InstanceConfigProperty {
        InstanceType = "instanceType"
    } },
    ScalingConfiguration = new ScalingConfigurationProperty {
        MaxInstanceCount = 123,
        MinInstanceCount = 123
    },
    SubnetIds = new [] { "subnetIds" },

    // the properties below are optional
    AmiId = "amiId",
    CustomLaunchTemplate = new CustomLaunchTemplateProperty {
        TemplateId = "templateId",
        Version = "version"
    },
    LaunchTemplateMode = "launchTemplateMode",
    Name = "name",
    NodeLifecycleActions = new NodeLifecycleActionsProperty {
        Stages = new NodeLifecycleStagesProperty {
            NodeBootstrapped = new [] { new NodeLifecycleScriptProperty {
                Name = "name",
                ScriptSource = new ScriptSourceProperty {
                    ScriptLocation = "scriptLocation",

                    // the properties below are optional
                    Checksum = "checksum",
                    S3VersionId = "s3VersionId"
                },

                // the properties below are optional
                Arguments = new [] { "arguments" },
                ExecutionPolicy = "executionPolicy",
                OnError = "onError"
            } },
            NodeReady = new [] { new NodeLifecycleScriptProperty {
                Name = "name",
                ScriptSource = new ScriptSourceProperty {
                    ScriptLocation = "scriptLocation",

                    // the properties below are optional
                    Checksum = "checksum",
                    S3VersionId = "s3VersionId"
                },

                // the properties below are optional
                Arguments = new [] { "arguments" },
                ExecutionPolicy = "executionPolicy",
                OnError = "onError"
            } }
        },

        // the properties below are optional
        ScriptCachingPolicy = "scriptCachingPolicy"
    },
    PurchaseOption = "purchaseOption",
    SecurityGroupIds = new [] { "securityGroupIds" },
    SlurmConfiguration = new SlurmConfigurationProperty {
        GresCustomSettings = new [] { new Dictionary<string, string> {
            { "gresCustomSettingsKey", "gresCustomSettings" }
        } },
        ScaleDownIdleTimeInSeconds = 123,
        SlurmCustomSettings = new [] { new SlurmCustomSettingProperty {
            ParameterName = "parameterName",
            ParameterValue = "parameterValue"
        } }
    },
    SpotOptions = new SpotOptionsProperty {
        AllocationStrategy = "allocationStrategy"
    },
    SshKeyName = "sshKeyName",
    Tags = new Dictionary<string, string> {
        { "tagsKey", "tags" }
    }
};
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"

cfnComputeNodeGroupProps := &CfnComputeNodeGroupProps{
	ClusterId: jsii.String("clusterId"),
	IamInstanceProfileArn: jsii.String("iamInstanceProfileArn"),
	InstanceConfigs: []interface{}{
		&InstanceConfigProperty{
			InstanceType: jsii.String("instanceType"),
		},
	},
	ScalingConfiguration: &ScalingConfigurationProperty{
		MaxInstanceCount: jsii.Number(123),
		MinInstanceCount: jsii.Number(123),
	},
	SubnetIds: []*string{
		jsii.String("subnetIds"),
	},

	// the properties below are optional
	AmiId: jsii.String("amiId"),
	CustomLaunchTemplate: &CustomLaunchTemplateProperty{
		TemplateId: jsii.String("templateId"),
		Version: jsii.String("version"),
	},
	LaunchTemplateMode: jsii.String("launchTemplateMode"),
	Name: jsii.String("name"),
	NodeLifecycleActions: &NodeLifecycleActionsProperty{
		Stages: &NodeLifecycleStagesProperty{
			NodeBootstrapped: []interface{}{
				&NodeLifecycleScriptProperty{
					Name: jsii.String("name"),
					ScriptSource: &ScriptSourceProperty{
						ScriptLocation: jsii.String("scriptLocation"),

						// the properties below are optional
						Checksum: jsii.String("checksum"),
						S3VersionId: jsii.String("s3VersionId"),
					},

					// the properties below are optional
					Arguments: []*string{
						jsii.String("arguments"),
					},
					ExecutionPolicy: jsii.String("executionPolicy"),
					OnError: jsii.String("onError"),
				},
			},
			NodeReady: []interface{}{
				&NodeLifecycleScriptProperty{
					Name: jsii.String("name"),
					ScriptSource: &ScriptSourceProperty{
						ScriptLocation: jsii.String("scriptLocation"),

						// the properties below are optional
						Checksum: jsii.String("checksum"),
						S3VersionId: jsii.String("s3VersionId"),
					},

					// the properties below are optional
					Arguments: []*string{
						jsii.String("arguments"),
					},
					ExecutionPolicy: jsii.String("executionPolicy"),
					OnError: jsii.String("onError"),
				},
			},
		},

		// the properties below are optional
		ScriptCachingPolicy: jsii.String("scriptCachingPolicy"),
	},
	PurchaseOption: jsii.String("purchaseOption"),
	SecurityGroupIds: []*string{
		jsii.String("securityGroupIds"),
	},
	SlurmConfiguration: &SlurmConfigurationProperty{
		GresCustomSettings: []interface{}{
			map[string]*string{
				"gresCustomSettingsKey": jsii.String("gresCustomSettings"),
			},
		},
		ScaleDownIdleTimeInSeconds: jsii.Number(123),
		SlurmCustomSettings: []interface{}{
			&SlurmCustomSettingProperty{
				ParameterName: jsii.String("parameterName"),
				ParameterValue: jsii.String("parameterValue"),
			},
		},
	},
	SpotOptions: &SpotOptionsProperty{
		AllocationStrategy: jsii.String("allocationStrategy"),
	},
	SshKeyName: jsii.String("sshKeyName"),
	Tags: map[string]*string{
		"tagsKey": jsii.String("tags"),
	},
}

Properties ​

amiIdoptionalstringami_idoptionalstramiIdoptionalStringAmiIdoptionalstringAmiIdoptional*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.

clusterIdstringcluster_idstrclusterIdStringClusterIdstringClusterId*string required #
The ID of the cluster of the compute node group.
customLaunchTemplateoptionalIResolvable | CfnComputeNodeGroup.CustomLaunchTemplatePropertycustom_launch_templateoptionaltyping.Union[IResolvable, CustomLaunchTemplateProperty]customLaunchTemplateoptionalIResolvableCustomLaunchTemplateoptionalIResolvableCustomLaunchTemplateoptionalinterface{} #
An Amazon EC2 launch template AWS PCS uses to launch compute nodes.
iamInstanceProfileArnstringiam_instance_profile_arnstriamInstanceProfileArnStringIamInstanceProfileArnstringIamInstanceProfileArn*string required #
The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances.
notes

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 in the AWS PCS User Guide .

instanceConfigsIResolvable | IResolvable | CfnComputeNodeGroup.InstanceConfigProperty[]instance_configstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, InstanceConfigProperty]]]instanceConfigsIResolvableInstanceConfigsIResolvableInstanceConfigsinterface{} required #
A list of EC2 instance configurations that AWS PCS can provision in the compute node group.
launchTemplateModeoptionalstringlaunch_template_modeoptionalstrlaunchTemplateModeoptionalStringLaunchTemplateModeoptionalstringLaunchTemplateModeoptional*string #
How AWS PCS gets the launch template for the compute node group.

CUSTOM uses CustomLaunchTemplate. MANAGED has AWS PCS generate and manage the launch template from the instance settings; omit CustomLaunchTemplate. Defaults to CUSTOM on create.

nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string #
The name that identifies the compute node group.
nodeLifecycleActionsoptionalIResolvable | CfnComputeNodeGroup.NodeLifecycleActionsPropertynode_lifecycle_actionsoptionaltyping.Union[IResolvable, NodeLifecycleActionsProperty]nodeLifecycleActionsoptionalIResolvableNodeLifecycleActionsoptionalIResolvableNodeLifecycleActionsoptionalinterface{} #
Custom scripts that run at defined points in a compute node's lifecycle.
purchaseOptionoptionalstringpurchase_optionoptionalstrpurchaseOptionoptionalStringPurchaseOptionoptionalstringPurchaseOptionoptional*string #
Specifies how EC2 instances are purchased on your behalf.
notes

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 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 in the AWS PCS User Guide . If you don't provide this option, it defaults to On-Demand.

scalingConfigurationIResolvable | CfnComputeNodeGroup.ScalingConfigurationPropertyscaling_configurationtyping.Union[IResolvable, ScalingConfigurationProperty]scalingConfigurationIResolvableScalingConfigurationIResolvableScalingConfigurationinterface{} required #
Specifies the boundaries of the compute node group auto scaling.
securityGroupIdsoptionalstring[]security_group_idsoptionaltyping.List[str]securityGroupIdsoptionalList<String>SecurityGroupIdsoptionalstring[]SecurityGroupIdsoptional*[]*string #
The IDs of the EC2 security groups configured directly on the compute node group.
notes

These replace the security groups from the custom launch template. A request cannot specify this property with a launch template that defines NetworkInterfaces. When not provided and a custom launch template is present, AWS PCS uses the security groups from the launch template.

slurmConfigurationoptionalIResolvable | CfnComputeNodeGroup.SlurmConfigurationPropertyslurm_configurationoptionaltyping.Union[IResolvable, SlurmConfigurationProperty]slurmConfigurationoptionalIResolvableSlurmConfigurationoptionalIResolvableSlurmConfigurationoptionalinterface{} #
Additional options related to the Slurm scheduler.
spotOptionsoptionalIResolvable | CfnComputeNodeGroup.SpotOptionsPropertyspot_optionsoptionaltyping.Union[IResolvable, SpotOptionsProperty]spotOptionsoptionalIResolvableSpotOptionsoptionalIResolvableSpotOptionsoptionalinterface{} #
Additional configuration when you specify `SPOT` as the `purchaseOption` for the `CreateComputeNodeGroup` API action.
sshKeyNameoptionalstringssh_key_nameoptionalstrsshKeyNameoptionalStringSshKeyNameoptionalstringSshKeyNameoptional*string #
The name of the EC2 key pair configured directly on the compute node group.

The key pair must exist in the caller's account and Region and overrides the key pair from the custom launch template. When not provided and a custom launch template is present, AWS PCS uses the key pair from the launch template.

subnetIdsstring[]subnet_idstyping.List[str]subnetIdsList<String>SubnetIdsstring[]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.

tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[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.