public void BatchCreateComputeEnvironment() { #region to-create-a-managed-ec2-compute-environment-1481152600017 var client = new AmazonBatchClient(); var response = client.CreateComputeEnvironment(new CreateComputeEnvironmentRequest { Type = "MANAGED", ComputeEnvironmentName = "C4OnDemand", ComputeResources = new ComputeResource { Type = "EC2", DesiredvCpus = 48, Ec2KeyPair = "id_rsa", InstanceRole = "ecsInstanceRole", InstanceTypes = new List <string> { "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge" }, MaxvCpus = 128, MinvCpus = 0, SecurityGroupIds = new List <string> { "sg-cf5093b2" }, Subnets = new List <string> { "subnet-220c0e0a", "subnet-1a95556d", "subnet-978f6dce" }, Tags = new Dictionary <string, string> { { "Name", "Batch Instance - C4OnDemand" } } }, ServiceRole = "arn:aws:iam::012345678910:role/AWSBatchServiceRole", State = "ENABLED" }); string computeEnvironmentArn = response.ComputeEnvironmentArn; string computeEnvironmentName = response.ComputeEnvironmentName; #endregion }
public void BatchCreateComputeEnvironment() { #region to-create-a-managed-ec2-spot-compute-environment-1481152844190 var client = new AmazonBatchClient(); var response = client.CreateComputeEnvironment(new CreateComputeEnvironmentRequest { Type = "MANAGED", ComputeEnvironmentName = "M4Spot", ComputeResources = new ComputeResource { Type = "SPOT", BidPercentage = 20, DesiredvCpus = 4, Ec2KeyPair = "id_rsa", InstanceRole = "ecsInstanceRole", InstanceTypes = new List <string> { "m4" }, MaxvCpus = 128, MinvCpus = 0, SecurityGroupIds = new List <string> { "sg-cf5093b2" }, SpotIamFleetRole = "arn:aws:iam::012345678910:role/aws-ec2-spot-fleet-role", Subnets = new List <string> { "subnet-220c0e0a", "subnet-1a95556d", "subnet-978f6dce" }, Tags = new Dictionary <string, string> { { "Name", "Batch Instance - M4Spot" } } }, ServiceRole = "arn:aws:iam::012345678910:role/AWSBatchServiceRole", State = "ENABLED" }); string computeEnvironmentArn = response.ComputeEnvironmentArn; string computeEnvironmentName = response.ComputeEnvironmentName; #endregion }