ManagedComputeEnvironmentProps Struct
Props for a ManagedComputeEnvironment.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_batch as batch } from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
declare const role: iam.Role;
declare const securityGroup: ec2.SecurityGroup;
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const managedComputeEnvironmentProps: batch.ManagedComputeEnvironmentProps = {
vpc: vpc,
// the properties below are optional
computeEnvironmentName: 'computeEnvironmentName',
enabled: false,
maxvCpus: 123,
replaceComputeEnvironment: false,
securityGroups: [securityGroup],
serviceRole: role,
spot: false,
terminateOnUpdate: false,
updateTimeout: cdk.Duration.minutes(30),
updateToLatestImageVersion: false,
vpcSubnets: {
availabilityZones: ['availabilityZones'],
onePerAz: false,
subnetFilters: [subnetFilter],
subnetGroupName: 'subnetGroupName',
subnets: [subnet],
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
},
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_batch as batch
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_iam as iam
# role: iam.Role
# security_group: ec2.SecurityGroup
# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# vpc: ec2.Vpc
managed_compute_environment_props = batch.ManagedComputeEnvironmentProps(
vpc=vpc,
# the properties below are optional
compute_environment_name="computeEnvironmentName",
enabled=False,
maxv_cpus=123,
replace_compute_environment=False,
security_groups=[security_group],
service_role=role,
spot=False,
terminate_on_update=False,
update_timeout=cdk.Duration.minutes(30),
update_to_latest_image_version=False,
vpc_subnets=ec2.SubnetSelection(
availability_zones=["availabilityZones"],
one_per_az=False,
subnet_filters=[subnet_filter],
subnet_group_name="subnetGroupName",
subnets=[subnet],
subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
)
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.batch.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.iam.*;
Role role;
SecurityGroup securityGroup;
Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;
ManagedComputeEnvironmentProps managedComputeEnvironmentProps = ManagedComputeEnvironmentProps.builder()
.vpc(vpc)
// the properties below are optional
.computeEnvironmentName("computeEnvironmentName")
.enabled(false)
.maxvCpus(123)
.replaceComputeEnvironment(false)
.securityGroups(List.of(securityGroup))
.serviceRole(role)
.spot(false)
.terminateOnUpdate(false)
.updateTimeout(Duration.minutes(30))
.updateToLatestImageVersion(false)
.vpcSubnets(SubnetSelection.builder()
.availabilityZones(List.of("availabilityZones"))
.onePerAz(false)
.subnetFilters(List.of(subnetFilter))
.subnetGroupName("subnetGroupName")
.subnets(List.of(subnet))
.subnetType(SubnetType.PRIVATE_ISOLATED)
.build())
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Batch;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.IAM;
Role role;
SecurityGroup securityGroup;
Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;
var managedComputeEnvironmentProps = new ManagedComputeEnvironmentProps {
Vpc = vpc,
// the properties below are optional
ComputeEnvironmentName = "computeEnvironmentName",
Enabled = false,
MaxvCpus = 123,
ReplaceComputeEnvironment = false,
SecurityGroups = new [] { securityGroup },
ServiceRole = role,
Spot = false,
TerminateOnUpdate = false,
UpdateTimeout = Duration.Minutes(30),
UpdateToLatestImageVersion = false,
VpcSubnets = new SubnetSelection {
AvailabilityZones = new [] { "availabilityZones" },
OnePerAz = false,
SubnetFilters = new [] { subnetFilter },
SubnetGroupName = "subnetGroupName",
Subnets = new [] { subnet },
SubnetType = SubnetType.PRIVATE_ISOLATED
}
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var role Role
var securityGroup SecurityGroup
var subnet Subnet
var subnetFilter SubnetFilter
var vpc Vpc
managedComputeEnvironmentProps := &ManagedComputeEnvironmentProps{
Vpc: vpc,
// the properties below are optional
ComputeEnvironmentName: jsii.String("computeEnvironmentName"),
Enabled: jsii.Boolean(false),
MaxvCpus: jsii.Number(123),
ReplaceComputeEnvironment: jsii.Boolean(false),
SecurityGroups: []ISecurityGroup{
securityGroup,
},
ServiceRole: role,
Spot: jsii.Boolean(false),
TerminateOnUpdate: jsii.Boolean(false),
UpdateTimeout: cdk.Duration_Minutes(jsii.Number(30)),
UpdateToLatestImageVersion: jsii.Boolean(false),
VpcSubnets: &SubnetSelection{
AvailabilityZones: []*string{
jsii.String("availabilityZones"),
},
OnePerAz: jsii.Boolean(false),
SubnetFilters: []SubnetFilter{
subnetFilter,
},
SubnetGroupName: jsii.String("subnetGroupName"),
Subnets: []ISubnet{
subnet,
},
SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED,
},
}
Properties
computeEnvironmentNameoptionalstringcompute_environment_nameoptionalstrcomputeEnvironmentNameoptionalStringComputeEnvironmentNameoptionalstringComputeEnvironmentNameoptional*string#Default: generated by CloudFormation
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool= true#notes
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 minvCpus.
To ensure you aren't billed for unused capacity, set minvCpus to 0.
maxvCpusoptionalnumbermaxv_cpusoptionalint | floatmaxvCpusoptionalNumberMaxvCpusoptionaldoubleMaxvCpusoptional*float64= 256#notes
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 instanceTypes or instanceClasses.
replaceComputeEnvironmentoptionalbooleanreplace_compute_environmentoptionalboolreplaceComputeEnvironmentoptionalBooleanReplaceComputeEnvironmentoptionalboolReplaceComputeEnvironmentoptional*bool= false#notes
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:
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#Default: new security groups will be created
serviceRoleoptionalIRoleservice_roleoptionalIRoleserviceRoleoptionalIRoleServiceRoleoptionalIRoleServiceRoleoptionalIRole#Default: a serviceRole will be created for managed CEs, none for unmanaged CEs
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.
terminateOnUpdateoptionalbooleanterminate_on_updateoptionalboolterminateOnUpdateoptionalBooleanTerminateOnUpdateoptionalboolTerminateOnUpdateoptional*bool= false#If this is enabled, any terminated jobs may be retried, depending on the job's retry policy.
updateTimeoutoptionalDurationupdate_timeoutoptionalDurationupdateTimeoutoptionalDurationUpdateTimeoutoptionalDurationUpdateTimeoutoptionalDuration#Default: 30 minutes
If so, when an infrastructure update is triggered, any running jobs will be allowed to run until updateTimeout has expired.
updateToLatestImageVersionoptionalbooleanupdate_to_latest_image_versionoptionalboolupdateToLatestImageVersionoptionalBooleanUpdateToLatestImageVersionoptionalboolUpdateToLatestImageVersionoptional*bool= false#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.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#Default: new subnets will be created