if (FALSE) {
# This example creates a managed compute environment with specific C4
# instance types that are launched on demand. The compute environment is
# called C4OnDemand.
svc$create_compute_environment(
type = "MANAGED",
computeEnvironmentName = "C4OnDemand",
computeResources = list(
type = "EC2",
desiredvCpus = 48L,
ec2KeyPair = "id_rsa",
instanceRole = "ecsInstanceRole",
instanceTypes = list(
"c4.large",
"c4.xlarge",
"c4.2xlarge",
"c4.4xlarge",
"c4.8xlarge"
),
maxvCpus = 128L,
minvCpus = 0L,
securityGroupIds = list(
"sg-cf5093b2"
),
subnets = list(
"subnet-220c0e0a",
"subnet-1a95556d",
"subnet-978f6dce"
),
tags = list(
Name = "Batch Instance - C4OnDemand"
)
),
serviceRole = "arn:aws:iam::012345678910:role/AWSBatchServiceRole",
state = "ENABLED"
)
# This example creates a managed compute environment with the M4 instance
# type that is launched when the Spot bid price is at or below 20% of the
# On-Demand price for the instance type. The compute environment is called
# M4Spot.
svc$create_compute_environment(
type = "MANAGED",
computeEnvironmentName = "M4Spot",
computeResources = list(
type = "SPOT",
bidPercentage = 20L,
desiredvCpus = 4L,
ec2KeyPair = "id_rsa",
instanceRole = "ecsInstanceRole",
instanceTypes = list(
"m4"
),
maxvCpus = 128L,
minvCpus = 0L,
securityGroupIds = list(
"sg-cf5093b2"
),
spotIamFleetRole = "arn:aws:iam::012345678910:role/aws-ec2-spot-fleet-role",
subnets = list(
"subnet-220c0e0a",
"subnet-1a95556d",
"subnet-978f6dce"
),
tags = list(
Name = "Batch Instance - M4Spot"
)
),
serviceRole = "arn:aws:iam::012345678910:role/AWSBatchServiceRole",
state = "ENABLED"
)
}
Run the code above in your browser using DataLab