updateComputeNodeGroup method

Future<UpdateComputeNodeGroupResponse> updateComputeNodeGroup({
  1. required String clusterIdentifier,
  2. required String computeNodeGroupIdentifier,
  3. String? amiId,
  4. String? clientToken,
  5. CustomLaunchTemplate? customLaunchTemplate,
  6. String? iamInstanceProfileArn,
  7. PurchaseOption? purchaseOption,
  8. ScalingConfigurationRequest? scalingConfiguration,
  9. UpdateComputeNodeGroupSlurmConfigurationRequest? slurmConfiguration,
  10. SpotOptions? spotOptions,
  11. List<String>? subnetIds,
})

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).

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter clusterIdentifier : The name or ID of the cluster of the compute node group.

Parameter computeNodeGroupIdentifier : The name or ID of the compute node group.

Parameter 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.

Parameter 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.

Parameter 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.

Parameter 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.

Parameter scalingConfiguration : Specifies the boundaries of the compute node group auto scaling.

Parameter slurmConfiguration : Additional options related to the Slurm scheduler.

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

Implementation

Future<UpdateComputeNodeGroupResponse> updateComputeNodeGroup({
  required String clusterIdentifier,
  required String computeNodeGroupIdentifier,
  String? amiId,
  String? clientToken,
  CustomLaunchTemplate? customLaunchTemplate,
  String? iamInstanceProfileArn,
  PurchaseOption? purchaseOption,
  ScalingConfigurationRequest? scalingConfiguration,
  UpdateComputeNodeGroupSlurmConfigurationRequest? slurmConfiguration,
  SpotOptions? spotOptions,
  List<String>? subnetIds,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSParallelComputingService.UpdateComputeNodeGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'clusterIdentifier': clusterIdentifier,
      'computeNodeGroupIdentifier': computeNodeGroupIdentifier,
      if (amiId != null) 'amiId': amiId,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (customLaunchTemplate != null)
        'customLaunchTemplate': customLaunchTemplate,
      if (iamInstanceProfileArn != null)
        'iamInstanceProfileArn': iamInstanceProfileArn,
      if (purchaseOption != null) 'purchaseOption': purchaseOption.value,
      if (scalingConfiguration != null)
        'scalingConfiguration': scalingConfiguration,
      if (slurmConfiguration != null)
        'slurmConfiguration': slurmConfiguration,
      if (spotOptions != null) 'spotOptions': spotOptions,
      if (subnetIds != null) 'subnetIds': subnetIds,
    },
  );

  return UpdateComputeNodeGroupResponse.fromJson(jsonResponse.body);
}