compute_node_groups
Creates, updates, deletes, gets or lists a compute_node_groups resource.
Overview
| Name | compute_node_groups |
| Type | Resource |
| Id | aws.pcs.compute_node_groups |
Fields
The following fields are returned by SELECT queries:
- get_compute_node_group
- list_compute_node_groups
| Name | Datatype | Description |
|---|---|---|
id | string | The generated unique ID of the compute node group. |
name | string | The name that identifies the compute node group. (pattern: <code>(?!pcs_)^[A-Za-z][A-Za-z0-9-]+</code>) |
ami_id | 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. (pattern: <code>ami-[a-z0-9]+</code>) |
arn | string | The unique Amazon Resource Name (ARN) of the compute node group. |
cluster_id | string | The ID of the cluster of the compute node group. |
created_at | string (date-time) | The date and time the resource was created. |
custom_launch_template | object | An Amazon EC2 launch template PCS uses to launch compute nodes. |
error_info | array | The list of errors that occurred during compute node group provisioning. |
iam_instance_profile_arn | 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. (pattern: <code>arn:aws([a-zA-Z-]{0,10})?:iam::[0-9]{12}:instance-profile/([!-~]{1,510}/)?([\w+=,.@-]{1,128})</code>) |
instance_configs | array | A list of EC2 instance configurations that PCS can provision in the compute node group. |
modified_at | string (date-time) | The date and time the resource was modified. |
node_lifecycle_actions | object | 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. |
purchase_option | 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. (ONDEMAND, SPOT, CAPACITY_BLOCK, INTERRUPTIBLE_CAPACITY_RESERVATION) |
scaling_configuration | object | Specifies the boundaries of the compute node group auto scaling. |
slurm_configuration | object | Additional options related to the Slurm scheduler. |
spot_options | object | Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action. |
status | string | The provisioning status of the compute node group. The provisioning status doesn't indicate the overall health of the compute node group. The resource enters the SUSPENDING and SUSPENDED states when the scheduler is beyond end of life and we have suspended the cluster. When in these states, you can't use the cluster. The cluster controller is down and all compute instances are terminated. The resources still count toward your service quotas. You can delete a resource if its status is SUSPENDED. For more information, see Frequently asked questions about Slurm versions in PCS in the PCS User Guide. (CREATING, ACTIVE, UPDATING, DELETING, CREATE_FAILED, DELETE_FAILED, UPDATE_FAILED, DELETED, SUSPENDING, SUSPENDED, RESUMING) |
subnet_ids | array | 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. |
| Name | Datatype | Description |
|---|---|---|
id | string | The generated unique ID of the compute node group. |
name | string | The name that identifies the compute node group. (pattern: <code>(?!pcs_)^[A-Za-z][A-Za-z0-9-]+</code>) |
arn | string | The unique Amazon Resource Name (ARN) of the compute node group. |
cluster_id | string | The ID of the cluster of the compute node group. |
created_at | string (date-time) | The date and time the resource was created. |
modified_at | string (date-time) | The date and time the resource was modified. |
status | string | The provisioning status of the compute node group. The provisioning status doesn't indicate the overall health of the compute node group. The resource enters the SUSPENDING and SUSPENDED states when the scheduler is beyond end of life and we have suspended the cluster. When in these states, you can't use the cluster. The cluster controller is down and all compute instances are terminated. The resources still count toward your service quotas. You can delete a resource if its status is SUSPENDED. For more information, see Frequently asked questions about Slurm versions in PCS in the PCS User Guide. (CREATING, ACTIVE, UPDATING, DELETING, CREATE_FAILED, DELETE_FAILED, UPDATE_FAILED, DELETED, SUSPENDING, SUSPENDED, RESUMING) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_compute_node_group | select | region | 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. | |
list_compute_node_groups | select | region | Returns a list of all compute node groups associated with a cluster. | |
create_compute_node_group | insert | region, clusterIdentifier, computeNodeGroupName, subnetIds, customLaunchTemplate, iamInstanceProfileArn, scalingConfiguration, instanceConfigs | 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. | |
register_compute_node_group_instance | insert | region, clusterIdentifier, bootstrapId | This API action isn't intended for you to use. PCS uses this API action to register the compute nodes it launches in your account. | |
update_compute_node_group | update | region, clusterIdentifier, computeNodeGroupIdentifier | 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). | |
delete_compute_node_group | delete | region | Deletes a compute node group. You must delete all queues associated with the compute node group first. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_compute_node_group
- list_compute_node_groups
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.
SELECT
id,
name,
ami_id,
arn,
cluster_id,
created_at,
custom_launch_template,
error_info,
iam_instance_profile_arn,
instance_configs,
modified_at,
node_lifecycle_actions,
purchase_option,
scaling_configuration,
slurm_configuration,
spot_options,
status,
subnet_ids
FROM aws.pcs.compute_node_groups
WHERE region = '{{ region }}' -- required
;
Returns a list of all compute node groups associated with a cluster.
SELECT
id,
name,
arn,
cluster_id,
created_at,
modified_at,
status
FROM aws.pcs.compute_node_groups
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_compute_node_group
- register_compute_node_group_instance
- Manifest
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.
INSERT INTO aws.pcs.compute_node_groups (
clusterIdentifier,
computeNodeGroupName,
amiId,
subnetIds,
purchaseOption,
customLaunchTemplate,
iamInstanceProfileArn,
scalingConfiguration,
instanceConfigs,
spotOptions,
slurmConfiguration,
nodeLifecycleActions,
clientToken,
tags,
region
)
SELECT
'{{ clusterIdentifier }}' /* required */,
'{{ computeNodeGroupName }}' /* required */,
'{{ amiId }}',
'{{ subnetIds }}' /* required */,
'{{ purchaseOption }}',
'{{ customLaunchTemplate }}' /* required */,
'{{ iamInstanceProfileArn }}' /* required */,
'{{ scalingConfiguration }}' /* required */,
'{{ instanceConfigs }}' /* required */,
'{{ spotOptions }}',
'{{ slurmConfiguration }}',
'{{ nodeLifecycleActions }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
compute_node_group
;
This API action isn't intended for you to use. PCS uses this API action to register the compute nodes it launches in your account.
INSERT INTO aws.pcs.compute_node_groups (
clusterIdentifier,
bootstrapId,
region
)
SELECT
'{{ clusterIdentifier }}' /* required */,
'{{ bootstrapId }}' /* required */,
'{{ region }}'
RETURNING
cluster_name,
compute_node_group_id,
compute_node_group_name,
endpoints,
node_id,
node_lifecycle_actions,
shared_secret
;
# Description fields are for documentation purposes
- name: compute_node_groups
props:
- name: region
value: "{{ region }}"
description: Required parameter for the compute_node_groups resource.
- name: clusterIdentifier
value: "{{ clusterIdentifier }}"
description: |
The name or ID of the cluster to register the compute node group instance in.
- name: computeNodeGroupName
value: "{{ computeNodeGroupName }}"
description: |
A name to identify the cluster. Example: MyCluster
- name: amiId
value: "{{ amiId }}"
description: |
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.
- name: subnetIds
value:
- "{{ subnetIds }}"
description: |
The list of subnet IDs where the compute node group launches instances. Subnets must be in the same VPC as the cluster.
- name: purchaseOption
value: "{{ purchaseOption }}"
description: |
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.
valid_values: ['ONDEMAND', 'SPOT', 'CAPACITY_BLOCK', 'INTERRUPTIBLE_CAPACITY_RESERVATION']
- name: customLaunchTemplate
description: |
An Amazon EC2 launch template PCS uses to launch compute nodes.
value:
id: "{{ id }}"
version: "{{ version }}"
- name: iamInstanceProfileArn
value: "{{ iamInstanceProfileArn }}"
description: |
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.
- name: scalingConfiguration
description: |
Specifies the boundaries of the compute node group auto scaling.
value:
minInstanceCount: {{ minInstanceCount }}
maxInstanceCount: {{ maxInstanceCount }}
- name: instanceConfigs
description: |
A list of EC2 instance configurations that PCS can provision in the compute node group.
value:
- instanceType: "{{ instanceType }}"
- name: spotOptions
description: |
Additional configuration when you specify SPOT as the purchaseOption for the CreateComputeNodeGroup API action.
value:
allocationStrategy: "{{ allocationStrategy }}"
- name: slurmConfiguration
description: |
Additional options related to the Slurm scheduler.
value:
scaleDownIdleTimeInSeconds: {{ scaleDownIdleTimeInSeconds }}
slurmCustomSettings:
- parameterName: "{{ parameterName }}"
parameterValue: "{{ parameterValue }}"
- name: nodeLifecycleActions
description: |
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.
value:
stages:
nodeBootstrapped:
- name: "{{ name }}"
scriptSource:
scriptLocation: "{{ scriptLocation }}"
s3VersionId: "{{ s3VersionId }}"
checksum: "{{ checksum }}"
arguments: "{{ arguments }}"
onError: "{{ onError }}"
executionPolicy: "{{ executionPolicy }}"
nodeReady:
- name: "{{ name }}"
scriptSource:
scriptLocation: "{{ scriptLocation }}"
s3VersionId: "{{ s3VersionId }}"
checksum: "{{ checksum }}"
arguments: "{{ arguments }}"
onError: "{{ onError }}"
executionPolicy: "{{ executionPolicy }}"
scriptCachingPolicy: "{{ scriptCachingPolicy }}"
- name: clientToken
value: "{{ clientToken }}"
description: |
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.
- name: tags
value: "{{ tags }}"
description: |
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.
- name: bootstrapId
value: "{{ bootstrapId }}"
description: |
The client-generated token to allow for retries.
UPDATE examples
- update_compute_node_group
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).
UPDATE aws.pcs.compute_node_groups
SET
clusterIdentifier = '{{ clusterIdentifier }}',
computeNodeGroupIdentifier = '{{ computeNodeGroupIdentifier }}',
amiId = '{{ amiId }}',
subnetIds = '{{ subnetIds }}',
customLaunchTemplate = '{{ customLaunchTemplate }}',
purchaseOption = '{{ purchaseOption }}',
spotOptions = '{{ spotOptions }}',
scalingConfiguration = '{{ scalingConfiguration }}',
iamInstanceProfileArn = '{{ iamInstanceProfileArn }}',
slurmConfiguration = '{{ slurmConfiguration }}',
nodeLifecycleActions = '{{ nodeLifecycleActions }}',
clientToken = '{{ clientToken }}'
WHERE
region = '{{ region }}' --required
AND clusterIdentifier = '{{ clusterIdentifier }}' --required
AND computeNodeGroupIdentifier = '{{ computeNodeGroupIdentifier }}' --required
RETURNING
compute_node_group;
DELETE examples
- delete_compute_node_group
Deletes a compute node group. You must delete all queues associated with the compute node group first.
DELETE FROM aws.pcs.compute_node_groups
WHERE region = '{{ region }}' --required
;