AWS Parallel Computing Service

2026/07/22 - AWS Parallel Computing Service - 4 updated api methods

Changes  AWS PCS Node Lifecycle Actions provides a structured way to run custom scripts at defined points in a compute node's lifecycle directly through the AWS PCS compute node group API.

CreateComputeNodeGroup (updated) Link ¶
Changes (request, response)
Request
{'nodeLifecycleActions': {'scriptCachingPolicy': 'CACHE_ONCE | '
                                                 'REFRESH_ON_REBOOT',
                          'stages': {'nodeBootstrapped': [{'arguments': ['string'],
                                                           'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                              '| '
                                                                              'EVERY_BOOT',
                                                           'name': 'string',
                                                           'onError': 'TERMINATE '
                                                                      '| '
                                                                      'STOP_SEQUENCE '
                                                                      '| '
                                                                      'CONTINUE',
                                                           'scriptSource': {'checksum': 'string',
                                                                            's3VersionId': 'string',
                                                                            'scriptLocation': 'string'}}],
                                     'nodeReady': [{'arguments': ['string'],
                                                    'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                       '| '
                                                                       'EVERY_BOOT',
                                                    'name': 'string',
                                                    'onError': 'TERMINATE | '
                                                               'STOP_SEQUENCE '
                                                               '| CONTINUE',
                                                    'scriptSource': {'checksum': 'string',
                                                                     's3VersionId': 'string',
                                                                     'scriptLocation': 'string'}}]}}}
Response
{'computeNodeGroup': {'nodeLifecycleActions': {'scriptCachingPolicy': 'CACHE_ONCE '
                                                                      '| '
                                                                      'REFRESH_ON_REBOOT',
                                               'stages': {'nodeBootstrapped': [{'arguments': ['string'],
                                                                                'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                                                   '| '
                                                                                                   'EVERY_BOOT',
                                                                                'name': 'string',
                                                                                'onError': 'TERMINATE '
                                                                                           '| '
                                                                                           'STOP_SEQUENCE '
                                                                                           '| '
                                                                                           'CONTINUE',
                                                                                'scriptSource': {'checksum': 'string',
                                                                                                 's3VersionId': 'string',
                                                                                                 'scriptLocation': 'string'}}],
                                                          'nodeReady': [{'arguments': ['string'],
                                                                         'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                                            '| '
                                                                                            'EVERY_BOOT',
                                                                         'name': 'string',
                                                                         'onError': 'TERMINATE '
                                                                                    '| '
                                                                                    'STOP_SEQUENCE '
                                                                                    '| '
                                                                                    'CONTINUE',
                                                                         'scriptSource': {'checksum': 'string',
                                                                                          's3VersionId': 'string',
                                                                                          'scriptLocation': 'string'}}]}}}}

Creates a managed set of compute nodes. You associate a compute node group with a cluster through 1 or more PCS queues or as part of the login fleet. A compute node group includes the definition of the compute properties and lifecycle management. PCS uses the information you provide to this API action to launch compute nodes in your account. You can only specify subnets in the same Amazon VPC as your cluster. You receive billing charges for the compute nodes that PCS launches in your account. You must already have a launch template before you call this API. For more information, see Launch an instance from a launch template in the Amazon Elastic Compute Cloud User Guide for Linux Instances.

See also: AWS API Documentation

Request Syntax

client.create_compute_node_group(
    clusterIdentifier='string',
    computeNodeGroupName='string',
    amiId='string',
    subnetIds=[
        'string',
    ],
    purchaseOption='ONDEMAND'|'SPOT'|'CAPACITY_BLOCK'|'INTERRUPTIBLE_CAPACITY_RESERVATION',
    customLaunchTemplate={
        'id': 'string',
        'version': 'string'
    },
    iamInstanceProfileArn='string',
    scalingConfiguration={
        'minInstanceCount': 123,
        'maxInstanceCount': 123
    },
    instanceConfigs=[
        {
            'instanceType': 'string'
        },
    ],
    spotOptions={
        'allocationStrategy': 'lowest-price'|'capacity-optimized'|'price-capacity-optimized'
    },
    slurmConfiguration={
        'scaleDownIdleTimeInSeconds': 123,
        'slurmCustomSettings': [
            {
                'parameterName': 'string',
                'parameterValue': 'string'
            },
        ]
    },
    nodeLifecycleActions={
        'stages': {
            'nodeBootstrapped': [
                {
                    'name': 'string',
                    'scriptSource': {
                        'scriptLocation': 'string',
                        's3VersionId': 'string',
                        'checksum': 'string'
                    },
                    'arguments': [
                        'string',
                    ],
                    'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                    'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                },
            ],
            'nodeReady': [
                {
                    'name': 'string',
                    'scriptSource': {
                        'scriptLocation': 'string',
                        's3VersionId': 'string',
                        'checksum': 'string'
                    },
                    'arguments': [
                        'string',
                    ],
                    'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                    'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                },
            ]
        },
        'scriptCachingPolicy': 'CACHE_ONCE'|'REFRESH_ON_REBOOT'
    },
    clientToken='string',
    tags={
        'string': 'string'
    }
)
type clusterIdentifier:

string

param clusterIdentifier:

[REQUIRED]

The name or ID of the cluster to create a compute node group in.

type computeNodeGroupName:

string

param computeNodeGroupName:

[REQUIRED]

A name to identify the cluster. Example: MyCluster

type amiId:

string

param amiId:

The ID of the Amazon Machine Image (AMI) that PCS uses to launch compute nodes (Amazon EC2 instances). If you don't provide this value, PCS uses the AMI ID specified in the custom launch template.

type subnetIds:

list

param subnetIds:

[REQUIRED]

The list of subnet IDs where the compute node group launches instances. Subnets must be in the same VPC as the cluster.

  • (string) --

type purchaseOption:

string

param purchaseOption:

Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, Interruptible Capacity Reservations, On-Demand Capacity Reservations, 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 PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. For more information about PCS support for interruptible capacity reservations, see Using I-ODCRs with PCS in the PCS User Guide. Choose On-Demand if you plan to use an On-Demand Capacity Reservation (ODCR). For more information, see Using ODCRs with PCS. If you don't provide this option, it defaults to On-Demand.

type customLaunchTemplate:

dict

param customLaunchTemplate:

[REQUIRED]

An Amazon EC2 launch template PCS uses to launch compute nodes.

  • id (string) -- [REQUIRED]

    The ID of the EC2 launch template to use to provision instances.

    Example: lt-xxxx

  • version (string) -- [REQUIRED]

    The version of the EC2 launch template to use to provision instances.

type iamInstanceProfileArn:

string

param iamInstanceProfileArn:

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

type scalingConfiguration:

dict

param scalingConfiguration:

[REQUIRED]

Specifies the boundaries of the compute node group auto scaling.

  • minInstanceCount (integer) -- [REQUIRED]

    The lower bound of the number of instances allowed in the compute fleet.

  • maxInstanceCount (integer) -- [REQUIRED]

    The upper bound of the number of instances allowed in the compute fleet.

type instanceConfigs:

list

param instanceConfigs:

[REQUIRED]

A list of EC2 instance configurations that PCS can provision in the compute node group.

  • (dict) --

    An EC2 instance configuration PCS uses to launch compute nodes.

    • instanceType (string) --

      The EC2 instance type that PCS can provision in the compute node group.

      Example: t2.xlarge

type spotOptions:

dict

param spotOptions:

Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action.

type slurmConfiguration:

dict

param slurmConfiguration:

Additional options related to the Slurm scheduler.

  • scaleDownIdleTimeInSeconds (integer) --

    The time (in seconds) before an idle node is scaled down. If not specified, the cluster-level setting applies. This overrides the cluster-level scaleDownIdleTimeInSeconds setting. A value of -1 removes the override and applies the cluster-level setting to this compute node group. Requires Slurm version 25.11 or later.

  • slurmCustomSettings (list) --

    Additional Slurm-specific configuration that directly maps to Slurm settings.

    • (dict) --

      Additional settings that directly map to Slurm settings.

      • parameterName (string) -- [REQUIRED]

        PCS supports custom Slurm settings for clusters, compute node groups, and queues. For more information, see Configuring custom Slurm settings in PCS in the PCS User Guide.

      • parameterValue (string) -- [REQUIRED]

        The values for the configured Slurm settings.

type nodeLifecycleActions:

dict

param nodeLifecycleActions:

The lifecycle actions to run on compute nodes in the compute node group. Use lifecycle actions to run custom scripts at defined stages of a compute node's lifecycle, such as when a compute node finishes bootstrapping or becomes ready to accept jobs.

  • stages (dict) -- [REQUIRED]

    The lifecycle stages where you configure scripts to run.

    • nodeBootstrapped (list) --

      The scripts to run after PCS finishes setting up the compute node and before the Slurm daemon ( slurmd) starts. Use this stage for tasks that must complete before the node accepts jobs, such as mounting shared storage, configuring networking, or installing software packages.

      • (dict) --

        A script to run during a compute node lifecycle stage.

        • name (string) -- [REQUIRED]

          A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

        • scriptSource (dict) -- [REQUIRED]

          The source location and integrity information for the script.

          • scriptLocation (string) -- [REQUIRED]

            The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

          • s3VersionId (string) --

            The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

          • checksum (string) --

            The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

        • arguments (list) --

          The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

          • (string) --

        • onError (string) --

          The behavior when the script fails. The default value is TERMINATE. Valid values:

          • TERMINATE – Terminates the compute node.

          • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

          • CONTINUE – Ignores the error and continues running the next script.

        • executionPolicy (string) --

          The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

          • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

          • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

    • nodeReady (list) --

      The scripts to run after the Slurm daemon ( slurmd) starts and the compute node registers with the Slurm controller. Use this stage for tasks that require Slurm to be running, such as running Slurm commands.

      • (dict) --

        A script to run during a compute node lifecycle stage.

        • name (string) -- [REQUIRED]

          A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

        • scriptSource (dict) -- [REQUIRED]

          The source location and integrity information for the script.

          • scriptLocation (string) -- [REQUIRED]

            The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

          • s3VersionId (string) --

            The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

          • checksum (string) --

            The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

        • arguments (list) --

          The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

          • (string) --

        • onError (string) --

          The behavior when the script fails. The default value is TERMINATE. Valid values:

          • TERMINATE – Terminates the compute node.

          • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

          • CONTINUE – Ignores the error and continues running the next script.

        • executionPolicy (string) --

          The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

          • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

          • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

  • scriptCachingPolicy (string) --

    The caching policy for node lifecycle scripts. The default value is CACHE_ONCE. Valid values:

    • CACHE_ONCE – Downloads each script once and reuses it on subsequent boots.

    • REFRESH_ON_REBOOT – Downloads each script on every boot.

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.

This field is autopopulated if not provided.

type tags:

dict

param tags:

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.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'computeNodeGroup': {
        'name': 'string',
        'id': 'string',
        'arn': 'string',
        'clusterId': 'string',
        'createdAt': datetime(2015, 1, 1),
        'modifiedAt': datetime(2015, 1, 1),
        'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATE_FAILED'|'DELETE_FAILED'|'UPDATE_FAILED'|'DELETED'|'SUSPENDING'|'SUSPENDED'|'RESUMING',
        'amiId': 'string',
        'subnetIds': [
            'string',
        ],
        'purchaseOption': 'ONDEMAND'|'SPOT'|'CAPACITY_BLOCK'|'INTERRUPTIBLE_CAPACITY_RESERVATION',
        'customLaunchTemplate': {
            'id': 'string',
            'version': 'string'
        },
        'iamInstanceProfileArn': 'string',
        'scalingConfiguration': {
            'minInstanceCount': 123,
            'maxInstanceCount': 123
        },
        'instanceConfigs': [
            {
                'instanceType': 'string'
            },
        ],
        'spotOptions': {
            'allocationStrategy': 'lowest-price'|'capacity-optimized'|'price-capacity-optimized'
        },
        'slurmConfiguration': {
            'scaleDownIdleTimeInSeconds': 123,
            'slurmCustomSettings': [
                {
                    'parameterName': 'string',
                    'parameterValue': 'string'
                },
            ]
        },
        'nodeLifecycleActions': {
            'stages': {
                'nodeBootstrapped': [
                    {
                        'name': 'string',
                        'scriptSource': {
                            'scriptLocation': 'string',
                            's3VersionId': 'string',
                            'checksum': 'string'
                        },
                        'arguments': [
                            'string',
                        ],
                        'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                        'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                    },
                ],
                'nodeReady': [
                    {
                        'name': 'string',
                        'scriptSource': {
                            'scriptLocation': 'string',
                            's3VersionId': 'string',
                            'checksum': 'string'
                        },
                        'arguments': [
                            'string',
                        ],
                        'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                        'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                    },
                ]
            },
            'scriptCachingPolicy': 'CACHE_ONCE'|'REFRESH_ON_REBOOT'
        },
        'errorInfo': [
            {
                'code': 'string',
                'message': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • computeNodeGroup (dict) --

      A compute node group associated with a cluster.

      • name (string) --

        The name that identifies the compute node group.

      • id (string) --

        The generated unique ID of the compute node group.

      • arn (string) --

        The unique Amazon Resource Name (ARN) of the compute node group.

      • clusterId (string) --

        The ID of the cluster of the compute node group.

      • createdAt (datetime) --

        The date and time the resource was created.

      • modifiedAt (datetime) --

        The date and time the resource was modified.

      • status (string) --

        The provisioning status of the compute node group.

      • amiId (string) --

        The ID of the Amazon Machine Image (AMI) that PCS uses to launch instances. If not provided, PCS uses the AMI ID specified in the custom launch template.

      • subnetIds (list) --

        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.

        • (string) --

      • purchaseOption (string) --

        Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, Interruptible Capacity Reservations, On-Demand Capacity Reservations, 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 PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. For more information about PCS support for interruptible capacity reservations, see Using I-ODCRs with PCS in the PCS User Guide. Choose On-Demand if you plan to use an On-Demand Capacity Reservation (ODCR). For more information, see Using ODCRs with PCS. If you don't provide this option, it defaults to On-Demand.

      • customLaunchTemplate (dict) --

        An Amazon EC2 launch template PCS uses to launch compute nodes.

        • id (string) --

          The ID of the EC2 launch template to use to provision instances.

          Example: lt-xxxx

        • version (string) --

          The version of the EC2 launch template to use to provision instances.

      • iamInstanceProfileArn (string) --

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

      • scalingConfiguration (dict) --

        Specifies the boundaries of the compute node group auto scaling.

        • minInstanceCount (integer) --

          The lower bound of the number of instances allowed in the compute fleet.

        • maxInstanceCount (integer) --

          The upper bound of the number of instances allowed in the compute fleet.

      • instanceConfigs (list) --

        A list of EC2 instance configurations that PCS can provision in the compute node group.

        • (dict) --

          An EC2 instance configuration PCS uses to launch compute nodes.

          • instanceType (string) --

            The EC2 instance type that PCS can provision in the compute node group.

            Example: t2.xlarge

      • spotOptions (dict) --

        Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action.

      • slurmConfiguration (dict) --

        Additional options related to the Slurm scheduler.

        • scaleDownIdleTimeInSeconds (integer) --

          The time (in seconds) before an idle node is scaled down. If not specified, the cluster-level setting applies. This overrides the cluster-level scaleDownIdleTimeInSeconds setting. A value of -1 removes the override and applies the cluster-level setting to this compute node group. Requires Slurm version 25.11 or later.

        • slurmCustomSettings (list) --

          Additional Slurm-specific configuration that directly maps to Slurm settings.

          • (dict) --

            Additional settings that directly map to Slurm settings.

            • parameterName (string) --

              PCS supports custom Slurm settings for clusters, compute node groups, and queues. For more information, see Configuring custom Slurm settings in PCS in the PCS User Guide.

            • parameterValue (string) --

              The values for the configured Slurm settings.

      • nodeLifecycleActions (dict) --

        The lifecycle actions to run on compute nodes in the compute node group. Use lifecycle actions to run custom scripts at defined stages of a compute node's lifecycle, such as when a compute node finishes bootstrapping or becomes ready to accept jobs.

        • stages (dict) --

          The lifecycle stages where you configure scripts to run.

          • nodeBootstrapped (list) --

            The scripts to run after PCS finishes setting up the compute node and before the Slurm daemon ( slurmd) starts. Use this stage for tasks that must complete before the node accepts jobs, such as mounting shared storage, configuring networking, or installing software packages.

            • (dict) --

              A script to run during a compute node lifecycle stage.

              • name (string) --

                A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

              • scriptSource (dict) --

                The source location and integrity information for the script.

                • scriptLocation (string) --

                  The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

                • s3VersionId (string) --

                  The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

                • checksum (string) --

                  The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

              • arguments (list) --

                The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

                • (string) --

              • onError (string) --

                The behavior when the script fails. The default value is TERMINATE. Valid values:

                • TERMINATE – Terminates the compute node.

                • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

                • CONTINUE – Ignores the error and continues running the next script.

              • executionPolicy (string) --

                The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

                • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

                • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

          • nodeReady (list) --

            The scripts to run after the Slurm daemon ( slurmd) starts and the compute node registers with the Slurm controller. Use this stage for tasks that require Slurm to be running, such as running Slurm commands.

            • (dict) --

              A script to run during a compute node lifecycle stage.

              • name (string) --

                A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

              • scriptSource (dict) --

                The source location and integrity information for the script.

                • scriptLocation (string) --

                  The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

                • s3VersionId (string) --

                  The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

                • checksum (string) --

                  The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

              • arguments (list) --

                The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

                • (string) --

              • onError (string) --

                The behavior when the script fails. The default value is TERMINATE. Valid values:

                • TERMINATE – Terminates the compute node.

                • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

                • CONTINUE – Ignores the error and continues running the next script.

              • executionPolicy (string) --

                The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

                • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

                • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

        • scriptCachingPolicy (string) --

          The caching policy for node lifecycle scripts. The default value is CACHE_ONCE. Valid values:

          • CACHE_ONCE – Downloads each script once and reuses it on subsequent boots.

          • REFRESH_ON_REBOOT – Downloads each script on every boot.

      • errorInfo (list) --

        The list of errors that occurred during compute node group provisioning.

        • (dict) --

          An error that occurred during resource creation.

          • code (string) --

            The short-form error code.

          • message (string) --

            The detailed error information.

GetComputeNodeGroup (updated) Link ¶
Changes (response)
{'computeNodeGroup': {'nodeLifecycleActions': {'scriptCachingPolicy': 'CACHE_ONCE '
                                                                      '| '
                                                                      'REFRESH_ON_REBOOT',
                                               'stages': {'nodeBootstrapped': [{'arguments': ['string'],
                                                                                'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                                                   '| '
                                                                                                   'EVERY_BOOT',
                                                                                'name': 'string',
                                                                                'onError': 'TERMINATE '
                                                                                           '| '
                                                                                           'STOP_SEQUENCE '
                                                                                           '| '
                                                                                           'CONTINUE',
                                                                                'scriptSource': {'checksum': 'string',
                                                                                                 's3VersionId': 'string',
                                                                                                 'scriptLocation': 'string'}}],
                                                          'nodeReady': [{'arguments': ['string'],
                                                                         'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                                            '| '
                                                                                            'EVERY_BOOT',
                                                                         'name': 'string',
                                                                         'onError': 'TERMINATE '
                                                                                    '| '
                                                                                    'STOP_SEQUENCE '
                                                                                    '| '
                                                                                    'CONTINUE',
                                                                         'scriptSource': {'checksum': 'string',
                                                                                          's3VersionId': 'string',
                                                                                          'scriptLocation': 'string'}}]}}}}

Returns detailed information about a compute node group. This API action provides networking information, EC2 instance type, compute node group status, and scheduler (such as Slurm) configuration.

See also: AWS API Documentation

Request Syntax

client.get_compute_node_group(
    clusterIdentifier='string',
    computeNodeGroupIdentifier='string'
)
type clusterIdentifier:

string

param clusterIdentifier:

[REQUIRED]

The name or ID of the cluster.

type computeNodeGroupIdentifier:

string

param computeNodeGroupIdentifier:

[REQUIRED]

The name or ID of the compute node group.

rtype:

dict

returns:

Response Syntax

{
    'computeNodeGroup': {
        'name': 'string',
        'id': 'string',
        'arn': 'string',
        'clusterId': 'string',
        'createdAt': datetime(2015, 1, 1),
        'modifiedAt': datetime(2015, 1, 1),
        'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATE_FAILED'|'DELETE_FAILED'|'UPDATE_FAILED'|'DELETED'|'SUSPENDING'|'SUSPENDED'|'RESUMING',
        'amiId': 'string',
        'subnetIds': [
            'string',
        ],
        'purchaseOption': 'ONDEMAND'|'SPOT'|'CAPACITY_BLOCK'|'INTERRUPTIBLE_CAPACITY_RESERVATION',
        'customLaunchTemplate': {
            'id': 'string',
            'version': 'string'
        },
        'iamInstanceProfileArn': 'string',
        'scalingConfiguration': {
            'minInstanceCount': 123,
            'maxInstanceCount': 123
        },
        'instanceConfigs': [
            {
                'instanceType': 'string'
            },
        ],
        'spotOptions': {
            'allocationStrategy': 'lowest-price'|'capacity-optimized'|'price-capacity-optimized'
        },
        'slurmConfiguration': {
            'scaleDownIdleTimeInSeconds': 123,
            'slurmCustomSettings': [
                {
                    'parameterName': 'string',
                    'parameterValue': 'string'
                },
            ]
        },
        'nodeLifecycleActions': {
            'stages': {
                'nodeBootstrapped': [
                    {
                        'name': 'string',
                        'scriptSource': {
                            'scriptLocation': 'string',
                            's3VersionId': 'string',
                            'checksum': 'string'
                        },
                        'arguments': [
                            'string',
                        ],
                        'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                        'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                    },
                ],
                'nodeReady': [
                    {
                        'name': 'string',
                        'scriptSource': {
                            'scriptLocation': 'string',
                            's3VersionId': 'string',
                            'checksum': 'string'
                        },
                        'arguments': [
                            'string',
                        ],
                        'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                        'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                    },
                ]
            },
            'scriptCachingPolicy': 'CACHE_ONCE'|'REFRESH_ON_REBOOT'
        },
        'errorInfo': [
            {
                'code': 'string',
                'message': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • computeNodeGroup (dict) --

      A compute node group associated with a cluster.

      • name (string) --

        The name that identifies the compute node group.

      • id (string) --

        The generated unique ID of the compute node group.

      • arn (string) --

        The unique Amazon Resource Name (ARN) of the compute node group.

      • clusterId (string) --

        The ID of the cluster of the compute node group.

      • createdAt (datetime) --

        The date and time the resource was created.

      • modifiedAt (datetime) --

        The date and time the resource was modified.

      • status (string) --

        The provisioning status of the compute node group.

      • amiId (string) --

        The ID of the Amazon Machine Image (AMI) that PCS uses to launch instances. If not provided, PCS uses the AMI ID specified in the custom launch template.

      • subnetIds (list) --

        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.

        • (string) --

      • purchaseOption (string) --

        Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, Interruptible Capacity Reservations, On-Demand Capacity Reservations, 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 PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. For more information about PCS support for interruptible capacity reservations, see Using I-ODCRs with PCS in the PCS User Guide. Choose On-Demand if you plan to use an On-Demand Capacity Reservation (ODCR). For more information, see Using ODCRs with PCS. If you don't provide this option, it defaults to On-Demand.

      • customLaunchTemplate (dict) --

        An Amazon EC2 launch template PCS uses to launch compute nodes.

        • id (string) --

          The ID of the EC2 launch template to use to provision instances.

          Example: lt-xxxx

        • version (string) --

          The version of the EC2 launch template to use to provision instances.

      • iamInstanceProfileArn (string) --

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

      • scalingConfiguration (dict) --

        Specifies the boundaries of the compute node group auto scaling.

        • minInstanceCount (integer) --

          The lower bound of the number of instances allowed in the compute fleet.

        • maxInstanceCount (integer) --

          The upper bound of the number of instances allowed in the compute fleet.

      • instanceConfigs (list) --

        A list of EC2 instance configurations that PCS can provision in the compute node group.

        • (dict) --

          An EC2 instance configuration PCS uses to launch compute nodes.

          • instanceType (string) --

            The EC2 instance type that PCS can provision in the compute node group.

            Example: t2.xlarge

      • spotOptions (dict) --

        Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action.

      • slurmConfiguration (dict) --

        Additional options related to the Slurm scheduler.

        • scaleDownIdleTimeInSeconds (integer) --

          The time (in seconds) before an idle node is scaled down. If not specified, the cluster-level setting applies. This overrides the cluster-level scaleDownIdleTimeInSeconds setting. A value of -1 removes the override and applies the cluster-level setting to this compute node group. Requires Slurm version 25.11 or later.

        • slurmCustomSettings (list) --

          Additional Slurm-specific configuration that directly maps to Slurm settings.

          • (dict) --

            Additional settings that directly map to Slurm settings.

            • parameterName (string) --

              PCS supports custom Slurm settings for clusters, compute node groups, and queues. For more information, see Configuring custom Slurm settings in PCS in the PCS User Guide.

            • parameterValue (string) --

              The values for the configured Slurm settings.

      • nodeLifecycleActions (dict) --

        The lifecycle actions to run on compute nodes in the compute node group. Use lifecycle actions to run custom scripts at defined stages of a compute node's lifecycle, such as when a compute node finishes bootstrapping or becomes ready to accept jobs.

        • stages (dict) --

          The lifecycle stages where you configure scripts to run.

          • nodeBootstrapped (list) --

            The scripts to run after PCS finishes setting up the compute node and before the Slurm daemon ( slurmd) starts. Use this stage for tasks that must complete before the node accepts jobs, such as mounting shared storage, configuring networking, or installing software packages.

            • (dict) --

              A script to run during a compute node lifecycle stage.

              • name (string) --

                A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

              • scriptSource (dict) --

                The source location and integrity information for the script.

                • scriptLocation (string) --

                  The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

                • s3VersionId (string) --

                  The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

                • checksum (string) --

                  The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

              • arguments (list) --

                The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

                • (string) --

              • onError (string) --

                The behavior when the script fails. The default value is TERMINATE. Valid values:

                • TERMINATE – Terminates the compute node.

                • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

                • CONTINUE – Ignores the error and continues running the next script.

              • executionPolicy (string) --

                The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

                • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

                • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

          • nodeReady (list) --

            The scripts to run after the Slurm daemon ( slurmd) starts and the compute node registers with the Slurm controller. Use this stage for tasks that require Slurm to be running, such as running Slurm commands.

            • (dict) --

              A script to run during a compute node lifecycle stage.

              • name (string) --

                A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

              • scriptSource (dict) --

                The source location and integrity information for the script.

                • scriptLocation (string) --

                  The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

                • s3VersionId (string) --

                  The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

                • checksum (string) --

                  The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

              • arguments (list) --

                The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

                • (string) --

              • onError (string) --

                The behavior when the script fails. The default value is TERMINATE. Valid values:

                • TERMINATE – Terminates the compute node.

                • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

                • CONTINUE – Ignores the error and continues running the next script.

              • executionPolicy (string) --

                The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

                • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

                • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

        • scriptCachingPolicy (string) --

          The caching policy for node lifecycle scripts. The default value is CACHE_ONCE. Valid values:

          • CACHE_ONCE – Downloads each script once and reuses it on subsequent boots.

          • REFRESH_ON_REBOOT – Downloads each script on every boot.

      • errorInfo (list) --

        The list of errors that occurred during compute node group provisioning.

        • (dict) --

          An error that occurred during resource creation.

          • code (string) --

            The short-form error code.

          • message (string) --

            The detailed error information.

RegisterComputeNodeGroupInstance (updated) Link ¶
Changes (response)
{'clusterName': 'string',
 'computeNodeGroupId': 'string',
 'computeNodeGroupName': 'string',
 'nodeLifecycleActions': {'scriptCachingPolicy': 'CACHE_ONCE | '
                                                 'REFRESH_ON_REBOOT',
                          'stages': {'nodeBootstrapped': [{'arguments': ['string'],
                                                           'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                              '| '
                                                                              'EVERY_BOOT',
                                                           'name': 'string',
                                                           'onError': 'TERMINATE '
                                                                      '| '
                                                                      'STOP_SEQUENCE '
                                                                      '| '
                                                                      'CONTINUE',
                                                           'scriptSource': {'checksum': 'string',
                                                                            's3VersionId': 'string',
                                                                            'scriptLocation': 'string'}}],
                                     'nodeReady': [{'arguments': ['string'],
                                                    'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                       '| '
                                                                       'EVERY_BOOT',
                                                    'name': 'string',
                                                    'onError': 'TERMINATE | '
                                                               'STOP_SEQUENCE '
                                                               '| CONTINUE',
                                                    'scriptSource': {'checksum': 'string',
                                                                     's3VersionId': 'string',
                                                                     'scriptLocation': 'string'}}]}}}

PCS uses this API action to register the compute nodes it launches in your account.

See also: AWS API Documentation

Request Syntax

client.register_compute_node_group_instance(
    clusterIdentifier='string',
    bootstrapId='string'
)
type clusterIdentifier:

string

param clusterIdentifier:

[REQUIRED]

The name or ID of the cluster to register the compute node group instance in.

type bootstrapId:

string

param bootstrapId:

[REQUIRED]

The client-generated token to allow for retries.

rtype:

dict

returns:

Response Syntax

{
    'nodeID': 'string',
    'sharedSecret': 'string',
    'endpoints': [
        {
            'type': 'SLURMCTLD'|'SLURMDBD'|'SLURMRESTD',
            'privateIpAddress': 'string',
            'publicIpAddress': 'string',
            'ipv6Address': 'string',
            'port': 'string'
        },
    ],
    'clusterName': 'string',
    'computeNodeGroupId': 'string',
    'computeNodeGroupName': 'string',
    'nodeLifecycleActions': {
        'stages': {
            'nodeBootstrapped': [
                {
                    'name': 'string',
                    'scriptSource': {
                        'scriptLocation': 'string',
                        's3VersionId': 'string',
                        'checksum': 'string'
                    },
                    'arguments': [
                        'string',
                    ],
                    'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                    'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                },
            ],
            'nodeReady': [
                {
                    'name': 'string',
                    'scriptSource': {
                        'scriptLocation': 'string',
                        's3VersionId': 'string',
                        'checksum': 'string'
                    },
                    'arguments': [
                        'string',
                    ],
                    'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                    'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                },
            ]
        },
        'scriptCachingPolicy': 'CACHE_ONCE'|'REFRESH_ON_REBOOT'
    }
}

Response Structure

  • (dict) --

    • nodeID (string) --

      The scheduler node ID for this instance.

    • sharedSecret (string) --

      For the Slurm scheduler, this is the shared Munge key the scheduler uses to authenticate compute node group instances.

    • endpoints (list) --

      The list of endpoints available for interaction with the scheduler.

      • (dict) --

        An endpoint available for interaction with the scheduler.

        • type (string) --

          Indicates the type of endpoint running at the specific IP address.

        • privateIpAddress (string) --

          For clusters that use IPv4, this is the endpoint's private IP address.

          Example: 10.1.2.3

          For clusters configured to use IPv6, this is an empty string.

        • publicIpAddress (string) --

          The endpoint's public IP address.

          Example: 192.0.2.1

        • ipv6Address (string) --

          The endpoint's IPv6 address.

          Example: 2001:db8::1

        • port (string) --

          The endpoint's connection port number.

          Example: 1234

    • clusterName (string) --

      The name of the cluster that the compute node registered into.

    • computeNodeGroupId (string) --

      The ID of the compute node group that the compute node registered into.

    • computeNodeGroupName (string) --

      The name of the compute node group that the compute node registered into.

    • nodeLifecycleActions (dict) --

      The node lifecycle actions configured for the node group, including scripts to run when a compute node finishes bootstrapping or becomes ready to accept jobs.

      • stages (dict) --

        The lifecycle stages where you configure scripts to run.

        • nodeBootstrapped (list) --

          The scripts to run after PCS finishes setting up the compute node and before the Slurm daemon ( slurmd) starts. Use this stage for tasks that must complete before the node accepts jobs, such as mounting shared storage, configuring networking, or installing software packages.

          • (dict) --

            A script to run during a compute node lifecycle stage.

            • name (string) --

              A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

            • scriptSource (dict) --

              The source location and integrity information for the script.

              • scriptLocation (string) --

                The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

              • s3VersionId (string) --

                The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

              • checksum (string) --

                The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

            • arguments (list) --

              The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

              • (string) --

            • onError (string) --

              The behavior when the script fails. The default value is TERMINATE. Valid values:

              • TERMINATE – Terminates the compute node.

              • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

              • CONTINUE – Ignores the error and continues running the next script.

            • executionPolicy (string) --

              The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

              • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

              • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

        • nodeReady (list) --

          The scripts to run after the Slurm daemon ( slurmd) starts and the compute node registers with the Slurm controller. Use this stage for tasks that require Slurm to be running, such as running Slurm commands.

          • (dict) --

            A script to run during a compute node lifecycle stage.

            • name (string) --

              A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

            • scriptSource (dict) --

              The source location and integrity information for the script.

              • scriptLocation (string) --

                The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

              • s3VersionId (string) --

                The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

              • checksum (string) --

                The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

            • arguments (list) --

              The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

              • (string) --

            • onError (string) --

              The behavior when the script fails. The default value is TERMINATE. Valid values:

              • TERMINATE – Terminates the compute node.

              • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

              • CONTINUE – Ignores the error and continues running the next script.

            • executionPolicy (string) --

              The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

              • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

              • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

      • scriptCachingPolicy (string) --

        The caching policy for node lifecycle scripts. The default value is CACHE_ONCE. Valid values:

        • CACHE_ONCE – Downloads each script once and reuses it on subsequent boots.

        • REFRESH_ON_REBOOT – Downloads each script on every boot.

UpdateComputeNodeGroup (updated) Link ¶
Changes (request, response)
Request
{'nodeLifecycleActions': {'scriptCachingPolicy': 'CACHE_ONCE | '
                                                 'REFRESH_ON_REBOOT',
                          'stages': {'nodeBootstrapped': [{'arguments': ['string'],
                                                           'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                              '| '
                                                                              'EVERY_BOOT',
                                                           'name': 'string',
                                                           'onError': 'TERMINATE '
                                                                      '| '
                                                                      'STOP_SEQUENCE '
                                                                      '| '
                                                                      'CONTINUE',
                                                           'scriptSource': {'checksum': 'string',
                                                                            's3VersionId': 'string',
                                                                            'scriptLocation': 'string'}}],
                                     'nodeReady': [{'arguments': ['string'],
                                                    'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                       '| '
                                                                       'EVERY_BOOT',
                                                    'name': 'string',
                                                    'onError': 'TERMINATE | '
                                                               'STOP_SEQUENCE '
                                                               '| CONTINUE',
                                                    'scriptSource': {'checksum': 'string',
                                                                     's3VersionId': 'string',
                                                                     'scriptLocation': 'string'}}]}}}
Response
{'computeNodeGroup': {'nodeLifecycleActions': {'scriptCachingPolicy': 'CACHE_ONCE '
                                                                      '| '
                                                                      'REFRESH_ON_REBOOT',
                                               'stages': {'nodeBootstrapped': [{'arguments': ['string'],
                                                                                'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                                                   '| '
                                                                                                   'EVERY_BOOT',
                                                                                'name': 'string',
                                                                                'onError': 'TERMINATE '
                                                                                           '| '
                                                                                           'STOP_SEQUENCE '
                                                                                           '| '
                                                                                           'CONTINUE',
                                                                                'scriptSource': {'checksum': 'string',
                                                                                                 's3VersionId': 'string',
                                                                                                 'scriptLocation': 'string'}}],
                                                          'nodeReady': [{'arguments': ['string'],
                                                                         'executionPolicy': 'FIRST_BOOT_ONLY '
                                                                                            '| '
                                                                                            'EVERY_BOOT',
                                                                         'name': 'string',
                                                                         'onError': 'TERMINATE '
                                                                                    '| '
                                                                                    'STOP_SEQUENCE '
                                                                                    '| '
                                                                                    'CONTINUE',
                                                                         'scriptSource': {'checksum': 'string',
                                                                                          's3VersionId': 'string',
                                                                                          'scriptLocation': 'string'}}]}}}}

Updates a compute node group. You can update many of the fields related to your compute node group including the configurations for networking, compute nodes, and settings specific to your scheduler (such as Slurm).

See also: AWS API Documentation

Request Syntax

client.update_compute_node_group(
    clusterIdentifier='string',
    computeNodeGroupIdentifier='string',
    amiId='string',
    subnetIds=[
        'string',
    ],
    customLaunchTemplate={
        'id': 'string',
        'version': 'string'
    },
    purchaseOption='ONDEMAND'|'SPOT'|'CAPACITY_BLOCK'|'INTERRUPTIBLE_CAPACITY_RESERVATION',
    spotOptions={
        'allocationStrategy': 'lowest-price'|'capacity-optimized'|'price-capacity-optimized'
    },
    scalingConfiguration={
        'minInstanceCount': 123,
        'maxInstanceCount': 123
    },
    iamInstanceProfileArn='string',
    slurmConfiguration={
        'scaleDownIdleTimeInSeconds': 123,
        'slurmCustomSettings': [
            {
                'parameterName': 'string',
                'parameterValue': 'string'
            },
        ]
    },
    nodeLifecycleActions={
        'stages': {
            'nodeBootstrapped': [
                {
                    'name': 'string',
                    'scriptSource': {
                        'scriptLocation': 'string',
                        's3VersionId': 'string',
                        'checksum': 'string'
                    },
                    'arguments': [
                        'string',
                    ],
                    'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                    'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                },
            ],
            'nodeReady': [
                {
                    'name': 'string',
                    'scriptSource': {
                        'scriptLocation': 'string',
                        's3VersionId': 'string',
                        'checksum': 'string'
                    },
                    'arguments': [
                        'string',
                    ],
                    'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                    'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                },
            ]
        },
        'scriptCachingPolicy': 'CACHE_ONCE'|'REFRESH_ON_REBOOT'
    },
    clientToken='string'
)
type clusterIdentifier:

string

param clusterIdentifier:

[REQUIRED]

The name or ID of the cluster of the compute node group.

type computeNodeGroupIdentifier:

string

param computeNodeGroupIdentifier:

[REQUIRED]

The name or ID of the compute node group.

type amiId:

string

param amiId:

The ID of the Amazon Machine Image (AMI) that PCS uses to launch instances. If not provided, PCS uses the AMI ID specified in the custom launch template.

type subnetIds:

list

param subnetIds:

The list of subnet IDs where the compute node group provisions instances. The subnets must be in the same VPC as the cluster.

  • (string) --

type customLaunchTemplate:

dict

param customLaunchTemplate:

An Amazon EC2 launch template PCS uses to launch compute nodes.

  • id (string) -- [REQUIRED]

    The ID of the EC2 launch template to use to provision instances.

    Example: lt-xxxx

  • version (string) -- [REQUIRED]

    The version of the EC2 launch template to use to provision instances.

type purchaseOption:

string

param purchaseOption:

Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, Interruptible Capacity Reservations, On-Demand Capacity Reservations, 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 PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. For more information about PCS support for interruptible capacity reservations, see Using I-ODCRs with PCS in the PCS User Guide. Choose On-Demand if you plan to use an On-Demand Capacity Reservation (ODCR). For more information, see Using ODCRs with PCS. If you don't provide this option, it defaults to On-Demand.

type spotOptions:

dict

param spotOptions:

Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action.

type scalingConfiguration:

dict

param scalingConfiguration:

Specifies the boundaries of the compute node group auto scaling.

  • minInstanceCount (integer) -- [REQUIRED]

    The lower bound of the number of instances allowed in the compute fleet.

  • maxInstanceCount (integer) -- [REQUIRED]

    The upper bound of the number of instances allowed in the compute fleet.

type iamInstanceProfileArn:

string

param iamInstanceProfileArn:

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

type slurmConfiguration:

dict

param slurmConfiguration:

Additional options related to the Slurm scheduler.

  • scaleDownIdleTimeInSeconds (integer) --

    The time (in seconds) before an idle node is scaled down. If not specified, the cluster-level setting applies. This overrides the cluster-level scaleDownIdleTimeInSeconds setting. A value of -1 removes the override and applies the cluster-level setting to this compute node group. Requires Slurm version 25.11 or later.

  • slurmCustomSettings (list) --

    Additional Slurm-specific configuration that directly maps to Slurm settings.

    • (dict) --

      Additional settings that directly map to Slurm settings.

      • parameterName (string) -- [REQUIRED]

        PCS supports custom Slurm settings for clusters, compute node groups, and queues. For more information, see Configuring custom Slurm settings in PCS in the PCS User Guide.

      • parameterValue (string) -- [REQUIRED]

        The values for the configured Slurm settings.

type nodeLifecycleActions:

dict

param nodeLifecycleActions:

The lifecycle actions to run on compute nodes in the compute node group. Use lifecycle actions to run custom scripts at defined stages of a compute node's lifecycle, such as when a compute node finishes bootstrapping or becomes ready to accept jobs.

  • stages (dict) -- [REQUIRED]

    The lifecycle stages where you configure scripts to run.

    • nodeBootstrapped (list) --

      The scripts to run after PCS finishes setting up the compute node and before the Slurm daemon ( slurmd) starts. Use this stage for tasks that must complete before the node accepts jobs, such as mounting shared storage, configuring networking, or installing software packages.

      • (dict) --

        A script to run during a compute node lifecycle stage.

        • name (string) -- [REQUIRED]

          A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

        • scriptSource (dict) -- [REQUIRED]

          The source location and integrity information for the script.

          • scriptLocation (string) -- [REQUIRED]

            The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

          • s3VersionId (string) --

            The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

          • checksum (string) --

            The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

        • arguments (list) --

          The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

          • (string) --

        • onError (string) --

          The behavior when the script fails. The default value is TERMINATE. Valid values:

          • TERMINATE – Terminates the compute node.

          • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

          • CONTINUE – Ignores the error and continues running the next script.

        • executionPolicy (string) --

          The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

          • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

          • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

    • nodeReady (list) --

      The scripts to run after the Slurm daemon ( slurmd) starts and the compute node registers with the Slurm controller. Use this stage for tasks that require Slurm to be running, such as running Slurm commands.

      • (dict) --

        A script to run during a compute node lifecycle stage.

        • name (string) -- [REQUIRED]

          A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

        • scriptSource (dict) -- [REQUIRED]

          The source location and integrity information for the script.

          • scriptLocation (string) -- [REQUIRED]

            The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

          • s3VersionId (string) --

            The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

          • checksum (string) --

            The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

        • arguments (list) --

          The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

          • (string) --

        • onError (string) --

          The behavior when the script fails. The default value is TERMINATE. Valid values:

          • TERMINATE – Terminates the compute node.

          • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

          • CONTINUE – Ignores the error and continues running the next script.

        • executionPolicy (string) --

          The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

          • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

          • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

  • scriptCachingPolicy (string) --

    The caching policy for node lifecycle scripts. The default value is CACHE_ONCE. Valid values:

    • CACHE_ONCE – Downloads each script once and reuses it on subsequent boots.

    • REFRESH_ON_REBOOT – Downloads each script on every boot.

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{
    'computeNodeGroup': {
        'name': 'string',
        'id': 'string',
        'arn': 'string',
        'clusterId': 'string',
        'createdAt': datetime(2015, 1, 1),
        'modifiedAt': datetime(2015, 1, 1),
        'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATE_FAILED'|'DELETE_FAILED'|'UPDATE_FAILED'|'DELETED'|'SUSPENDING'|'SUSPENDED'|'RESUMING',
        'amiId': 'string',
        'subnetIds': [
            'string',
        ],
        'purchaseOption': 'ONDEMAND'|'SPOT'|'CAPACITY_BLOCK'|'INTERRUPTIBLE_CAPACITY_RESERVATION',
        'customLaunchTemplate': {
            'id': 'string',
            'version': 'string'
        },
        'iamInstanceProfileArn': 'string',
        'scalingConfiguration': {
            'minInstanceCount': 123,
            'maxInstanceCount': 123
        },
        'instanceConfigs': [
            {
                'instanceType': 'string'
            },
        ],
        'spotOptions': {
            'allocationStrategy': 'lowest-price'|'capacity-optimized'|'price-capacity-optimized'
        },
        'slurmConfiguration': {
            'scaleDownIdleTimeInSeconds': 123,
            'slurmCustomSettings': [
                {
                    'parameterName': 'string',
                    'parameterValue': 'string'
                },
            ]
        },
        'nodeLifecycleActions': {
            'stages': {
                'nodeBootstrapped': [
                    {
                        'name': 'string',
                        'scriptSource': {
                            'scriptLocation': 'string',
                            's3VersionId': 'string',
                            'checksum': 'string'
                        },
                        'arguments': [
                            'string',
                        ],
                        'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                        'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                    },
                ],
                'nodeReady': [
                    {
                        'name': 'string',
                        'scriptSource': {
                            'scriptLocation': 'string',
                            's3VersionId': 'string',
                            'checksum': 'string'
                        },
                        'arguments': [
                            'string',
                        ],
                        'onError': 'TERMINATE'|'STOP_SEQUENCE'|'CONTINUE',
                        'executionPolicy': 'FIRST_BOOT_ONLY'|'EVERY_BOOT'
                    },
                ]
            },
            'scriptCachingPolicy': 'CACHE_ONCE'|'REFRESH_ON_REBOOT'
        },
        'errorInfo': [
            {
                'code': 'string',
                'message': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • computeNodeGroup (dict) --

      A compute node group associated with a cluster.

      • name (string) --

        The name that identifies the compute node group.

      • id (string) --

        The generated unique ID of the compute node group.

      • arn (string) --

        The unique Amazon Resource Name (ARN) of the compute node group.

      • clusterId (string) --

        The ID of the cluster of the compute node group.

      • createdAt (datetime) --

        The date and time the resource was created.

      • modifiedAt (datetime) --

        The date and time the resource was modified.

      • status (string) --

        The provisioning status of the compute node group.

      • amiId (string) --

        The ID of the Amazon Machine Image (AMI) that PCS uses to launch instances. If not provided, PCS uses the AMI ID specified in the custom launch template.

      • subnetIds (list) --

        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.

        • (string) --

      • purchaseOption (string) --

        Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, Interruptible Capacity Reservations, On-Demand Capacity Reservations, 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 PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. For more information about PCS support for interruptible capacity reservations, see Using I-ODCRs with PCS in the PCS User Guide. Choose On-Demand if you plan to use an On-Demand Capacity Reservation (ODCR). For more information, see Using ODCRs with PCS. If you don't provide this option, it defaults to On-Demand.

      • customLaunchTemplate (dict) --

        An Amazon EC2 launch template PCS uses to launch compute nodes.

        • id (string) --

          The ID of the EC2 launch template to use to provision instances.

          Example: lt-xxxx

        • version (string) --

          The version of the EC2 launch template to use to provision instances.

      • iamInstanceProfileArn (string) --

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

      • scalingConfiguration (dict) --

        Specifies the boundaries of the compute node group auto scaling.

        • minInstanceCount (integer) --

          The lower bound of the number of instances allowed in the compute fleet.

        • maxInstanceCount (integer) --

          The upper bound of the number of instances allowed in the compute fleet.

      • instanceConfigs (list) --

        A list of EC2 instance configurations that PCS can provision in the compute node group.

        • (dict) --

          An EC2 instance configuration PCS uses to launch compute nodes.

          • instanceType (string) --

            The EC2 instance type that PCS can provision in the compute node group.

            Example: t2.xlarge

      • spotOptions (dict) --

        Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action.

      • slurmConfiguration (dict) --

        Additional options related to the Slurm scheduler.

        • scaleDownIdleTimeInSeconds (integer) --

          The time (in seconds) before an idle node is scaled down. If not specified, the cluster-level setting applies. This overrides the cluster-level scaleDownIdleTimeInSeconds setting. A value of -1 removes the override and applies the cluster-level setting to this compute node group. Requires Slurm version 25.11 or later.

        • slurmCustomSettings (list) --

          Additional Slurm-specific configuration that directly maps to Slurm settings.

          • (dict) --

            Additional settings that directly map to Slurm settings.

            • parameterName (string) --

              PCS supports custom Slurm settings for clusters, compute node groups, and queues. For more information, see Configuring custom Slurm settings in PCS in the PCS User Guide.

            • parameterValue (string) --

              The values for the configured Slurm settings.

      • nodeLifecycleActions (dict) --

        The lifecycle actions to run on compute nodes in the compute node group. Use lifecycle actions to run custom scripts at defined stages of a compute node's lifecycle, such as when a compute node finishes bootstrapping or becomes ready to accept jobs.

        • stages (dict) --

          The lifecycle stages where you configure scripts to run.

          • nodeBootstrapped (list) --

            The scripts to run after PCS finishes setting up the compute node and before the Slurm daemon ( slurmd) starts. Use this stage for tasks that must complete before the node accepts jobs, such as mounting shared storage, configuring networking, or installing software packages.

            • (dict) --

              A script to run during a compute node lifecycle stage.

              • name (string) --

                A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

              • scriptSource (dict) --

                The source location and integrity information for the script.

                • scriptLocation (string) --

                  The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

                • s3VersionId (string) --

                  The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

                • checksum (string) --

                  The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

              • arguments (list) --

                The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

                • (string) --

              • onError (string) --

                The behavior when the script fails. The default value is TERMINATE. Valid values:

                • TERMINATE – Terminates the compute node.

                • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

                • CONTINUE – Ignores the error and continues running the next script.

              • executionPolicy (string) --

                The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

                • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

                • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

          • nodeReady (list) --

            The scripts to run after the Slurm daemon ( slurmd) starts and the compute node registers with the Slurm controller. Use this stage for tasks that require Slurm to be running, such as running Slurm commands.

            • (dict) --

              A script to run during a compute node lifecycle stage.

              • name (string) --

                A unique name for the script. The name can be up to 64 characters long. Valid characters are letters, numbers, spaces, underscores ( _), and hyphens ( -). The first character must be a letter or a number.

              • scriptSource (dict) --

                The source location and integrity information for the script.

                • scriptLocation (string) --

                  The location of the script. Specify either an Amazon S3 URI in the format s3://bucket-name/key or an HTTPS URL.

                • s3VersionId (string) --

                  The Amazon S3 version ID of the script. Use this value to pin the script to a specific version in a versioned Amazon S3 bucket. This value is only valid when scriptLocation is an Amazon S3 URI.

                • checksum (string) --

                  The SHA-256 checksum of the script content, as a 64-character hexadecimal string. This value is optional. When specified, PCS uses this value to verify the integrity of the downloaded script.

              • arguments (list) --

                The command-line arguments to pass to the script. You can specify up to 20 arguments, and each argument can be up to 256 characters long.

                • (string) --

              • onError (string) --

                The behavior when the script fails. The default value is TERMINATE. Valid values:

                • TERMINATE – Terminates the compute node.

                • STOP_SEQUENCE – Stops running subsequent scripts in the sequence but doesn't terminate the compute node.

                • CONTINUE – Ignores the error and continues running the next script.

              • executionPolicy (string) --

                The policy that determines when the script runs. The default value is FIRST_BOOT_ONLY. Valid values:

                • FIRST_BOOT_ONLY – Runs the script only the first time the compute node boots.

                • EVERY_BOOT – Runs the script every time the compute node boots, including reboots.

        • scriptCachingPolicy (string) --

          The caching policy for node lifecycle scripts. The default value is CACHE_ONCE. Valid values:

          • CACHE_ONCE – Downloads each script once and reuses it on subsequent boots.

          • REFRESH_ON_REBOOT – Downloads each script on every boot.

      • errorInfo (list) --

        The list of errors that occurred during compute node group provisioning.

        • (dict) --

          An error that occurred during resource creation.

          • code (string) --

            The short-form error code.

          • message (string) --

            The detailed error information.