AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

ComputeEnvironment

Creates a AWS Batch compute environment. Compute environments contain the Amazon ECS container instances that are used to run containerized batch jobs.

For information about AWS Batch, see What is AWS Batch? . For information about compute environment, see Compute Environments .

Note: To prevent a race condition during environment deletion, make sure to set depends_on to the related aws.iam.RolePolicyAttachment; otherwise, the policy may be destroyed too soon and the compute environment will then get stuck in the DELETING state, see Troubleshooting AWS Batch .

Example Usage

EC2 Type

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var ecsInstanceRoleRole = new Aws.Iam.Role("ecsInstanceRoleRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
    ""Version"": ""2012-10-17"",
    ""Statement"": [
	{
	    ""Action"": ""sts:AssumeRole"",
	    ""Effect"": ""Allow"",
	    ""Principal"": {
	        ""Service"": ""ec2.amazonaws.com""
	    }
	}
    ]
}
",
        });
        var ecsInstanceRoleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
        {
            Role = ecsInstanceRoleRole.Name,
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role",
        });
        var ecsInstanceRoleInstanceProfile = new Aws.Iam.InstanceProfile("ecsInstanceRoleInstanceProfile", new Aws.Iam.InstanceProfileArgs
        {
            Role = ecsInstanceRoleRole.Name,
        });
        var awsBatchServiceRoleRole = new Aws.Iam.Role("awsBatchServiceRoleRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
    ""Version"": ""2012-10-17"",
    ""Statement"": [
	{
	    ""Action"": ""sts:AssumeRole"",
	    ""Effect"": ""Allow"",
	    ""Principal"": {
		""Service"": ""batch.amazonaws.com""
	    }
	}
    ]
}
",
        });
        var awsBatchServiceRoleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
        {
            Role = awsBatchServiceRoleRole.Name,
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole",
        });
        var sampleVpc = new Aws.Ec2.Vpc("sampleVpc", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.1.0.0/16",
        });
        var sampleSecurityGroup = new Aws.Ec2.SecurityGroup("sampleSecurityGroup", new Aws.Ec2.SecurityGroupArgs
        {
            VpcId = sampleVpc.Id,
            Egress = 
            {
                new Aws.Ec2.Inputs.SecurityGroupEgressArgs
                {
                    FromPort = 0,
                    ToPort = 0,
                    Protocol = "-1",
                    CidrBlocks = 
                    {
                        "0.0.0.0/0",
                    },
                },
            },
        });
        var sampleSubnet = new Aws.Ec2.Subnet("sampleSubnet", new Aws.Ec2.SubnetArgs
        {
            VpcId = sampleVpc.Id,
            CidrBlock = "10.1.1.0/24",
        });
        var sampleComputeEnvironment = new Aws.Batch.ComputeEnvironment("sampleComputeEnvironment", new Aws.Batch.ComputeEnvironmentArgs
        {
            ComputeEnvironmentName = "sample",
            ComputeResources = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesArgs
            {
                InstanceRole = ecsInstanceRoleInstanceProfile.Arn,
                InstanceTypes = 
                {
                    "c4.large",
                },
                MaxVcpus = 16,
                MinVcpus = 0,
                SecurityGroupIds = 
                {
                    sampleSecurityGroup.Id,
                },
                Subnets = 
                {
                    sampleSubnet.Id,
                },
                Type = "EC2",
            },
            ServiceRole = awsBatchServiceRoleRole.Arn,
            Type = "MANAGED",
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                awsBatchServiceRoleRolePolicyAttachment,
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/batch"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ecsInstanceRoleRole, err := iam.NewRole(ctx, "ecsInstanceRoleRole", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "    \"Version\": \"2012-10-17\",\n", "    \"Statement\": [\n", "	{\n", "	    \"Action\": \"sts:AssumeRole\",\n", "	    \"Effect\": \"Allow\",\n", "	    \"Principal\": {\n", "	        \"Service\": \"ec2.amazonaws.com\"\n", "	    }\n", "	}\n", "    ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewRolePolicyAttachment(ctx, "ecsInstanceRoleRolePolicyAttachment", &iam.RolePolicyAttachmentArgs{
			Role:      ecsInstanceRoleRole.Name,
			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"),
		})
		if err != nil {
			return err
		}
		ecsInstanceRoleInstanceProfile, err := iam.NewInstanceProfile(ctx, "ecsInstanceRoleInstanceProfile", &iam.InstanceProfileArgs{
			Role: ecsInstanceRoleRole.Name,
		})
		if err != nil {
			return err
		}
		awsBatchServiceRoleRole, err := iam.NewRole(ctx, "awsBatchServiceRoleRole", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "    \"Version\": \"2012-10-17\",\n", "    \"Statement\": [\n", "	{\n", "	    \"Action\": \"sts:AssumeRole\",\n", "	    \"Effect\": \"Allow\",\n", "	    \"Principal\": {\n", "		\"Service\": \"batch.amazonaws.com\"\n", "	    }\n", "	}\n", "    ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		awsBatchServiceRoleRolePolicyAttachment, err := iam.NewRolePolicyAttachment(ctx, "awsBatchServiceRoleRolePolicyAttachment", &iam.RolePolicyAttachmentArgs{
			Role:      awsBatchServiceRoleRole.Name,
			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole"),
		})
		if err != nil {
			return err
		}
		sampleVpc, err := ec2.NewVpc(ctx, "sampleVpc", &ec2.VpcArgs{
			CidrBlock: pulumi.String("10.1.0.0/16"),
		})
		if err != nil {
			return err
		}
		sampleSecurityGroup, err := ec2.NewSecurityGroup(ctx, "sampleSecurityGroup", &ec2.SecurityGroupArgs{
			VpcId: sampleVpc.ID(),
			Egress: ec2.SecurityGroupEgressArray{
				&ec2.SecurityGroupEgressArgs{
					FromPort: pulumi.Int(0),
					ToPort:   pulumi.Int(0),
					Protocol: pulumi.String("-1"),
					CidrBlocks: pulumi.StringArray{
						pulumi.String("0.0.0.0/0"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		sampleSubnet, err := ec2.NewSubnet(ctx, "sampleSubnet", &ec2.SubnetArgs{
			VpcId:     sampleVpc.ID(),
			CidrBlock: pulumi.String("10.1.1.0/24"),
		})
		if err != nil {
			return err
		}
		_, err = batch.NewComputeEnvironment(ctx, "sampleComputeEnvironment", &batch.ComputeEnvironmentArgs{
			ComputeEnvironmentName: pulumi.String("sample"),
			ComputeResources: &batch.ComputeEnvironmentComputeResourcesArgs{
				InstanceRole: ecsInstanceRoleInstanceProfile.Arn,
				InstanceTypes: pulumi.StringArray{
					pulumi.String("c4.large"),
				},
				MaxVcpus: pulumi.Int(16),
				MinVcpus: pulumi.Int(0),
				SecurityGroupIds: pulumi.StringArray{
					sampleSecurityGroup.ID(),
				},
				Subnets: pulumi.StringArray{
					sampleSubnet.ID(),
				},
				Type: pulumi.String("EC2"),
			},
			ServiceRole: awsBatchServiceRoleRole.Arn,
			Type:        pulumi.String("MANAGED"),
		}, pulumi.DependsOn([]pulumi.Resource{
			awsBatchServiceRoleRolePolicyAttachment,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
import com.pulumi.resources.CustomResourceOptions;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var ecsInstanceRoleRole = new Role("ecsInstanceRoleRole", RoleArgs.builder()        
            .assumeRolePolicy("""
{
    "Version": "2012-10-17",
    "Statement": [
	{
	    "Action": "sts:AssumeRole",
	    "Effect": "Allow",
	    "Principal": {
	        "Service": "ec2.amazonaws.com"
	    }
	}
    ]
}
            """)
            .build());

        var ecsInstanceRoleRolePolicyAttachment = new RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()        
            .role(ecsInstanceRoleRole.name())
            .policyArn("arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role")
            .build());

        var ecsInstanceRoleInstanceProfile = new InstanceProfile("ecsInstanceRoleInstanceProfile", InstanceProfileArgs.builder()        
            .role(ecsInstanceRoleRole.name())
            .build());

        var awsBatchServiceRoleRole = new Role("awsBatchServiceRoleRole", RoleArgs.builder()        
            .assumeRolePolicy("""
{
    "Version": "2012-10-17",
    "Statement": [
	{
	    "Action": "sts:AssumeRole",
	    "Effect": "Allow",
	    "Principal": {
		"Service": "batch.amazonaws.com"
	    }
	}
    ]
}
            """)
            .build());

        var awsBatchServiceRoleRolePolicyAttachment = new RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()        
            .role(awsBatchServiceRoleRole.name())
            .policyArn("arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole")
            .build());

        var sampleVpc = new Vpc("sampleVpc", VpcArgs.builder()        
            .cidrBlock("10.1.0.0/16")
            .build());

        var sampleSecurityGroup = new SecurityGroup("sampleSecurityGroup", SecurityGroupArgs.builder()        
            .vpcId(sampleVpc.id())
            .egress(SecurityGroupEgressArgs.builder()
                .fromPort(0)
                .toPort(0)
                .protocol("-1")
                .cidrBlocks("0.0.0.0/0")
                .build())
            .build());

        var sampleSubnet = new Subnet("sampleSubnet", SubnetArgs.builder()        
            .vpcId(sampleVpc.id())
            .cidrBlock("10.1.1.0/24")
            .build());

        var sampleComputeEnvironment = new ComputeEnvironment("sampleComputeEnvironment", ComputeEnvironmentArgs.builder()        
            .computeEnvironmentName("sample")
            .computeResources(ComputeEnvironmentComputeResourcesArgs.builder()
                .instanceRole(ecsInstanceRoleInstanceProfile.arn())
                .instanceTypes("c4.large")
                .maxVcpus(16)
                .minVcpus(0)
                .securityGroupIds(sampleSecurityGroup.id())
                .subnets(sampleSubnet.id())
                .type("EC2")
                .build())
            .serviceRole(awsBatchServiceRoleRole.arn())
            .type("MANAGED")
            .build(), CustomResourceOptions.builder()
                .dependsOn(awsBatchServiceRoleRolePolicyAttachment)
                .build());

    }
}
import pulumi
import pulumi_aws as aws

ecs_instance_role_role = aws.iam.Role("ecsInstanceRoleRole", assume_role_policy="""{
    "Version": "2012-10-17",
    "Statement": [
	{
	    "Action": "sts:AssumeRole",
	    "Effect": "Allow",
	    "Principal": {
	        "Service": "ec2.amazonaws.com"
	    }
	}
    ]
}
""")
ecs_instance_role_role_policy_attachment = aws.iam.RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment",
    role=ecs_instance_role_role.name,
    policy_arn="arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role")
ecs_instance_role_instance_profile = aws.iam.InstanceProfile("ecsInstanceRoleInstanceProfile", role=ecs_instance_role_role.name)
aws_batch_service_role_role = aws.iam.Role("awsBatchServiceRoleRole", assume_role_policy="""{
    "Version": "2012-10-17",
    "Statement": [
	{
	    "Action": "sts:AssumeRole",
	    "Effect": "Allow",
	    "Principal": {
		"Service": "batch.amazonaws.com"
	    }
	}
    ]
}
""")
aws_batch_service_role_role_policy_attachment = aws.iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment",
    role=aws_batch_service_role_role.name,
    policy_arn="arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole")
sample_vpc = aws.ec2.Vpc("sampleVpc", cidr_block="10.1.0.0/16")
sample_security_group = aws.ec2.SecurityGroup("sampleSecurityGroup",
    vpc_id=sample_vpc.id,
    egress=[aws.ec2.SecurityGroupEgressArgs(
        from_port=0,
        to_port=0,
        protocol="-1",
        cidr_blocks=["0.0.0.0/0"],
    )])
sample_subnet = aws.ec2.Subnet("sampleSubnet",
    vpc_id=sample_vpc.id,
    cidr_block="10.1.1.0/24")
sample_compute_environment = aws.batch.ComputeEnvironment("sampleComputeEnvironment",
    compute_environment_name="sample",
    compute_resources=aws.batch.ComputeEnvironmentComputeResourcesArgs(
        instance_role=ecs_instance_role_instance_profile.arn,
        instance_types=["c4.large"],
        max_vcpus=16,
        min_vcpus=0,
        security_group_ids=[sample_security_group.id],
        subnets=[sample_subnet.id],
        type="EC2",
    ),
    service_role=aws_batch_service_role_role.arn,
    type="MANAGED",
    opts=pulumi.ResourceOptions(depends_on=[aws_batch_service_role_role_policy_attachment]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ecsInstanceRoleRole = new aws.iam.Role("ecsInstanceRoleRole", {assumeRolePolicy: `{
    "Version": "2012-10-17",
    "Statement": [
	{
	    "Action": "sts:AssumeRole",
	    "Effect": "Allow",
	    "Principal": {
	        "Service": "ec2.amazonaws.com"
	    }
	}
    ]
}
`});
const ecsInstanceRoleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment", {
    role: ecsInstanceRoleRole.name,
    policyArn: "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role",
});
const ecsInstanceRoleInstanceProfile = new aws.iam.InstanceProfile("ecsInstanceRoleInstanceProfile", {role: ecsInstanceRoleRole.name});
const awsBatchServiceRoleRole = new aws.iam.Role("awsBatchServiceRoleRole", {assumeRolePolicy: `{
    "Version": "2012-10-17",
    "Statement": [
	{
	    "Action": "sts:AssumeRole",
	    "Effect": "Allow",
	    "Principal": {
		"Service": "batch.amazonaws.com"
	    }
	}
    ]
}
`});
const awsBatchServiceRoleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", {
    role: awsBatchServiceRoleRole.name,
    policyArn: "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole",
});
const sampleVpc = new aws.ec2.Vpc("sampleVpc", {cidrBlock: "10.1.0.0/16"});
const sampleSecurityGroup = new aws.ec2.SecurityGroup("sampleSecurityGroup", {
    vpcId: sampleVpc.id,
    egress: [{
        fromPort: 0,
        toPort: 0,
        protocol: "-1",
        cidrBlocks: ["0.0.0.0/0"],
    }],
});
const sampleSubnet = new aws.ec2.Subnet("sampleSubnet", {
    vpcId: sampleVpc.id,
    cidrBlock: "10.1.1.0/24",
});
const sampleComputeEnvironment = new aws.batch.ComputeEnvironment("sampleComputeEnvironment", {
    computeEnvironmentName: "sample",
    computeResources: {
        instanceRole: ecsInstanceRoleInstanceProfile.arn,
        instanceTypes: ["c4.large"],
        maxVcpus: 16,
        minVcpus: 0,
        securityGroupIds: [sampleSecurityGroup.id],
        subnets: [sampleSubnet.id],
        type: "EC2",
    },
    serviceRole: awsBatchServiceRoleRole.arn,
    type: "MANAGED",
}, {
    dependsOn: [awsBatchServiceRoleRolePolicyAttachment],
});
resources:
  ecsInstanceRoleRole:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
            "Version": "2012-10-17",
            "Statement": [
        	{
        	    "Action": "sts:AssumeRole",
        	    "Effect": "Allow",
        	    "Principal": {
        	        "Service": "ec2.amazonaws.com"
        	    }
        	}
            ]
        }        
  ecsInstanceRoleRolePolicyAttachment:
    type: aws:iam:RolePolicyAttachment
    properties:
      role: ${ecsInstanceRoleRole.name}
      policyArn: arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role
  ecsInstanceRoleInstanceProfile:
    type: aws:iam:InstanceProfile
    properties:
      role: ${ecsInstanceRoleRole.name}
  awsBatchServiceRoleRole:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
            "Version": "2012-10-17",
            "Statement": [
        	{
        	    "Action": "sts:AssumeRole",
        	    "Effect": "Allow",
        	    "Principal": {
        		"Service": "batch.amazonaws.com"
        	    }
        	}
            ]
        }        
  awsBatchServiceRoleRolePolicyAttachment:
    type: aws:iam:RolePolicyAttachment
    properties:
      role: ${awsBatchServiceRoleRole.name}
      policyArn: arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole
  sampleVpc:
    type: aws:ec2:Vpc
    properties:
      cidrBlock: 10.1.0.0/16
  sampleSecurityGroup:
    type: aws:ec2:SecurityGroup
    properties:
      vpcId: ${sampleVpc.id}
      egress:
        - fromPort: 0
          toPort: 0
          protocol: -1
          cidrBlocks:
            - 0.0.0.0/0
  sampleSubnet:
    type: aws:ec2:Subnet
    properties:
      vpcId: ${sampleVpc.id}
      cidrBlock: 10.1.1.0/24
  sampleComputeEnvironment:
    type: aws:batch:ComputeEnvironment
    properties:
      computeEnvironmentName: sample
      computeResources:
        instanceRole: ${ecsInstanceRoleInstanceProfile.arn}
        instanceTypes:
          - c4.large
        maxVcpus: 16
        minVcpus: 0
        securityGroupIds:
          - ${sampleSecurityGroup.id}
        subnets:
          - ${sampleSubnet.id}
        type: EC2
      serviceRole: ${awsBatchServiceRoleRole.arn}
      type: MANAGED
    options:
      dependson:
        - ${awsBatchServiceRoleRolePolicyAttachment}

Fargate Type

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var sample = new Aws.Batch.ComputeEnvironment("sample", new Aws.Batch.ComputeEnvironmentArgs
        {
            ComputeEnvironmentName = "sample",
            ComputeResources = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesArgs
            {
                MaxVcpus = 16,
                SecurityGroupIds = 
                {
                    aws_security_group.Sample.Id,
                },
                Subnets = 
                {
                    aws_subnet.Sample.Id,
                },
                Type = "FARGATE",
            },
            ServiceRole = aws_iam_role.Aws_batch_service_role.Arn,
            Type = "MANAGED",
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                aws_iam_role_policy_attachment.Aws_batch_service_role,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/batch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := batch.NewComputeEnvironment(ctx, "sample", &batch.ComputeEnvironmentArgs{
			ComputeEnvironmentName: pulumi.String("sample"),
			ComputeResources: &batch.ComputeEnvironmentComputeResourcesArgs{
				MaxVcpus: pulumi.Int(16),
				SecurityGroupIds: pulumi.StringArray{
					pulumi.Any(aws_security_group.Sample.Id),
				},
				Subnets: pulumi.StringArray{
					pulumi.Any(aws_subnet.Sample.Id),
				},
				Type: pulumi.String("FARGATE"),
			},
			ServiceRole: pulumi.Any(aws_iam_role.Aws_batch_service_role.Arn),
			Type:        pulumi.String("MANAGED"),
		}, pulumi.DependsOn([]pulumi.Resource{
			aws_iam_role_policy_attachment.Aws_batch_service_role,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
import com.pulumi.resources.CustomResourceOptions;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var sample = new ComputeEnvironment("sample", ComputeEnvironmentArgs.builder()        
            .computeEnvironmentName("sample")
            .computeResources(ComputeEnvironmentComputeResourcesArgs.builder()
                .maxVcpus(16)
                .securityGroupIds(aws_security_group.sample().id())
                .subnets(aws_subnet.sample().id())
                .type("FARGATE")
                .build())
            .serviceRole(aws_iam_role.aws_batch_service_role().arn())
            .type("MANAGED")
            .build(), CustomResourceOptions.builder()
                .dependsOn(aws_iam_role_policy_attachment.aws_batch_service_role())
                .build());

    }
}
import pulumi
import pulumi_aws as aws

sample = aws.batch.ComputeEnvironment("sample",
    compute_environment_name="sample",
    compute_resources=aws.batch.ComputeEnvironmentComputeResourcesArgs(
        max_vcpus=16,
        security_group_ids=[aws_security_group["sample"]["id"]],
        subnets=[aws_subnet["sample"]["id"]],
        type="FARGATE",
    ),
    service_role=aws_iam_role["aws_batch_service_role"]["arn"],
    type="MANAGED",
    opts=pulumi.ResourceOptions(depends_on=[aws_iam_role_policy_attachment["aws_batch_service_role"]]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const sample = new aws.batch.ComputeEnvironment("sample", {
    computeEnvironmentName: "sample",
    computeResources: {
        maxVcpus: 16,
        securityGroupIds: [aws_security_group.sample.id],
        subnets: [aws_subnet.sample.id],
        type: "FARGATE",
    },
    serviceRole: aws_iam_role.aws_batch_service_role.arn,
    type: "MANAGED",
}, {
    dependsOn: [aws_iam_role_policy_attachment.aws_batch_service_role],
});
resources:
  sample:
    type: aws:batch:ComputeEnvironment
    properties:
      computeEnvironmentName: sample
      computeResources:
        maxVcpus: 16
        securityGroupIds:
          - ${aws_security_group.sample.id}
        subnets:
          - ${aws_subnet.sample.id}
        type: FARGATE
      serviceRole: ${aws_iam_role.aws_batch_service_role.arn}
      type: MANAGED
    options:
      dependson:
        - ${aws_iam_role_policy_attachment.aws_batch_service_role}

Create a ComputeEnvironment Resource

new ComputeEnvironment(name: string, args: ComputeEnvironmentArgs, opts?: CustomResourceOptions);
@overload
def ComputeEnvironment(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       compute_environment_name: Optional[str] = None,
                       compute_environment_name_prefix: Optional[str] = None,
                       compute_resources: Optional[ComputeEnvironmentComputeResourcesArgs] = None,
                       service_role: Optional[str] = None,
                       state: Optional[str] = None,
                       tags: Optional[Mapping[str, str]] = None,
                       type: Optional[str] = None)
@overload
def ComputeEnvironment(resource_name: str,
                       args: ComputeEnvironmentArgs,
                       opts: Optional[ResourceOptions] = None)
func NewComputeEnvironment(ctx *Context, name string, args ComputeEnvironmentArgs, opts ...ResourceOption) (*ComputeEnvironment, error)
public ComputeEnvironment(string name, ComputeEnvironmentArgs args, CustomResourceOptions? opts = null)
public ComputeEnvironment(String name, ComputeEnvironmentArgs args)
public ComputeEnvironment(String name, ComputeEnvironmentArgs args, CustomResourceOptions options)
type: aws:batch:ComputeEnvironment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ComputeEnvironmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ComputeEnvironmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ComputeEnvironmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ComputeEnvironmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ComputeEnvironmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ComputeEnvironment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ComputeEnvironment resource accepts the following input properties:

Type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

ComputeEnvironmentName string

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

ComputeEnvironmentNamePrefix string

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

ComputeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

ServiceRole string

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

Tags Dictionary<string, string>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

Type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

ComputeEnvironmentName string

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

ComputeEnvironmentNamePrefix string

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

ComputeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

ServiceRole string

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

Tags map[string]string

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

type String

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

computeEnvironmentName String

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

computeEnvironmentNamePrefix String

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

computeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

serviceRole String

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

tags Map<String,String>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

computeEnvironmentName string

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

computeEnvironmentNamePrefix string

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

computeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

serviceRole string

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

tags {[key: string]: string}

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

type str

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

compute_environment_name str

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

compute_environment_name_prefix str

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

compute_resources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

service_role str

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 str

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

tags Mapping[str, str]

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

type String

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

computeEnvironmentName String

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

computeEnvironmentNamePrefix String

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

computeResources Property Map

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

serviceRole String

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

tags Map<String>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

Outputs

All input properties are implicitly available as output properties. Additionally, the ComputeEnvironment resource produces the following output properties:

Arn string

The Amazon Resource Name (ARN) of the compute environment.

EcsClusterArn string

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

Id string

The provider-assigned unique ID for this managed resource.

Status string

The current status of the compute environment (for example, CREATING or VALID).

StatusReason string

A short, human-readable string to provide additional details about the current status of the compute environment.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider .

Arn string

The Amazon Resource Name (ARN) of the compute environment.

EcsClusterArn string

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

Id string

The provider-assigned unique ID for this managed resource.

Status string

The current status of the compute environment (for example, CREATING or VALID).

StatusReason string

A short, human-readable string to provide additional details about the current status of the compute environment.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider .

arn String

The Amazon Resource Name (ARN) of the compute environment.

ecsClusterArn String

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

id String

The provider-assigned unique ID for this managed resource.

status String

The current status of the compute environment (for example, CREATING or VALID).

statusReason String

A short, human-readable string to provide additional details about the current status of the compute environment.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider .

arn string

The Amazon Resource Name (ARN) of the compute environment.

ecsClusterArn string

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

id string

The provider-assigned unique ID for this managed resource.

status string

The current status of the compute environment (for example, CREATING or VALID).

statusReason string

A short, human-readable string to provide additional details about the current status of the compute environment.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider .

arn str

The Amazon Resource Name (ARN) of the compute environment.

ecs_cluster_arn str

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

id str

The provider-assigned unique ID for this managed resource.

status str

The current status of the compute environment (for example, CREATING or VALID).

status_reason str

A short, human-readable string to provide additional details about the current status of the compute environment.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider .

arn String

The Amazon Resource Name (ARN) of the compute environment.

ecsClusterArn String

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

id String

The provider-assigned unique ID for this managed resource.

status String

The current status of the compute environment (for example, CREATING or VALID).

statusReason String

A short, human-readable string to provide additional details about the current status of the compute environment.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider .

Look up an Existing ComputeEnvironment Resource

Get an existing ComputeEnvironment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ComputeEnvironmentState, opts?: CustomResourceOptions): ComputeEnvironment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        compute_environment_name: Optional[str] = None,
        compute_environment_name_prefix: Optional[str] = None,
        compute_resources: Optional[ComputeEnvironmentComputeResourcesArgs] = None,
        ecs_cluster_arn: Optional[str] = None,
        service_role: Optional[str] = None,
        state: Optional[str] = None,
        status: Optional[str] = None,
        status_reason: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        type: Optional[str] = None) -> ComputeEnvironment
func GetComputeEnvironment(ctx *Context, name string, id IDInput, state *ComputeEnvironmentState, opts ...ResourceOption) (*ComputeEnvironment, error)
public static ComputeEnvironment Get(string name, Input<string> id, ComputeEnvironmentState? state, CustomResourceOptions? opts = null)
public static ComputeEnvironment get(String name, Output<String> id, ComputeEnvironmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string

The Amazon Resource Name (ARN) of the compute environment.

ComputeEnvironmentName string

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

ComputeEnvironmentNamePrefix string

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

ComputeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

EcsClusterArn string

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

ServiceRole string

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

Status string

The current status of the compute environment (for example, CREATING or VALID).

StatusReason string

A short, human-readable string to provide additional details about the current status of the compute environment.

Tags Dictionary<string, string>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider .

Type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

Arn string

The Amazon Resource Name (ARN) of the compute environment.

ComputeEnvironmentName string

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

ComputeEnvironmentNamePrefix string

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

ComputeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

EcsClusterArn string

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

ServiceRole string

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

Status string

The current status of the compute environment (for example, CREATING or VALID).

StatusReason string

A short, human-readable string to provide additional details about the current status of the compute environment.

Tags map[string]string

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider .

Type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

arn String

The Amazon Resource Name (ARN) of the compute environment.

computeEnvironmentName String

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

computeEnvironmentNamePrefix String

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

computeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

ecsClusterArn String

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

serviceRole String

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

status String

The current status of the compute environment (for example, CREATING or VALID).

statusReason String

A short, human-readable string to provide additional details about the current status of the compute environment.

tags Map<String,String>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider .

type String

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

arn string

The Amazon Resource Name (ARN) of the compute environment.

computeEnvironmentName string

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

computeEnvironmentNamePrefix string

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

computeResources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

ecsClusterArn string

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

serviceRole string

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

status string

The current status of the compute environment (for example, CREATING or VALID).

statusReason string

A short, human-readable string to provide additional details about the current status of the compute environment.

tags {[key: string]: string}

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider .

type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

arn str

The Amazon Resource Name (ARN) of the compute environment.

compute_environment_name str

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

compute_environment_name_prefix str

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

compute_resources ComputeEnvironmentComputeResourcesArgs

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

ecs_cluster_arn str

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

service_role str

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 str

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

status str

The current status of the compute environment (for example, CREATING or VALID).

status_reason str

A short, human-readable string to provide additional details about the current status of the compute environment.

tags Mapping[str, str]

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider .

type str

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

arn String

The Amazon Resource Name (ARN) of the compute environment.

computeEnvironmentName String

The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, this provider will assign a random, unique name.

computeEnvironmentNamePrefix String

Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name.

computeResources Property Map

Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.

ecsClusterArn String

The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.

serviceRole String

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

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. Valid items are ENABLED or DISABLED. Defaults to ENABLED.

status String

The current status of the compute environment (for example, CREATING or VALID).

statusReason String

A short, human-readable string to provide additional details about the current status of the compute environment.

tags Map<String>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider .

type String

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

Supporting Types

ComputeEnvironmentComputeResources

MaxVcpus int

The maximum number of EC2 vCPUs that an environment can reach.

SecurityGroupIds List<string>

A list of EC2 security group that are associated with instances launched in the compute environment.

Subnets List<string>

A list of VPC subnets into which the compute resources are launched.

Type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

AllocationStrategy string

The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. Defaults to BEST_FIT. See AWS docs for details. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

BidPercentage int

Integer of maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. If you leave this field empty, the default value is 100% of the On-Demand price. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

DesiredVcpus int

The desired number of EC2 vCPUS in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

Ec2Configuration ComputeEnvironmentComputeResourcesEc2Configuration

Provides information used to select Amazon Machine Images (AMIs) for EC2 instances in the compute environment. If Ec2Configuration isn't specified, the default is ECS_AL2. This parameter isn't applicable to jobs that are running on Fargate resources, and shouldn't be specified.

Ec2KeyPair string

The EC2 key pair that is used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ImageId string

The Amazon Machine Image (AMI) ID used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified. (Deprecated, use ec2_configuration image_id_override instead)

InstanceRole string

The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

InstanceTypes List<string>

A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

LaunchTemplate ComputeEnvironmentComputeResourcesLaunchTemplate

The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

MinVcpus int

The minimum number of EC2 vCPUs that an environment should maintain. For EC2 or SPOT compute environments, if the parameter is not explicitly defined, a 0 default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

SpotIamFleetRole string

The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

Tags Dictionary<string, string>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

MaxVcpus int

The maximum number of EC2 vCPUs that an environment can reach.

SecurityGroupIds []string

A list of EC2 security group that are associated with instances launched in the compute environment.

Subnets []string

A list of VPC subnets into which the compute resources are launched.

Type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

AllocationStrategy string

The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. Defaults to BEST_FIT. See AWS docs for details. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

BidPercentage int

Integer of maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. If you leave this field empty, the default value is 100% of the On-Demand price. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

DesiredVcpus int

The desired number of EC2 vCPUS in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

Ec2Configuration ComputeEnvironmentComputeResourcesEc2Configuration

Provides information used to select Amazon Machine Images (AMIs) for EC2 instances in the compute environment. If Ec2Configuration isn't specified, the default is ECS_AL2. This parameter isn't applicable to jobs that are running on Fargate resources, and shouldn't be specified.

Ec2KeyPair string

The EC2 key pair that is used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ImageId string

The Amazon Machine Image (AMI) ID used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified. (Deprecated, use ec2_configuration image_id_override instead)

InstanceRole string

The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

InstanceTypes []string

A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

LaunchTemplate ComputeEnvironmentComputeResourcesLaunchTemplate

The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

MinVcpus int

The minimum number of EC2 vCPUs that an environment should maintain. For EC2 or SPOT compute environments, if the parameter is not explicitly defined, a 0 default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

SpotIamFleetRole string

The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

Tags map[string]string

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

maxVcpus Integer

The maximum number of EC2 vCPUs that an environment can reach.

securityGroupIds List<String>

A list of EC2 security group that are associated with instances launched in the compute environment.

subnets List<String>

A list of VPC subnets into which the compute resources are launched.

type String

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

allocationStrategy String

The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. Defaults to BEST_FIT. See AWS docs for details. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

bidPercentage Integer

Integer of maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. If you leave this field empty, the default value is 100% of the On-Demand price. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

desiredVcpus Integer

The desired number of EC2 vCPUS in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ec2Configuration ComputeEnvironmentComputeResourcesEc2Configuration

Provides information used to select Amazon Machine Images (AMIs) for EC2 instances in the compute environment. If Ec2Configuration isn't specified, the default is ECS_AL2. This parameter isn't applicable to jobs that are running on Fargate resources, and shouldn't be specified.

ec2KeyPair String

The EC2 key pair that is used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

imageId String

The Amazon Machine Image (AMI) ID used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified. (Deprecated, use ec2_configuration image_id_override instead)

instanceRole String

The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

instanceTypes List<String>

A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

launchTemplate ComputeEnvironmentComputeResourcesLaunchTemplate

The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

minVcpus Integer

The minimum number of EC2 vCPUs that an environment should maintain. For EC2 or SPOT compute environments, if the parameter is not explicitly defined, a 0 default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

spotIamFleetRole String

The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tags Map<String,String>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

maxVcpus number

The maximum number of EC2 vCPUs that an environment can reach.

securityGroupIds string[]

A list of EC2 security group that are associated with instances launched in the compute environment.

subnets string[]

A list of VPC subnets into which the compute resources are launched.

type string

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

allocationStrategy string

The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. Defaults to BEST_FIT. See AWS docs for details. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

bidPercentage number

Integer of maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. If you leave this field empty, the default value is 100% of the On-Demand price. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

desiredVcpus number

The desired number of EC2 vCPUS in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ec2Configuration ComputeEnvironmentComputeResourcesEc2Configuration

Provides information used to select Amazon Machine Images (AMIs) for EC2 instances in the compute environment. If Ec2Configuration isn't specified, the default is ECS_AL2. This parameter isn't applicable to jobs that are running on Fargate resources, and shouldn't be specified.

ec2KeyPair string

The EC2 key pair that is used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

imageId string

The Amazon Machine Image (AMI) ID used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified. (Deprecated, use ec2_configuration image_id_override instead)

instanceRole string

The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

instanceTypes string[]

A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

launchTemplate ComputeEnvironmentComputeResourcesLaunchTemplate

The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

minVcpus number

The minimum number of EC2 vCPUs that an environment should maintain. For EC2 or SPOT compute environments, if the parameter is not explicitly defined, a 0 default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

spotIamFleetRole string

The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tags {[key: string]: string}

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

max_vcpus int

The maximum number of EC2 vCPUs that an environment can reach.

security_group_ids Sequence[str]

A list of EC2 security group that are associated with instances launched in the compute environment.

subnets Sequence[str]

A list of VPC subnets into which the compute resources are launched.

type str

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

allocation_strategy str

The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. Defaults to BEST_FIT. See AWS docs for details. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

bid_percentage int

Integer of maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. If you leave this field empty, the default value is 100% of the On-Demand price. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

desired_vcpus int

The desired number of EC2 vCPUS in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ec2_configuration ComputeEnvironmentComputeResourcesEc2Configuration

Provides information used to select Amazon Machine Images (AMIs) for EC2 instances in the compute environment. If Ec2Configuration isn't specified, the default is ECS_AL2. This parameter isn't applicable to jobs that are running on Fargate resources, and shouldn't be specified.

ec2_key_pair str

The EC2 key pair that is used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

image_id str

The Amazon Machine Image (AMI) ID used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified. (Deprecated, use ec2_configuration image_id_override instead)

instance_role str

The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

instance_types Sequence[str]

A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

launch_template ComputeEnvironmentComputeResourcesLaunchTemplate

The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

min_vcpus int

The minimum number of EC2 vCPUs that an environment should maintain. For EC2 or SPOT compute environments, if the parameter is not explicitly defined, a 0 default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

spot_iam_fleet_role str

The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tags Mapping[str, str]

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

maxVcpus Number

The maximum number of EC2 vCPUs that an environment can reach.

securityGroupIds List<String>

A list of EC2 security group that are associated with instances launched in the compute environment.

subnets List<String>

A list of VPC subnets into which the compute resources are launched.

type String

The type of compute environment. Valid items are EC2, SPOT, FARGATE or FARGATE_SPOT.

allocationStrategy String

The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. Defaults to BEST_FIT. See AWS docs for details. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

bidPercentage Number

Integer of maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. If you leave this field empty, the default value is 100% of the On-Demand price. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

desiredVcpus Number

The desired number of EC2 vCPUS in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ec2Configuration Property Map

Provides information used to select Amazon Machine Images (AMIs) for EC2 instances in the compute environment. If Ec2Configuration isn't specified, the default is ECS_AL2. This parameter isn't applicable to jobs that are running on Fargate resources, and shouldn't be specified.

ec2KeyPair String

The EC2 key pair that is used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

imageId String

The Amazon Machine Image (AMI) ID used for instances launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified. (Deprecated, use ec2_configuration image_id_override instead)

instanceRole String

The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

instanceTypes List<String>

A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

launchTemplate Property Map

The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

minVcpus Number

The minimum number of EC2 vCPUs that an environment should maintain. For EC2 or SPOT compute environments, if the parameter is not explicitly defined, a 0 default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

spotIamFleetRole String

The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

tags Map<String>

Key-value pair tags to be applied to resources that are launched in the compute environment. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.

ComputeEnvironmentComputeResourcesEc2Configuration

ImageIdOverride string

The AMI ID used for instances launched in the compute environment that match the image type. This setting overrides the image_id argument in the compute_resources block.

ImageType string

The image type to match with the instance type to select an AMI. If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI (ECS_AL2) is used.

ImageIdOverride string

The AMI ID used for instances launched in the compute environment that match the image type. This setting overrides the image_id argument in the compute_resources block.

ImageType string

The image type to match with the instance type to select an AMI. If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI (ECS_AL2) is used.

imageIdOverride String

The AMI ID used for instances launched in the compute environment that match the image type. This setting overrides the image_id argument in the compute_resources block.

imageType String

The image type to match with the instance type to select an AMI. If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI (ECS_AL2) is used.

imageIdOverride string

The AMI ID used for instances launched in the compute environment that match the image type. This setting overrides the image_id argument in the compute_resources block.

imageType string

The image type to match with the instance type to select an AMI. If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI (ECS_AL2) is used.

image_id_override str

The AMI ID used for instances launched in the compute environment that match the image type. This setting overrides the image_id argument in the compute_resources block.

image_type str

The image type to match with the instance type to select an AMI. If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI (ECS_AL2) is used.

imageIdOverride String

The AMI ID used for instances launched in the compute environment that match the image type. This setting overrides the image_id argument in the compute_resources block.

imageType String

The image type to match with the instance type to select an AMI. If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI (ECS_AL2) is used.

ComputeEnvironmentComputeResourcesLaunchTemplate

LaunchTemplateId string

ID of the launch template. You must specify either the launch template ID or launch template name in the request, but not both.

LaunchTemplateName string

Name of the launch template.

Version string

The version number of the launch template. Default: The default version of the launch template.

LaunchTemplateId string

ID of the launch template. You must specify either the launch template ID or launch template name in the request, but not both.

LaunchTemplateName string

Name of the launch template.

Version string

The version number of the launch template. Default: The default version of the launch template.

launchTemplateId String

ID of the launch template. You must specify either the launch template ID or launch template name in the request, but not both.

launchTemplateName String

Name of the launch template.

version String

The version number of the launch template. Default: The default version of the launch template.

launchTemplateId string

ID of the launch template. You must specify either the launch template ID or launch template name in the request, but not both.

launchTemplateName string

Name of the launch template.

version string

The version number of the launch template. Default: The default version of the launch template.

launch_template_id str

ID of the launch template. You must specify either the launch template ID or launch template name in the request, but not both.

launch_template_name str

Name of the launch template.

version str

The version number of the launch template. Default: The default version of the launch template.

launchTemplateId String

ID of the launch template. You must specify either the launch template ID or launch template name in the request, but not both.

launchTemplateName String

Name of the launch template.

version String

The version number of the launch template. Default: The default version of the launch template.

Import

AWS Batch compute can be imported using the compute_environment_name, e.g.,

 $ pulumi import aws:batch/computeEnvironment:ComputeEnvironment sample sample

[1]http://docs.aws.amazon.com/batch/latest/userguide/what-is-batch.html [2]http://docs.aws.amazon.com/batch/latest/userguide/compute_environments.html [3]http://docs.aws.amazon.com/batch/latest/userguide/troubleshooting.html [4]https://docs.aws.amazon.com/batch/latest/userguide/allocation-strategies.html

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.