Class: AWSCDK::Batch::CfnComputeEnvironmentProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
batch/cfn_compute_environment_props.rb

Overview

Properties for defining a CfnComputeEnvironment.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, compute_environment_name: nil, compute_resources: nil, context: nil, eks_configuration: nil, replace_compute_environment: nil, service_role: nil, state: nil, tags: nil, unmanagedv_cpus: nil, update_policy: nil) ⇒ CfnComputeEnvironmentProps

Returns a new instance of CfnComputeEnvironmentProps.

Parameters:

  • type (String)

    The type of the compute environment: MANAGED or UNMANAGED .

  • compute_environment_name (String, nil) (defaults to: nil)

    The name for your compute environment.

  • compute_resources (AWSCDK::IResolvable, AWSCDK::Batch::CfnComputeEnvironment::ComputeResourcesProperty, nil) (defaults to: nil)

    The ComputeResources property type specifies details of the compute resources managed by the compute environment.

  • context (String, nil) (defaults to: nil)

    Reserved.

  • eks_configuration (AWSCDK::IResolvable, AWSCDK::Batch::CfnComputeEnvironment::EKSConfigurationProperty, nil) (defaults to: nil)

    The details for the Amazon EKS cluster that supports the compute environment.

  • replace_compute_environment (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether the compute environment is replaced if an update is made that requires replacing the instances in the compute environment.

  • service_role (String, AWSCDK::Interfaces::AWSIAM::IRoleRef, nil) (defaults to: nil)

    The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.

  • state (String, nil) (defaults to: nil)

    The state of the compute environment.

  • tags (Hash{String => String}, nil) (defaults to: nil)

    The tags applied to the compute environment.

  • unmanagedv_cpus (Numeric, nil) (defaults to: nil)

    The maximum number of vCPUs for an unmanaged compute environment.

  • update_policy (AWSCDK::IResolvable, AWSCDK::Batch::CfnComputeEnvironment::UpdatePolicyProperty, nil) (defaults to: nil)

    Specifies the infrastructure update policy for the compute environment.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'batch/cfn_compute_environment_props.rb', line 20

def initialize(type:, compute_environment_name: nil, compute_resources: nil, context: nil, eks_configuration: nil, replace_compute_environment: nil, service_role: nil, state: nil, tags: nil, unmanagedv_cpus: nil, update_policy: nil)
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type")
  @compute_environment_name = compute_environment_name
  Jsii::Type.check_type(@compute_environment_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "computeEnvironmentName") unless @compute_environment_name.nil?
  @compute_resources = compute_resources.is_a?(Hash) ? ::AWSCDK::Batch::CfnComputeEnvironment::ComputeResourcesProperty.new(**compute_resources.transform_keys(&:to_sym)) : compute_resources
  Jsii::Type.check_type(@compute_resources, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Db21wdXRlRW52aXJvbm1lbnQuQ29tcHV0ZVJlc291cmNlc1Byb3BlcnR5In1dfX0=")), "computeResources") unless @compute_resources.nil?
  @context = context
  Jsii::Type.check_type(@context, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "context") unless @context.nil?
  @eks_configuration = eks_configuration.is_a?(Hash) ? ::AWSCDK::Batch::CfnComputeEnvironment::EKSConfigurationProperty.new(**eks_configuration.transform_keys(&:to_sym)) : eks_configuration
  Jsii::Type.check_type(@eks_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Db21wdXRlRW52aXJvbm1lbnQuRWtzQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "eksConfiguration") unless @eks_configuration.nil?
  @replace_compute_environment = replace_compute_environment
  Jsii::Type.check_type(@replace_compute_environment, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "replaceComputeEnvironment") unless @replace_compute_environment.nil?
  @service_role = service_role
  Jsii::Type.check_type(@service_role, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifV19fQ==")), "serviceRole") unless @service_role.nil?
  @state = state
  Jsii::Type.check_type(@state, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "state") unless @state.nil?
  @tags = tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "tags") unless @tags.nil?
  @unmanagedv_cpus = unmanagedv_cpus
  Jsii::Type.check_type(@unmanagedv_cpus, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "unmanagedvCpus") unless @unmanagedv_cpus.nil?
  @update_policy = update_policy.is_a?(Hash) ? ::AWSCDK::Batch::CfnComputeEnvironment::UpdatePolicyProperty.new(**update_policy.transform_keys(&:to_sym)) : update_policy
  Jsii::Type.check_type(@update_policy, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Db21wdXRlRW52aXJvbm1lbnQuVXBkYXRlUG9saWN5UHJvcGVydHkifV19fQ==")), "updatePolicy") unless @update_policy.nil?
end

Instance Attribute Details

#compute_environment_nameString? (readonly)

The name for your compute environment.

It can be up to 128 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).



58
59
60
# File 'batch/cfn_compute_environment_props.rb', line 58

def compute_environment_name
  @compute_environment_name
end

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

The ComputeResources property type specifies details of the compute resources managed by the compute environment.

This parameter is required for managed compute environments. For more information, see Compute Environments in the ** .



65
66
67
# File 'batch/cfn_compute_environment_props.rb', line 65

def compute_resources
  @compute_resources
end

#contextString? (readonly)

Reserved.



70
71
72
# File 'batch/cfn_compute_environment_props.rb', line 70

def context
  @context
end

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

The details for the Amazon EKS cluster that supports the compute environment.

To create a compute environment that uses EKS resources, the caller must have permissions to call eks:DescribeCluster .



77
78
79
# File 'batch/cfn_compute_environment_props.rb', line 77

def eks_configuration
  @eks_configuration
end

#replace_compute_environmentBoolean, ... (readonly)

Note:

Default: - true

Specifies whether the compute environment is replaced if an update is made that requires replacing the instances in the compute environment.

The default value is true . To enable more properties to be updated, set this property to false . When changing the value of this property to false , do not change any other properties at the same time. If other properties are changed at the same time, and the change needs to be rolled back but it can't, it's possible for the stack to go into the UPDATE_ROLLBACK_FAILED state. You can't update a stack that is in the UPDATE_ROLLBACK_FAILED state. However, if you can continue to roll it back, you can return the stack to its original settings and then try to update it again. For more information, see Continue rolling back an update in the AWS CloudFormation User Guide .

ReplaceComputeEnvironment is not applicable for Fargate compute environments. Fargate compute environments are always updated without interruption.

The properties that can't be changed without replacing the compute environment are in the ComputeResources property type: AllocationStrategy , BidPercentage , Ec2Configuration , Ec2KeyPair , Ec2KeyPair , ImageId , InstanceRole , InstanceTypes , LaunchTemplate , MaxvCpus , MinvCpus , PlacementGroup , SecurityGroupIds , Subnets , Tags , Type , and UpdateToLatestImageVersion .



89
90
91
# File 'batch/cfn_compute_environment_props.rb', line 89

def replace_compute_environment
  @replace_compute_environment
end

#service_roleString, ... (readonly)

The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.

For more information, see AWS Batch service IAM role in the AWS Batch User Guide .

If your account already created the AWS Batch service-linked role, that role is used by default for your compute environment unless you specify a different role here. If the AWS Batch service-linked role doesn't exist in your account, and no role is specified here, the service attempts to create the AWS Batch service-linked role in your account.

If your specified role has a path other than / , then you must specify either the full role ARN (recommended) or prefix the role name with the path. For example, if a role with the name bar has a path of /foo/ , specify /foo/bar as the role name. For more information, see Friendly names and paths in the IAM User Guide .

Depending on how you created your AWS Batch service role, its ARN might contain the service-role path prefix. When you only specify the name of the service role, AWS Batch assumes that your ARN doesn't use the service-role path prefix. Because of this, we recommend that you specify the full ARN of your service role when you create compute environments.



102
103
104
# File 'batch/cfn_compute_environment_props.rb', line 102

def service_role
  @service_role
end

#stateString? (readonly)

The state of the compute environment.

If the state is ENABLED , then the compute environment accepts jobs from a queue and can scale out automatically based on queues.

If the state is ENABLED , then the AWS Batch scheduler can attempt to place jobs from an associated job queue on the compute resources within the environment. If the compute environment is managed, then it can scale its instances out or in automatically, based on the job queue demand.

If the state is DISABLED , then the AWS Batch scheduler doesn't attempt to place jobs within the environment. Jobs in a STARTING or RUNNING state continue to progress normally. Managed compute environments in the DISABLED state don't scale out.

Compute environments in a DISABLED state may continue to incur billing charges. To prevent additional charges, turn off and then delete the compute environment. For more information, see State in the AWS Batch User Guide .

When an instance is idle, the instance scales down to the minv_cpus value. However, the instance size doesn't change. For example, consider a c5.8xlarge instance with a minv_cpus value of 4 and a desiredv_cpus value of 36 . This instance doesn't scale down to a c5.large instance.



117
118
119
# File 'batch/cfn_compute_environment_props.rb', line 117

def state
  @state
end

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

The tags applied to the compute environment.



122
123
124
# File 'batch/cfn_compute_environment_props.rb', line 122

def tags
  @tags
end

#typeString (readonly)

The type of the compute environment: MANAGED or UNMANAGED .

For more information, see Compute Environments in the AWS Batch User Guide .



51
52
53
# File 'batch/cfn_compute_environment_props.rb', line 51

def type
  @type
end

#unmanagedv_cpusNumeric? (readonly)

The maximum number of vCPUs for an unmanaged compute environment.

This parameter is only used for fair-share scheduling to reserve vCPU capacity for new share identifiers. If this parameter isn't provided for a fair-share job queue, no vCPU capacity is reserved.

This parameter is only supported when the type parameter is set to UNMANAGED .



131
132
133
# File 'batch/cfn_compute_environment_props.rb', line 131

def unmanagedv_cpus
  @unmanagedv_cpus
end

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

Specifies the infrastructure update policy for the compute environment.

For more information about infrastructure updates, see Updating compute environments in the AWS Batch User Guide .



138
139
140
# File 'batch/cfn_compute_environment_props.rb', line 138

def update_policy
  @update_policy
end

Class Method Details

.jsii_propertiesObject



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'batch/cfn_compute_environment_props.rb', line 140

def self.jsii_properties
  {
    :type => "type",
    :compute_environment_name => "computeEnvironmentName",
    :compute_resources => "computeResources",
    :context => "context",
    :eks_configuration => "eksConfiguration",
    :replace_compute_environment => "replaceComputeEnvironment",
    :service_role => "serviceRole",
    :state => "state",
    :tags => "tags",
    :unmanagedv_cpus => "unmanagedvCpus",
    :update_policy => "updatePolicy",
  }
end

Instance Method Details

#to_jsiiObject



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'batch/cfn_compute_environment_props.rb', line 156

def to_jsii
  result = {}
  result.merge!({
    "type" => @type,
    "computeEnvironmentName" => @compute_environment_name,
    "computeResources" => @compute_resources,
    "context" => @context,
    "eksConfiguration" => @eks_configuration,
    "replaceComputeEnvironment" => @replace_compute_environment,
    "serviceRole" => @service_role,
    "state" => @state,
    "tags" => @tags,
    "unmanagedvCpus" => @unmanagedv_cpus,
    "updatePolicy" => @update_policy,
  })
  result.compact
end