Show / Hide Table of Contents

Namespace Pulumi.Aws.Batch

Classes

ComputeEnvironment

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

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

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

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var ecsInstanceRoleRole = new Aws.Iam.Role("ecsInstanceRoleRole", new Aws.Iam.RoleArgs
    {
        AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
 ""Action"": ""sts:AssumeRole"",
 ""Effect"": ""Allow"",
 ""Principal"": {
""Service"": ""ec2.amazonaws.com""
 }
}
]
}

",
    });
    var ecsInstanceRoleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("ecsInstanceRoleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
    {
        PolicyArn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role",
        Role = ecsInstanceRoleRole.Name,
    });
    var ecsInstanceRoleInstanceProfile = new Aws.Iam.InstanceProfile("ecsInstanceRoleInstanceProfile", new Aws.Iam.InstanceProfileArgs
    {
        Role = ecsInstanceRoleRole.Name,
    });
    var awsBatchServiceRoleRole = new Aws.Iam.Role("awsBatchServiceRoleRole", new Aws.Iam.RoleArgs
    {
        AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
 ""Action"": ""sts:AssumeRole"",
 ""Effect"": ""Allow"",
 ""Principal"": {
""Service"": ""batch.amazonaws.com""
 }
}
]
}

",
    });
    var awsBatchServiceRoleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("awsBatchServiceRoleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
    {
        PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole",
        Role = awsBatchServiceRoleRole.Name,
    });
    var sampleSecurityGroup = new Aws.Ec2.SecurityGroup("sampleSecurityGroup", new Aws.Ec2.SecurityGroupArgs
    {
        Egress = 
        {
            new Aws.Ec2.Inputs.SecurityGroupEgressArgs
            {
                CidrBlocks = 
                {
                    "0.0.0.0/0",
                },
                FromPort = 0,
                Protocol = "-1",
                ToPort = 0,
            },
        },
    });
    var sampleVpc = new Aws.Ec2.Vpc("sampleVpc", new Aws.Ec2.VpcArgs
    {
        CidrBlock = "10.1.0.0/16",
    });
    var sampleSubnet = new Aws.Ec2.Subnet("sampleSubnet", new Aws.Ec2.SubnetArgs
    {
        CidrBlock = "10.1.1.0/24",
        VpcId = sampleVpc.Id,
    });
    var sampleComputeEnvironment = new Aws.Batch.ComputeEnvironment("sampleComputeEnvironment", new Aws.Batch.ComputeEnvironmentArgs
    {
        ComputeEnvironmentName = "sample",
        ComputeResources = new Aws.Batch.Inputs.ComputeEnvironmentComputeResourcesArgs
        {
            InstanceRole = ecsInstanceRoleInstanceProfile.Arn,
            InstanceType = 
            {
                "c4.large",
            },
            MaxVcpus = 16,
            MinVcpus = 0,
            SecurityGroupIds = 
            {
                sampleSecurityGroup.Id,
            },
            Subnets = 
            {
                sampleSubnet.Id,
            },
            Type = "EC2",
        },
        ServiceRole = awsBatchServiceRoleRole.Arn,
        Type = "MANAGED",
    });
}

}

ComputeEnvironmentArgs

ComputeEnvironmentState

GetComputeEnvironment

GetComputeEnvironmentArgs

GetComputeEnvironmentResult

GetJobQueue

GetJobQueueArgs

GetJobQueueResult

JobDefinition

Provides a Batch Job Definition resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var test = new Aws.Batch.JobDefinition("test", new Aws.Batch.JobDefinitionArgs
    {
        ContainerProperties = @"{
""command"": [""ls"", ""-la""],
""image"": ""busybox"",
""memory"": 1024,
""vcpus"": 1,
""volumes"": [
  {
    ""host"": {
      ""sourcePath"": ""/tmp""
    },
    ""name"": ""tmp""
  }
],
""environment"": [
{""name"": ""VARNAME"", ""value"": ""VARVAL""}
],
""mountPoints"": [
{
      ""sourceVolume"": ""tmp"",
      ""containerPath"": ""/tmp"",
      ""readOnly"": false
    }
],
""ulimits"": [
  {
    ""hardLimit"": 1024,
    ""name"": ""nofile"",
    ""softLimit"": 1024
  }
]
}

",
        Type = "container",
    });
}

}

JobDefinitionArgs

JobDefinitionState

JobQueue

Provides a Batch Job Queue resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var testQueue = new Aws.Batch.JobQueue("testQueue", new Aws.Batch.JobQueueArgs
    {
        ComputeEnvironments = 
        {
            aws_batch_compute_environment.Test_environment_1.Arn,
            aws_batch_compute_environment.Test_environment_2.Arn,
        },
        Priority = 1,
        State = "ENABLED",
    });
}

}

JobQueueArgs

JobQueueState

Back to top Copyright 2016-2020, Pulumi Corporation.