Class: AWSCDK::PCS::CfnComputeNodeGroupProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
pcs/cfn_compute_node_group_props.rb

Overview

Properties for defining a CfnComputeNodeGroup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster_id:, custom_launch_template:, iam_instance_profile_arn:, instance_configs:, scaling_configuration:, subnet_ids:, ami_id: nil, name: nil, purchase_option: nil, slurm_configuration: nil, spot_options: nil, tags: nil) ⇒ CfnComputeNodeGroupProps

Returns a new instance of CfnComputeNodeGroupProps.

Parameters:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'pcs/cfn_compute_node_group_props.rb', line 21

def initialize(cluster_id:, custom_launch_template:, iam_instance_profile_arn:, instance_configs:, scaling_configuration:, subnet_ids:, ami_id: nil, name: nil, purchase_option: nil, slurm_configuration: nil, spot_options: nil, tags: nil)
  @cluster_id = cluster_id
  Jsii::Type.check_type(@cluster_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "clusterId")
  @custom_launch_template = custom_launch_template.is_a?(Hash) ? ::AWSCDK::PCS::CfnComputeNodeGroup::CustomLaunchTemplateProperty.new(**custom_launch_template.transform_keys(&:to_sym)) : custom_launch_template
  Jsii::Type.check_type(@custom_launch_template, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19wY3MuQ2ZuQ29tcHV0ZU5vZGVHcm91cC5DdXN0b21MYXVuY2hUZW1wbGF0ZVByb3BlcnR5In1dfX0=")), "customLaunchTemplate")
  @iam_instance_profile_arn = iam_instance_profile_arn
  Jsii::Type.check_type(@iam_instance_profile_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "iamInstanceProfileArn")
  @instance_configs = instance_configs
  Jsii::Type.check_type(@instance_configs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcGNzLkNmbkNvbXB1dGVOb2RlR3JvdXAuSW5zdGFuY2VDb25maWdQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "instanceConfigs")
  @scaling_configuration = scaling_configuration.is_a?(Hash) ? ::AWSCDK::PCS::CfnComputeNodeGroup::ScalingConfigurationProperty.new(**scaling_configuration.transform_keys(&:to_sym)) : scaling_configuration
  Jsii::Type.check_type(@scaling_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19wY3MuQ2ZuQ29tcHV0ZU5vZGVHcm91cC5TY2FsaW5nQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "scalingConfiguration")
  @subnet_ids = subnet_ids
  Jsii::Type.check_type(@subnet_ids, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "subnetIds")
  @ami_id = ami_id
  Jsii::Type.check_type(@ami_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "amiId") unless @ami_id.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @purchase_option = purchase_option
  Jsii::Type.check_type(@purchase_option, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "purchaseOption") unless @purchase_option.nil?
  @slurm_configuration = slurm_configuration.is_a?(Hash) ? ::AWSCDK::PCS::CfnComputeNodeGroup::SlurmConfigurationProperty.new(**slurm_configuration.transform_keys(&:to_sym)) : slurm_configuration
  Jsii::Type.check_type(@slurm_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19wY3MuQ2ZuQ29tcHV0ZU5vZGVHcm91cC5TbHVybUNvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "slurmConfiguration") unless @slurm_configuration.nil?
  @spot_options = spot_options.is_a?(Hash) ? ::AWSCDK::PCS::CfnComputeNodeGroup::SpotOptionsProperty.new(**spot_options.transform_keys(&:to_sym)) : spot_options
  Jsii::Type.check_type(@spot_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19wY3MuQ2ZuQ29tcHV0ZU5vZGVHcm91cC5TcG90T3B0aW9uc1Byb3BlcnR5In1dfX0=")), "spotOptions") unless @spot_options.nil?
  @tags = tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "tags") unless @tags.nil?
end

Instance Attribute Details

#ami_idString? (readonly)

The ID of the Amazon Machine Image (AMI) that AWS PCS uses to launch instances.

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



88
89
90
# File 'pcs/cfn_compute_node_group_props.rb', line 88

def ami_id
  @ami_id
end

#cluster_idString (readonly)

The ID of the cluster of the compute node group.



52
53
54
# File 'pcs/cfn_compute_node_group_props.rb', line 52

def cluster_id
  @cluster_id
end

#custom_launch_templateAWSCDK::IResolvable, AWSCDK::PCS::CfnComputeNodeGroup::CustomLaunchTemplateProperty (readonly)

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



57
58
59
# File 'pcs/cfn_compute_node_group_props.rb', line 57

def custom_launch_template
  @custom_launch_template
end

#iam_instance_profile_arnString (readonly)

The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances.

The role contained in your instance profile must have the pcs:RegisterComputeNodeGroupInstance permission and the role name must start with AWSPCS or must have the path /aws-pcs/ . For more information, see IAM instance profiles for AWS PCS in the AWS PCS User Guide .



64
65
66
# File 'pcs/cfn_compute_node_group_props.rb', line 64

def iam_instance_profile_arn
  @iam_instance_profile_arn
end

#instance_configsAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::PCS::CfnComputeNodeGroup::InstanceConfigProperty> (readonly)

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



69
70
71
# File 'pcs/cfn_compute_node_group_props.rb', line 69

def instance_configs
  @instance_configs
end

#nameString? (readonly)

The name that identifies the compute node group.



93
94
95
# File 'pcs/cfn_compute_node_group_props.rb', line 93

def name
  @name
end

#purchase_optionString? (readonly)

Specifies how EC2 instances are purchased on your behalf.

AWS PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see Amazon EC2 billing and purchasing options in the Amazon Elastic Compute Cloud User Guide . For more information about AWS PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with AWS PCS in the AWS PCS User Guide . If you don't provide this option, it defaults to On-Demand.



100
101
102
# File 'pcs/cfn_compute_node_group_props.rb', line 100

def purchase_option
  @purchase_option
end

#scaling_configurationAWSCDK::IResolvable, AWSCDK::PCS::CfnComputeNodeGroup::ScalingConfigurationProperty (readonly)

Specifies the boundaries of the compute node group auto scaling.



74
75
76
# File 'pcs/cfn_compute_node_group_props.rb', line 74

def scaling_configuration
  @scaling_configuration
end

#slurm_configurationAWSCDK::IResolvable, ... (readonly)

Additional options related to the Slurm scheduler.



105
106
107
# File 'pcs/cfn_compute_node_group_props.rb', line 105

def slurm_configuration
  @slurm_configuration
end

#spot_optionsAWSCDK::IResolvable, ... (readonly)

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



110
111
112
# File 'pcs/cfn_compute_node_group_props.rb', line 110

def spot_options
  @spot_options
end

#subnet_idsArray<String> (readonly)

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.



81
82
83
# File 'pcs/cfn_compute_node_group_props.rb', line 81

def subnet_ids
  @subnet_ids
end

#tagsHash{String => String}? (readonly)

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.



117
118
119
# File 'pcs/cfn_compute_node_group_props.rb', line 117

def tags
  @tags
end

Class Method Details

.jsii_propertiesObject



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'pcs/cfn_compute_node_group_props.rb', line 119

def self.jsii_properties
  {
    :cluster_id => "clusterId",
    :custom_launch_template => "customLaunchTemplate",
    :iam_instance_profile_arn => "iamInstanceProfileArn",
    :instance_configs => "instanceConfigs",
    :scaling_configuration => "scalingConfiguration",
    :subnet_ids => "subnetIds",
    :ami_id => "amiId",
    :name => "name",
    :purchase_option => "purchaseOption",
    :slurm_configuration => "slurmConfiguration",
    :spot_options => "spotOptions",
    :tags => "tags",
  }
end

Instance Method Details

#to_jsiiObject



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'pcs/cfn_compute_node_group_props.rb', line 136

def to_jsii
  result = {}
  result.merge!({
    "clusterId" => @cluster_id,
    "customLaunchTemplate" => @custom_launch_template,
    "iamInstanceProfileArn" => @iam_instance_profile_arn,
    "instanceConfigs" => @instance_configs,
    "scalingConfiguration" => @scaling_configuration,
    "subnetIds" => @subnet_ids,
    "amiId" => @ami_id,
    "name" => @name,
    "purchaseOption" => @purchase_option,
    "slurmConfiguration" => @slurm_configuration,
    "spotOptions" => @spot_options,
    "tags" => @tags,
  })
  result.compact
end