1. Packages
  2. Packages
  3. AWS
  4. API Docs
  5. batch
  6. ComputeEnvironment
Viewing docs for AWS v5.43.0 (Older version)
published on Tuesday, Mar 10, 2026 by Pulumi
aws logo
Viewing docs for AWS v5.43.0 (Older version)
published on Tuesday, Mar 10, 2026 by Pulumi

    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 System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var ec2AssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "ec2.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "sts:AssumeRole",
                    },
                },
            },
        });
    
        var ecsInstanceRoleRole = new Aws.Iam.Role("ecsInstanceRoleRole", new()
        {
            AssumeRolePolicy = ec2AssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var ecsInstanceRoleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment", new()
        {
            Role = ecsInstanceRoleRole.Name,
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role",
        });
    
        var ecsInstanceRoleInstanceProfile = new Aws.Iam.InstanceProfile("ecsInstanceRoleInstanceProfile", new()
        {
            Role = ecsInstanceRoleRole.Name,
        });
    
        var batchAssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "batch.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "sts:AssumeRole",
                    },
                },
            },
        });
    
        var awsBatchServiceRoleRole = new Aws.Iam.Role("awsBatchServiceRoleRole", new()
        {
            AssumeRolePolicy = batchAssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var awsBatchServiceRoleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", new()
        {
            Role = awsBatchServiceRoleRole.Name,
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole",
        });
    
        var sampleSecurityGroup = new Aws.Ec2.SecurityGroup("sampleSecurityGroup", new()
        {
            Egress = new[]
            {
                new Aws.Ec2.Inputs.SecurityGroupEgressArgs
                {
                    FromPort = 0,
                    ToPort = 0,
                    Protocol = "-1",
                    CidrBlocks = new[]
                    {
                        "0.0.0.0/0",
                    },
                },
            },
        });
    
        var sampleVpc = new Aws.Ec2.Vpc("sampleVpc", new()
        {
            CidrBlock = "10.1.0.0/16",
        });
    
        var sampleSubnet = new Aws.Ec2.Subnet("sampleSubnet", new()
        {
            VpcId = sampleVpc.Id,
            CidrBlock = "10.1.1.0/24",
        });
    
        var sampleComputeEnvironment = new Aws.Batch.ComputeEnvironment("sampleComputeEnvironment", new()
        {
            ComputeEnvironmentName = "sample",
            ComputeResources = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesArgs
            {
                InstanceRole = ecsInstanceRoleInstanceProfile.Arn,
                InstanceTypes = new[]
                {
                    "c4.large",
                },
                MaxVcpus = 16,
                MinVcpus = 0,
                SecurityGroupIds = new[]
                {
                    sampleSecurityGroup.Id,
                },
                Subnets = new[]
                {
                    sampleSubnet.Id,
                },
                Type = "EC2",
            },
            ServiceRole = awsBatchServiceRoleRole.Arn,
            Type = "MANAGED",
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                awsBatchServiceRoleRolePolicyAttachment,
            },
        });
    
    });
    
    package main
    
    import (
    	"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 {
    		ec2AssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"ec2.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"sts:AssumeRole",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ecsInstanceRoleRole, err := iam.NewRole(ctx, "ecsInstanceRoleRole", &iam.RoleArgs{
    			AssumeRolePolicy: *pulumi.String(ec2AssumeRole.Json),
    		})
    		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
    		}
    		batchAssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"batch.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"sts:AssumeRole",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		awsBatchServiceRoleRole, err := iam.NewRole(ctx, "awsBatchServiceRoleRole", &iam.RoleArgs{
    			AssumeRolePolicy: *pulumi.String(batchAssumeRole.Json),
    		})
    		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
    		}
    		sampleSecurityGroup, err := ec2.NewSecurityGroup(ctx, "sampleSecurityGroup", &ec2.SecurityGroupArgs{
    			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
    		}
    		sampleVpc, err := ec2.NewVpc(ctx, "sampleVpc", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.1.0.0/16"),
    		})
    		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 com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.iam.Role;
    import com.pulumi.aws.iam.RoleArgs;
    import com.pulumi.aws.iam.RolePolicyAttachment;
    import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
    import com.pulumi.aws.iam.InstanceProfile;
    import com.pulumi.aws.iam.InstanceProfileArgs;
    import com.pulumi.aws.ec2.SecurityGroup;
    import com.pulumi.aws.ec2.SecurityGroupArgs;
    import com.pulumi.aws.ec2.inputs.SecurityGroupEgressArgs;
    import com.pulumi.aws.ec2.Vpc;
    import com.pulumi.aws.ec2.VpcArgs;
    import com.pulumi.aws.ec2.Subnet;
    import com.pulumi.aws.ec2.SubnetArgs;
    import com.pulumi.aws.batch.ComputeEnvironment;
    import com.pulumi.aws.batch.ComputeEnvironmentArgs;
    import com.pulumi.aws.batch.inputs.ComputeEnvironmentComputeResourcesArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var ec2AssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("ec2.amazonaws.com")
                        .build())
                    .actions("sts:AssumeRole")
                    .build())
                .build());
    
            var ecsInstanceRoleRole = new Role("ecsInstanceRoleRole", RoleArgs.builder()        
                .assumeRolePolicy(ec2AssumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .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());
    
            final var batchAssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("batch.amazonaws.com")
                        .build())
                    .actions("sts:AssumeRole")
                    .build())
                .build());
    
            var awsBatchServiceRoleRole = new Role("awsBatchServiceRoleRole", RoleArgs.builder()        
                .assumeRolePolicy(batchAssumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
            var awsBatchServiceRoleRolePolicyAttachment = new RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()        
                .role(awsBatchServiceRoleRole.name())
                .policyArn("arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole")
                .build());
    
            var sampleSecurityGroup = new SecurityGroup("sampleSecurityGroup", SecurityGroupArgs.builder()        
                .egress(SecurityGroupEgressArgs.builder()
                    .fromPort(0)
                    .toPort(0)
                    .protocol("-1")
                    .cidrBlocks("0.0.0.0/0")
                    .build())
                .build());
    
            var sampleVpc = new Vpc("sampleVpc", VpcArgs.builder()        
                .cidrBlock("10.1.0.0/16")
                .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 * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const ec2AssumeRole = aws.iam.getPolicyDocument({
        statements: [{
            effect: "Allow",
            principals: [{
                type: "Service",
                identifiers: ["ec2.amazonaws.com"],
            }],
            actions: ["sts:AssumeRole"],
        }],
    });
    const ecsInstanceRoleRole = new aws.iam.Role("ecsInstanceRoleRole", {assumeRolePolicy: ec2AssumeRole.then(ec2AssumeRole => ec2AssumeRole.json)});
    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 batchAssumeRole = aws.iam.getPolicyDocument({
        statements: [{
            effect: "Allow",
            principals: [{
                type: "Service",
                identifiers: ["batch.amazonaws.com"],
            }],
            actions: ["sts:AssumeRole"],
        }],
    });
    const awsBatchServiceRoleRole = new aws.iam.Role("awsBatchServiceRoleRole", {assumeRolePolicy: batchAssumeRole.then(batchAssumeRole => batchAssumeRole.json)});
    const awsBatchServiceRoleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", {
        role: awsBatchServiceRoleRole.name,
        policyArn: "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole",
    });
    const sampleSecurityGroup = new aws.ec2.SecurityGroup("sampleSecurityGroup", {egress: [{
        fromPort: 0,
        toPort: 0,
        protocol: "-1",
        cidrBlocks: ["0.0.0.0/0"],
    }]});
    const sampleVpc = new aws.ec2.Vpc("sampleVpc", {cidrBlock: "10.1.0.0/16"});
    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],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    ec2_assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        effect="Allow",
        principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
            type="Service",
            identifiers=["ec2.amazonaws.com"],
        )],
        actions=["sts:AssumeRole"],
    )])
    ecs_instance_role_role = aws.iam.Role("ecsInstanceRoleRole", assume_role_policy=ec2_assume_role.json)
    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)
    batch_assume_role = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        effect="Allow",
        principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
            type="Service",
            identifiers=["batch.amazonaws.com"],
        )],
        actions=["sts:AssumeRole"],
    )])
    aws_batch_service_role_role = aws.iam.Role("awsBatchServiceRoleRole", assume_role_policy=batch_assume_role.json)
    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_security_group = aws.ec2.SecurityGroup("sampleSecurityGroup", egress=[aws.ec2.SecurityGroupEgressArgs(
        from_port=0,
        to_port=0,
        protocol="-1",
        cidr_blocks=["0.0.0.0/0"],
    )])
    sample_vpc = aws.ec2.Vpc("sampleVpc", cidr_block="10.1.0.0/16")
    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]))
    
    resources:
      ecsInstanceRoleRole:
        type: aws:iam:Role
        properties:
          assumeRolePolicy: ${ec2AssumeRole.json}
      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: ${batchAssumeRole.json}
      awsBatchServiceRoleRolePolicyAttachment:
        type: aws:iam:RolePolicyAttachment
        properties:
          role: ${awsBatchServiceRoleRole.name}
          policyArn: arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole
      sampleSecurityGroup:
        type: aws:ec2:SecurityGroup
        properties:
          egress:
            - fromPort: 0
              toPort: 0
              protocol: '-1'
              cidrBlocks:
                - 0.0.0.0/0
      sampleVpc:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 10.1.0.0/16
      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}
    variables:
      ec2AssumeRole:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - ec2.amazonaws.com
                actions:
                  - sts:AssumeRole
      batchAssumeRole:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - batch.amazonaws.com
                actions:
                  - sts:AssumeRole
    

    Fargate Type

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var sample = new Aws.Batch.ComputeEnvironment("sample", new()
        {
            ComputeEnvironmentName = "sample",
            ComputeResources = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesArgs
            {
                MaxVcpus = 16,
                SecurityGroupIds = new[]
                {
                    aws_security_group.Sample.Id,
                },
                Subnets = new[]
                {
                    aws_subnet.Sample.Id,
                },
                Type = "FARGATE",
            },
            ServiceRole = aws_iam_role.Aws_batch_service_role.Arn,
            Type = "MANAGED",
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                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{
    					aws_security_group.Sample.Id,
    				},
    				Subnets: pulumi.StringArray{
    					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 com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.batch.ComputeEnvironment;
    import com.pulumi.aws.batch.ComputeEnvironmentArgs;
    import com.pulumi.aws.batch.inputs.ComputeEnvironmentComputeResourcesArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    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 * 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],
    });
    
    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"]]))
    
    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 ComputeEnvironment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ComputeEnvironment(name: string, args: ComputeEnvironmentArgs, opts?: CustomResourceOptions);
    @overload
    def ComputeEnvironment(resource_name: str,
                           args: ComputeEnvironmentArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def ComputeEnvironment(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           type: Optional[str] = None,
                           compute_environment_name: Optional[str] = None,
                           compute_environment_name_prefix: Optional[str] = None,
                           compute_resources: Optional[ComputeEnvironmentComputeResourcesArgs] = None,
                           eks_configuration: Optional[ComputeEnvironmentEksConfigurationArgs] = None,
                           service_role: Optional[str] = None,
                           state: Optional[str] = None,
                           tags: Optional[Mapping[str, str]] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var computeEnvironmentResource = new Aws.Batch.ComputeEnvironment("computeEnvironmentResource", new()
    {
        Type = "string",
        ComputeEnvironmentName = "string",
        ComputeEnvironmentNamePrefix = "string",
        ComputeResources = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesArgs
        {
            MaxVcpus = 0,
            Type = "string",
            Subnets = new[]
            {
                "string",
            },
            LaunchTemplate = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesLaunchTemplateArgs
            {
                LaunchTemplateId = "string",
                LaunchTemplateName = "string",
                Version = "string",
            },
            Ec2KeyPair = "string",
            ImageId = "string",
            InstanceRole = "string",
            InstanceTypes = new[]
            {
                "string",
            },
            AllocationStrategy = "string",
            Ec2Configuration = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesEc2ConfigurationArgs
            {
                ImageIdOverride = "string",
                ImageType = "string",
            },
            MinVcpus = 0,
            SecurityGroupIds = new[]
            {
                "string",
            },
            SpotIamFleetRole = "string",
            DesiredVcpus = 0,
            Tags = 
            {
                { "string", "string" },
            },
            BidPercentage = 0,
        },
        EksConfiguration = new Aws.Batch.Inputs.ComputeEnvironmentEksConfigurationArgs
        {
            EksClusterArn = "string",
            KubernetesNamespace = "string",
        },
        ServiceRole = "string",
        State = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := batch.NewComputeEnvironment(ctx, "computeEnvironmentResource", &batch.ComputeEnvironmentArgs{
    	Type:                         pulumi.String("string"),
    	ComputeEnvironmentName:       pulumi.String("string"),
    	ComputeEnvironmentNamePrefix: pulumi.String("string"),
    	ComputeResources: &batch.ComputeEnvironmentComputeResourcesArgs{
    		MaxVcpus: pulumi.Int(0),
    		Type:     pulumi.String("string"),
    		Subnets: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		LaunchTemplate: &batch.ComputeEnvironmentComputeResourcesLaunchTemplateArgs{
    			LaunchTemplateId:   pulumi.String("string"),
    			LaunchTemplateName: pulumi.String("string"),
    			Version:            pulumi.String("string"),
    		},
    		Ec2KeyPair:   pulumi.String("string"),
    		ImageId:      pulumi.String("string"),
    		InstanceRole: pulumi.String("string"),
    		InstanceTypes: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		AllocationStrategy: pulumi.String("string"),
    		Ec2Configuration: &batch.ComputeEnvironmentComputeResourcesEc2ConfigurationArgs{
    			ImageIdOverride: pulumi.String("string"),
    			ImageType:       pulumi.String("string"),
    		},
    		MinVcpus: pulumi.Int(0),
    		SecurityGroupIds: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		SpotIamFleetRole: pulumi.String("string"),
    		DesiredVcpus:     pulumi.Int(0),
    		Tags: pulumi.StringMap{
    			"string": pulumi.String("string"),
    		},
    		BidPercentage: pulumi.Int(0),
    	},
    	EksConfiguration: &batch.ComputeEnvironmentEksConfigurationArgs{
    		EksClusterArn:       pulumi.String("string"),
    		KubernetesNamespace: pulumi.String("string"),
    	},
    	ServiceRole: pulumi.String("string"),
    	State:       pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var computeEnvironmentResource = new ComputeEnvironment("computeEnvironmentResource", ComputeEnvironmentArgs.builder()
        .type("string")
        .computeEnvironmentName("string")
        .computeEnvironmentNamePrefix("string")
        .computeResources(ComputeEnvironmentComputeResourcesArgs.builder()
            .maxVcpus(0)
            .type("string")
            .subnets("string")
            .launchTemplate(ComputeEnvironmentComputeResourcesLaunchTemplateArgs.builder()
                .launchTemplateId("string")
                .launchTemplateName("string")
                .version("string")
                .build())
            .ec2KeyPair("string")
            .imageId("string")
            .instanceRole("string")
            .instanceTypes("string")
            .allocationStrategy("string")
            .ec2Configuration(ComputeEnvironmentComputeResourcesEc2ConfigurationArgs.builder()
                .imageIdOverride("string")
                .imageType("string")
                .build())
            .minVcpus(0)
            .securityGroupIds("string")
            .spotIamFleetRole("string")
            .desiredVcpus(0)
            .tags(Map.of("string", "string"))
            .bidPercentage(0)
            .build())
        .eksConfiguration(ComputeEnvironmentEksConfigurationArgs.builder()
            .eksClusterArn("string")
            .kubernetesNamespace("string")
            .build())
        .serviceRole("string")
        .state("string")
        .tags(Map.of("string", "string"))
        .build());
    
    compute_environment_resource = aws.batch.ComputeEnvironment("computeEnvironmentResource",
        type="string",
        compute_environment_name="string",
        compute_environment_name_prefix="string",
        compute_resources={
            "max_vcpus": 0,
            "type": "string",
            "subnets": ["string"],
            "launch_template": {
                "launch_template_id": "string",
                "launch_template_name": "string",
                "version": "string",
            },
            "ec2_key_pair": "string",
            "image_id": "string",
            "instance_role": "string",
            "instance_types": ["string"],
            "allocation_strategy": "string",
            "ec2_configuration": {
                "image_id_override": "string",
                "image_type": "string",
            },
            "min_vcpus": 0,
            "security_group_ids": ["string"],
            "spot_iam_fleet_role": "string",
            "desired_vcpus": 0,
            "tags": {
                "string": "string",
            },
            "bid_percentage": 0,
        },
        eks_configuration={
            "eks_cluster_arn": "string",
            "kubernetes_namespace": "string",
        },
        service_role="string",
        state="string",
        tags={
            "string": "string",
        })
    
    const computeEnvironmentResource = new aws.batch.ComputeEnvironment("computeEnvironmentResource", {
        type: "string",
        computeEnvironmentName: "string",
        computeEnvironmentNamePrefix: "string",
        computeResources: {
            maxVcpus: 0,
            type: "string",
            subnets: ["string"],
            launchTemplate: {
                launchTemplateId: "string",
                launchTemplateName: "string",
                version: "string",
            },
            ec2KeyPair: "string",
            imageId: "string",
            instanceRole: "string",
            instanceTypes: ["string"],
            allocationStrategy: "string",
            ec2Configuration: {
                imageIdOverride: "string",
                imageType: "string",
            },
            minVcpus: 0,
            securityGroupIds: ["string"],
            spotIamFleetRole: "string",
            desiredVcpus: 0,
            tags: {
                string: "string",
            },
            bidPercentage: 0,
        },
        eksConfiguration: {
            eksClusterArn: "string",
            kubernetesNamespace: "string",
        },
        serviceRole: "string",
        state: "string",
        tags: {
            string: "string",
        },
    });
    
    type: aws:batch:ComputeEnvironment
    properties:
        computeEnvironmentName: string
        computeEnvironmentNamePrefix: string
        computeResources:
            allocationStrategy: string
            bidPercentage: 0
            desiredVcpus: 0
            ec2Configuration:
                imageIdOverride: string
                imageType: string
            ec2KeyPair: string
            imageId: string
            instanceRole: string
            instanceTypes:
                - string
            launchTemplate:
                launchTemplateId: string
                launchTemplateName: string
                version: string
            maxVcpus: 0
            minVcpus: 0
            securityGroupIds:
                - string
            spotIamFleetRole: string
            subnets:
                - string
            tags:
                string: string
            type: string
        eksConfiguration:
            eksClusterArn: string
            kubernetesNamespace: string
        serviceRole: string
        state: string
        tags:
            string: string
        type: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ComputeEnvironment resource accepts the following input properties:

    Type string
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    ComputeEnvironmentName string
    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, the 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 ComputeEnvironmentComputeResources
    Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.
    EksConfiguration ComputeEnvironmentEksConfiguration
    Details for the Amazon EKS cluster that supports the compute environment. 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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    Type string
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    ComputeEnvironmentName string
    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, the 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.
    EksConfiguration ComputeEnvironmentEksConfigurationArgs
    Details for the Amazon EKS cluster that supports the compute environment. 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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    type String
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    computeEnvironmentName String
    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, the 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 ComputeEnvironmentComputeResources
    Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.
    eksConfiguration ComputeEnvironmentEksConfiguration
    Details for the Amazon EKS cluster that supports the compute environment. 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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    type string
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    computeEnvironmentName string
    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, the 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 ComputeEnvironmentComputeResources
    Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. See details below.
    eksConfiguration ComputeEnvironmentEksConfiguration
    Details for the Amazon EKS cluster that supports the compute environment. 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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    type str
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    compute_environment_name str
    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, the 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.
    eks_configuration ComputeEnvironmentEksConfigurationArgs
    Details for the Amazon EKS cluster that supports the compute environment. 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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    type String
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    computeEnvironmentName String
    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed. If omitted, the 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.
    eksConfiguration Property Map
    Details for the Amazon EKS cluster that supports the compute environment. 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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    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 default_tags configuration block.
    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 default_tags configuration block.
    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 default_tags configuration block.
    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 default_tags configuration block.
    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 default_tags configuration block.
    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 default_tags configuration block.

    Look up 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,
            eks_configuration: Optional[ComputeEnvironmentEksConfigurationArgs] = 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)
    resources:  _:    type: aws:batch:ComputeEnvironment    get:      id: ${id}
    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, the 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 ComputeEnvironmentComputeResources
    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.
    EksConfiguration ComputeEnvironmentEksConfiguration
    Details for the Amazon EKS cluster that supports the compute environment. 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.
    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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    Type string
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    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, the 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.
    EksConfiguration ComputeEnvironmentEksConfigurationArgs
    Details for the Amazon EKS cluster that supports the compute environment. 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.
    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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    Type string
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    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, the 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 ComputeEnvironmentComputeResources
    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.
    eksConfiguration ComputeEnvironmentEksConfiguration
    Details for the Amazon EKS cluster that supports the compute environment. 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.
    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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    type String
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    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, the 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 ComputeEnvironmentComputeResources
    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.
    eksConfiguration ComputeEnvironmentEksConfiguration
    Details for the Amazon EKS cluster that supports the compute environment. 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.
    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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    type string
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    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, the 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.
    eks_configuration ComputeEnvironmentEksConfigurationArgs
    Details for the Amazon EKS cluster that supports the compute environment. 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.
    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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    type str
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.
    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, the 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.
    eksConfiguration Property Map
    Details for the Amazon EKS cluster that supports the compute environment. 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.
    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 map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    type String
    The type of the compute environment. Valid items are MANAGED or UNMANAGED.

    Supporting Types

    ComputeEnvironmentComputeResources, ComputeEnvironmentComputeResourcesArgs

    MaxVcpus int
    The maximum number of EC2 vCPUs that an environment can reach.
    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.
    SecurityGroupIds List<string>
    A list of EC2 security group that are associated with instances launched in the compute environment. This parameter is required for Fargate compute environments.
    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.
    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.
    SecurityGroupIds []string
    A list of EC2 security group that are associated with instances launched in the compute environment. This parameter is required for Fargate compute environments.
    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.
    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.
    securityGroupIds List<String>
    A list of EC2 security group that are associated with instances launched in the compute environment. This parameter is required for Fargate compute environments.
    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.
    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.
    securityGroupIds string[]
    A list of EC2 security group that are associated with instances launched in the compute environment. This parameter is required for Fargate compute environments.
    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.
    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.
    security_group_ids Sequence[str]
    A list of EC2 security group that are associated with instances launched in the compute environment. This parameter is required for Fargate compute environments.
    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.
    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.
    securityGroupIds List<String>
    A list of EC2 security group that are associated with instances launched in the compute environment. This parameter is required for Fargate compute environments.
    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, ComputeEnvironmentComputeResourcesEc2ConfigurationArgs

    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, ComputeEnvironmentComputeResourcesLaunchTemplateArgs

    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.

    ComputeEnvironmentEksConfiguration, ComputeEnvironmentEksConfigurationArgs

    EksClusterArn string
    The Amazon Resource Name (ARN) of the Amazon EKS cluster.
    KubernetesNamespace string
    The namespace of the Amazon EKS cluster. AWS Batch manages pods in this namespace.
    EksClusterArn string
    The Amazon Resource Name (ARN) of the Amazon EKS cluster.
    KubernetesNamespace string
    The namespace of the Amazon EKS cluster. AWS Batch manages pods in this namespace.
    eksClusterArn String
    The Amazon Resource Name (ARN) of the Amazon EKS cluster.
    kubernetesNamespace String
    The namespace of the Amazon EKS cluster. AWS Batch manages pods in this namespace.
    eksClusterArn string
    The Amazon Resource Name (ARN) of the Amazon EKS cluster.
    kubernetesNamespace string
    The namespace of the Amazon EKS cluster. AWS Batch manages pods in this namespace.
    eks_cluster_arn str
    The Amazon Resource Name (ARN) of the Amazon EKS cluster.
    kubernetes_namespace str
    The namespace of the Amazon EKS cluster. AWS Batch manages pods in this namespace.
    eksClusterArn String
    The Amazon Resource Name (ARN) of the Amazon EKS cluster.
    kubernetesNamespace String
    The namespace of the Amazon EKS cluster. AWS Batch manages pods in this namespace.

    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

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    Viewing docs for AWS v5.43.0 (Older version)
    published on Tuesday, Mar 10, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial