Class: AWSCDK::Batch::FargateComputeEnvironmentProps
- Inherits:
-
ManagedComputeEnvironmentProps
- Object
- ManagedComputeEnvironmentProps
- AWSCDK::Batch::FargateComputeEnvironmentProps
- Defined in:
- batch/fargate_compute_environment_props.rb
Overview
Props for a FargateComputeEnvironment.
Instance Attribute Summary collapse
-
#compute_environment_name ⇒ String?
readonly
The name of the ComputeEnvironment.
-
#enabled ⇒ Boolean?
readonly
Whether or not this ComputeEnvironment can accept jobs from a Queue.
-
#maxv_cpus ⇒ Numeric?
readonly
The maximum vCpus this
ManagedComputeEnvironmentcan scale up to. -
#replace_compute_environment ⇒ Boolean?
readonly
Specifies whether this Compute Environment is replaced if an update is made that requires replacing its instances.
-
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>?
readonly
The security groups this Compute Environment will launch instances in.
-
#service_role ⇒ AWSCDK::IAM::IRole?
readonly
The role Batch uses to perform actions on your behalf in your account, such as provision instances to run your jobs.
-
#spot ⇒ Boolean?
readonly
Whether or not to use spot instances.
-
#terminate_on_update ⇒ Boolean?
readonly
Whether or not any running jobs will be immediately terminated when an infrastructure update occurs.
-
#update_timeout ⇒ AWSCDK::Duration?
readonly
Only meaningful if
terminateOnUpdateisfalse. -
#update_to_latest_image_version ⇒ Boolean?
readonly
Whether or not the AMI is updated to the latest one supported by Batch when an infrastructure update occurs.
-
#vpc ⇒ AWSCDK::EC2::IVPC
readonly
VPC in which this Compute Environment will launch Instances.
-
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection?
readonly
The VPC Subnets this Compute Environment will launch instances in.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(compute_environment_name: nil, enabled: nil, service_role: nil, vpc:, maxv_cpus: nil, replace_compute_environment: nil, security_groups: nil, spot: nil, terminate_on_update: nil, update_timeout: nil, update_to_latest_image_version: nil, vpc_subnets: nil) ⇒ FargateComputeEnvironmentProps
constructor
A new instance of FargateComputeEnvironmentProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(compute_environment_name: nil, enabled: nil, service_role: nil, vpc:, maxv_cpus: nil, replace_compute_environment: nil, security_groups: nil, spot: nil, terminate_on_update: nil, update_timeout: nil, update_to_latest_image_version: nil, vpc_subnets: nil) ⇒ FargateComputeEnvironmentProps
Returns a new instance of FargateComputeEnvironmentProps.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'batch/fargate_compute_environment_props.rb', line 19 def initialize(compute_environment_name: nil, enabled: nil, service_role: nil, vpc:, maxv_cpus: nil, replace_compute_environment: nil, security_groups: nil, spot: nil, terminate_on_update: nil, update_timeout: nil, update_to_latest_image_version: nil, vpc_subnets: nil) @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? @enabled = enabled Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil? @service_role = service_role Jsii::Type.check_type(@service_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "serviceRole") unless @service_role.nil? @vpc = vpc Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") @maxv_cpus = maxv_cpus Jsii::Type.check_type(@maxv_cpus, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxvCpus") unless @maxv_cpus.nil? @replace_compute_environment = replace_compute_environment Jsii::Type.check_type(@replace_compute_environment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "replaceComputeEnvironment") unless @replace_compute_environment.nil? @security_groups = security_groups Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil? @spot = spot Jsii::Type.check_type(@spot, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "spot") unless @spot.nil? @terminate_on_update = terminate_on_update Jsii::Type.check_type(@terminate_on_update, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "terminateOnUpdate") unless @terminate_on_update.nil? @update_timeout = update_timeout Jsii::Type.check_type(@update_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "updateTimeout") unless @update_timeout.nil? @update_to_latest_image_version = update_to_latest_image_version Jsii::Type.check_type(@update_to_latest_image_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "updateToLatestImageVersion") unless @update_to_latest_image_version.nil? @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil? end |
Instance Attribute Details
#compute_environment_name ⇒ String? (readonly)
Default: - generated by CloudFormation
The name of the ComputeEnvironment.
50 51 52 |
# File 'batch/fargate_compute_environment_props.rb', line 50 def compute_environment_name @compute_environment_name end |
#enabled ⇒ Boolean? (readonly)
Default: true
Whether or not this ComputeEnvironment can accept jobs from a Queue.
Enabled ComputeEnvironments can accept jobs from a Queue and can scale instances up or down. Disabled ComputeEnvironments cannot accept jobs from a Queue or scale instances up or down.
If you change a ComputeEnvironment from enabled to disabled while it is executing jobs,
Jobs in the STARTED or RUNNING states will not
be interrupted. As jobs complete, the ComputeEnvironment will scale instances down to minv_cpus.
To ensure you aren't billed for unused capacity, set minv_cpus to 0.
66 67 68 |
# File 'batch/fargate_compute_environment_props.rb', line 66 def enabled @enabled end |
#maxv_cpus ⇒ Numeric? (readonly)
Default: 256
The maximum vCpus this ManagedComputeEnvironment can scale up to. Each vCPU is equivalent to 1024 CPU shares.
Note: if this Compute Environment uses EC2 resources (not Fargate) with either AllocationStrategy.BEST_FIT_PROGRESSIVE or
AllocationStrategy.SPOT_CAPACITY_OPTIMIZED, or AllocationStrategy.BEST_FIT with Spot instances,
The scheduler may exceed this number by at most one of the instances specified in instance_types
or instance_classes.
85 86 87 |
# File 'batch/fargate_compute_environment_props.rb', line 85 def maxv_cpus @maxv_cpus end |
#replace_compute_environment ⇒ Boolean? (readonly)
Default: false
Specifies whether this Compute Environment is replaced if an update is made that requires replacing its instances.
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.
The properties which require a replacement of the Compute Environment are:
103 104 105 |
# File 'batch/fargate_compute_environment_props.rb', line 103 def replace_compute_environment @replace_compute_environment end |
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>? (readonly)
Default: new security groups will be created
The security groups this Compute Environment will launch instances in.
108 109 110 |
# File 'batch/fargate_compute_environment_props.rb', line 108 def security_groups @security_groups end |
#service_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - a serviceRole will be created for managed CEs, none for unmanaged CEs
The role Batch uses to perform actions on your behalf in your account, such as provision instances to run your jobs.
71 72 73 |
# File 'batch/fargate_compute_environment_props.rb', line 71 def service_role @service_role end |
#spot ⇒ Boolean? (readonly)
Default: false
Whether or not to use spot instances.
Spot instances are less expensive EC2 instances that can be reclaimed by EC2 at any time; your job will be given two minutes of notice before reclamation.
117 118 119 |
# File 'batch/fargate_compute_environment_props.rb', line 117 def spot @spot end |
#terminate_on_update ⇒ Boolean? (readonly)
Default: false
Whether or not any running jobs will be immediately terminated when an infrastructure update occurs.
If this is enabled, any terminated jobs may be retried, depending on the job's retry policy.
126 127 128 |
# File 'batch/fargate_compute_environment_props.rb', line 126 def terminate_on_update @terminate_on_update end |
#update_timeout ⇒ AWSCDK::Duration? (readonly)
Default: 30 minutes
Only meaningful if terminateOnUpdate is false.
If so,
when an infrastructure update is triggered, any running jobs
will be allowed to run until update_timeout has expired.
136 137 138 |
# File 'batch/fargate_compute_environment_props.rb', line 136 def update_timeout @update_timeout end |
#update_to_latest_image_version ⇒ Boolean? (readonly)
Default: false
Whether or not the AMI is updated to the latest one supported by Batch when an infrastructure update occurs.
If you specify a specific AMI, this property will be ignored.
Note: the CDK will never set this value by default, false will set by CFN.
This is to avoid a deployment failure that occurs when this value is set.
147 148 149 |
# File 'batch/fargate_compute_environment_props.rb', line 147 def update_to_latest_image_version @update_to_latest_image_version end |
#vpc ⇒ AWSCDK::EC2::IVPC (readonly)
VPC in which this Compute Environment will launch Instances.
75 76 77 |
# File 'batch/fargate_compute_environment_props.rb', line 75 def vpc @vpc end |
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: new subnets will be created
The VPC Subnets this Compute Environment will launch instances in.
152 153 154 |
# File 'batch/fargate_compute_environment_props.rb', line 152 def vpc_subnets @vpc_subnets end |
Class Method Details
.jsii_properties ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'batch/fargate_compute_environment_props.rb', line 154 def self.jsii_properties { :compute_environment_name => "computeEnvironmentName", :enabled => "enabled", :service_role => "serviceRole", :vpc => "vpc", :maxv_cpus => "maxvCpus", :replace_compute_environment => "replaceComputeEnvironment", :security_groups => "securityGroups", :spot => "spot", :terminate_on_update => "terminateOnUpdate", :update_timeout => "updateTimeout", :update_to_latest_image_version => "updateToLatestImageVersion", :vpc_subnets => "vpcSubnets", } end |
Instance Method Details
#to_jsii ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'batch/fargate_compute_environment_props.rb', line 171 def to_jsii result = {} result.merge!(super) result.merge!({ "computeEnvironmentName" => @compute_environment_name, "enabled" => @enabled, "serviceRole" => @service_role, "vpc" => @vpc, "maxvCpus" => @maxv_cpus, "replaceComputeEnvironment" => @replace_compute_environment, "securityGroups" => @security_groups, "spot" => @spot, "terminateOnUpdate" => @terminate_on_update, "updateTimeout" => @update_timeout, "updateToLatestImageVersion" => @update_to_latest_image_version, "vpcSubnets" => @vpc_subnets, }) result.compact end |