Module ecs

@pulumi/awsx > ecs

Pulumi ECS Components

Pulumi’s API’s for simplifying working with ECS. The API currently provides ways to define and configure Clusters, Services, TaskDefinitions, and Containers. The Pulumi API also makes it simple to configure things simply to use Fargate (alleviating the need to manage servers yourself), or just use EC2 for the most control.

To start with, here’s a simple example of how one can create a Fargate service:

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const listener = new awsx.lb.NetworkListener("nginx", { port: 80 });
const nginx = new awsx.ecs.FargateService("nginx", {
    taskDefinitionArgs: {
        containers: {
            nginx: {
                image: "nginx",
                memory: 128,
                portMappings: [listener],
            },
        },
    },
    desiredCount: 2,
});

This single call will create a Cluster on your behalf in The Default VPC for your region. It will also create an internet-facing NLB that will listen for connections and route requests appropriate to spawned instances in the cluster. Because we have used Fargate, there is no need to create any sort of Auto Scaling Group or otherwise specify what sort of machine instances will be run. Instead, Fargate will manage that for us automatically based on the optional memory and cpu values we request for our containers.

While this approach manages nearly everything on your behalf, it can often be desirable to control more of what is going on. To help explain how that works, we’ll work from the top down up to see how each part of your containerized infrastructure can be configured.

Clusters

A Cluster defines the infrastructure to run Services and Tasks in. If a Cluster is not specified when creating Services or running Tasks, then a default one will be created that is confired to use The Default VPC for your region. Creating a Cluster that uses a different Vpc can be simply done by:

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const vpc = // ... create custom vpc
const cluster = new awsx.ecs.Cluster("custom", { vpc });

const nginx = new awsx.ecs.FargateService("nginx", {
    cluster,
    // ... additional args
});

A Cluster created in this manner is ready for use by Fargate. In order to be used by EC2 though scaling capacity needs to be added to the Cluster. This can be done simply like so:

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const vpc = // ... create custom vpc
const cluster = new awsx.ecs.Cluster("custom", { vpc });

const asg = cluster.createAutoScalingGroup("custom", {
    templateParameters: { minSize: 20 },
    launchConfigurationArgs: { instanceType: "t2.medium" },
});

Task Definitions

A task definition is required to run Docker containers in Amazon ECS. Some of the parameters you can specify in a task definition include:

  • The Docker image to use with each container in your task
  • How much CPU and memory to use with each task or each container within a task
  • The Docker networking mode to use for the containers in your task
  • The logging configuration to use for your tasks
  • Whether the task should continue to run if the container finishes or fails
  • The command the container should run when it is started
  • Any data volumes that should be used with the containers in the task
  • The IAM role that your tasks should use

You can define multiple containers in a task definition. Tasks can easily be created to run either in Fargate or EC2 like so:

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const vpc = // ... create custom vpc
const cluster = new awsx.ecs.Cluster("custom", { vpc });

// optionally create an auto scaling group for EC2 tasks.

const fargateTask = new awsx.ecs.FargateTaskDefinition("fargate-nginx", {
    containers: {
        nginx: // ...
    },
});

const ec2Task = new awsx.ecs.FargateTaskDefinition("ec2-nginx", {
    containers: {
        nginx: // ...
    },
});

A Task Definition can be used to define a Service, or it can be run on demand in a ‘fire and forget’ manner (for example, from within a Lambda callback). This can be done by calling the run method on the Task instance. This run call must be supplied a Cluster to run in. For example. continuing from above:

const helloTask = new awsx.ecs.FargateTaskDefinition("hello-world", {
    container: {
        image: "hello-world",
        memory: 20,
    },
});

const api = new aws.apigateway.x.API("examples-containers", {
    routes: [{
        path: "/run",
        method: "GET",
        eventHandler: async (req) => {
            const result = await helloTask.run({ cluster });
        },
    }],
});

Additional arguments can be passed to run to control how the instance will be run.

Services

ECS allows you to run and maintain a specified number of instances of a task definition simultaneously in a cluster. This is called a Service. If any of your tasks should fail or stop for any reason, the ECS launches another instance of your task definition to replace it and maintain the desired count of tasks in the service depending on the scheduling strategy used.

Services can be simply be made for Fargate and EC2 like so:

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const vpc = // ... create custom vpc
const cluster = new awsx.ecs.Cluster("custom", { vpc });

// optionally create an auto scaling group for EC2 tasks.

const fargateService = new awsx.ecs.FargateService("fargate-nginx", {
    cluster,
    desiredCount: 2,
    taskDefinitionArgs: {
      containers: {
        nginx: // ...
      },
    },
});

const ec2Service = new awsx.ecs.FargateService("ec2-nginx", {
    cluster,
    desiredCount: 2,
    taskDefinitionArgs: {
      containers: {
        nginx: // ...
      },
    },
});

In the case where a Task is both expected to run in a Service and a ‘fire and forget’ manner, then the following pattern can be used:

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const vpc = // ... create custom vpc
const cluster = new awsx.ecs.Cluster("custom", { vpc });

// optionally create an auto scaling group for EC2 tasks.

const fargateTask = new awsx.ecs.FargateTaskDefinition("fargate-nginx", {
    containers: {
        nginx: // ...
    },
});

const fargateService = fargateTask.createService("fargate-nginx", {
    cluster,
    desiredCount: 2,
});

Containers

A Task Definition is built from a collection of Container Definitions. These definitions are used to specify the docker configuration for the container instances that are launched. The simplest way to specify the docker image to run is to provide a string to the ‘image’ parameter of the container definition. This string is either the name of an image on DockerHub, or an ECR Repository.

import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const listener = new awsx.lb.NetworkListener("listener", { port: 80 });
const task = new awsx.ecs.FargateTaskDefinition("task", {
    containers: {
        nginx: {
            image: "nginx",
            memory: 128,
            portMappings: [listener],
        },
    },
});

However, image is far more flexible than that. Beyond just accepting a string a ContainerImageProvider can also be provided. Instances of this interface can be used to dynamically compute and pass in an ECR repository path. Pulumi provides several convenient ways to do this.

For example fromPath will run a Docker build in that path, push the result up to an ECR repository, and then pass the repostory path to the container:

const task = new awsx.ecs.FargateTaskDefinition("task", {
    containers: {
        nginx: {
            image: awsx.ecs.Image.fromPath(/*localPath*/"..."),
            // ...
        },
    },
});

For more control over the Docker invocation fromDockerBuild an be used like so:

const task = new awsx.ecs.FargateTaskDefinition("task", {
    containers: {
        nginx: {
            image: awsx.ecs.Image.fromDockerBuild({
                    context: "./app",
                    dockerfile: "./app/Dockerfile-multistage",
                    cacheFrom: {stages: ["build"]},
                }),
            // ...
        },
    },
});

Finally, Pulumi offers a way to create a Container from a callback function. This allows for an infrastructure setup where the code that runs in a container is itself supplied as code directly in the Pulumi application like so. This can be setup like so:

const listener =
    new awsx.lb.NetworkTargetGroup("custom", { port: 8080 })
               .createListener("custom", { port: 80 });

const service = new awsx.ecs.EC2Service("custom", {
    cluster,
    desiredCount: 2,
    taskDefinitionArgs: {
        containers: {
            webserver: {
                memory: 128,
                portMappings: [listener],
                image: awsx.ecs.Image.fromFunction(() => {
                    const rand = Math.random();
                    const http = require("http");
                    http.createServer((req: any, res: any) => {
                        res.end(`Hello, world! (from ${rand})`);
                    }).listen(8080);
                }),
            },
        },
    },
});

class Cluster

extends ComponentResource
implements AutoScalingUserData

A Cluster is a general purpose ECS cluster configured to run in a provided Network.

constructor

new Cluster(name: string, args: ClusterArgs, opts: pulumi.ComponentResourceOptions)

method addAutoScalingGroup

public addAutoScalingGroup(group: x.autoscaling.AutoScalingGroup): void

method createAutoScalingGroup

public createAutoScalingGroup(name: string, args: x.autoscaling.AutoScalingGroupArgs, opts: pulumi.ComponentResourceOptions): AutoScalingGroup

Creates a new autoscaling group and adds it to the list of autoscaling groups targeting this cluster. The autoscaling group will be created with is network set to the same network as this cluster as well as using this cluster to initialize both its securityGroups and launchConfiguration userData.

method createDefaultSecurityGroup

public static createDefaultSecurityGroup(name: string, vpc?: x.ec2.Vpc, opts: pulumi.ComponentResourceOptions): x.ec2.SecurityGroup

method createDefaultSecurityGroupEgressRules

public static createDefaultSecurityGroupEgressRules(name: string, securityGroup: x.ec2.SecurityGroup): EgressSecurityGroupRule[]

method createDefaultSecurityGroupIngressRules

public static createDefaultSecurityGroupIngressRules(name: string, securityGroup: x.ec2.SecurityGroup): IngressSecurityGroupRule[]

method getDefault

public static getDefault(opts?: pulumi.ComponentResourceOptions): Cluster

Gets or creates a cluster that can be used by default for the current aws account and region. The cluster will use the default Vpc for the account and will be provisioned with a security group created by [createDefaultSecurityGroup].

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property autoScalingGroups

public autoScalingGroups: x.autoscaling.AutoScalingGroup[] =  [];

property cluster

public cluster: aws.ecs.Cluster;

property extraBootcmdLines

public extraBootcmdLines: () => pulumi.Input<x.autoscaling.UserDataLine[]>;

property id

public id: pulumi.Output<string>;

property securityGroups

public securityGroups: x.ec2.SecurityGroup[];

Security groups associated with this this ECS Cluster.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

property vpc

public vpc: x.ec2.Vpc;

The network in which to create this cluster.

class EC2Service

extends Service

constructor

new EC2Service(name: string, args: EC2ServiceArgs, opts?: pulumi.ComponentResourceOptions)

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property cluster

public cluster: ecs.Cluster;

property service

public service: aws.ecs.Service;

property taskDefinition

public taskDefinition: EC2TaskDefinition;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class EC2TaskDefinition

extends TaskDefinition

constructor

new EC2TaskDefinition(name: string, args: EC2TaskDefinitionArgs, opts?: pulumi.ComponentResourceOptions)

method createExecutionRole

public static createExecutionRole(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): aws.iam.Role

Creates the [executionRole] for a [TaskDefinition] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultRoleAssumeRolePolicy] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultExecutionRolePolicyARNs] will be used.

method createService

public createService(name: string, args: ecs.EC2ServiceArgs, opts: pulumi.ComponentResourceOptions): EC2Service

Creates a service with this as its task definition.

method createTaskRole

public static createTaskRole(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): aws.iam.Role

Creates the [taskRole] for a [TaskDefinition] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultRoleAssumeRolePolicy] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultTaskRolePolicyARNs] will be used.

method defaultExecutionRolePolicyARNs

public static defaultExecutionRolePolicyARNs(): string[]

method defaultRoleAssumeRolePolicy

public static defaultRoleAssumeRolePolicy(): aws.iam.PolicyDocument

method defaultTaskRolePolicyARNs

public static defaultTaskRolePolicyARNs(): string[]

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property containers

public containers: Record<string, ecs.Container>;

property executionRole

public executionRole?: aws.iam.Role;

property logGroup

public logGroup?: aws.cloudwatch.LogGroup;

property run

public run: (params: RunTaskRequest) => Promise<awssdk.ECS.Types.RunTaskResponse>;

Run one or more instances of this TaskDefinition using the ECS runTask API, returning the Task instances.

This wrapper around runTask provides appropriate defaults based on the TaskDefinition and allows specifying a Cluster instead of individual network configurations.

This API is designed for use at runtime.

property taskDefinition

public taskDefinition: aws.ecs.TaskDefinition;

property taskRole

public taskRole?: aws.iam.Role;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class FargateService

extends Service

constructor

new FargateService(name: string, args: FargateServiceArgs, opts?: pulumi.ComponentResourceOptions)

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property cluster

public cluster: ecs.Cluster;

property service

public service: aws.ecs.Service;

property taskDefinition

public taskDefinition: FargateTaskDefinition;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class FargateTaskDefinition

extends TaskDefinition

constructor

new FargateTaskDefinition(name: string, args: ecs.FargateTaskDefinitionArgs, opts?: pulumi.ComponentResourceOptions)

method createExecutionRole

public static createExecutionRole(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): aws.iam.Role

Creates the [executionRole] for a [TaskDefinition] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultRoleAssumeRolePolicy] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultExecutionRolePolicyARNs] will be used.

method createService

public createService(name: string, args: ecs.FargateServiceArgs, opts: pulumi.ComponentResourceOptions): FargateService

Creates a service with this as its task definition.

method createTaskRole

public static createTaskRole(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): aws.iam.Role

Creates the [taskRole] for a [TaskDefinition] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultRoleAssumeRolePolicy] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultTaskRolePolicyARNs] will be used.

method defaultExecutionRolePolicyARNs

public static defaultExecutionRolePolicyARNs(): string[]

method defaultRoleAssumeRolePolicy

public static defaultRoleAssumeRolePolicy(): aws.iam.PolicyDocument

method defaultTaskRolePolicyARNs

public static defaultTaskRolePolicyARNs(): string[]

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property containers

public containers: Record<string, ecs.Container>;

property executionRole

public executionRole?: aws.iam.Role;

property logGroup

public logGroup?: aws.cloudwatch.LogGroup;

property run

public run: (params: RunTaskRequest) => Promise<awssdk.ECS.Types.RunTaskResponse>;

Run one or more instances of this TaskDefinition using the ECS runTask API, returning the Task instances.

This wrapper around runTask provides appropriate defaults based on the TaskDefinition and allows specifying a Cluster instead of individual network configurations.

This API is designed for use at runtime.

property taskDefinition

public taskDefinition: aws.ecs.TaskDefinition;

property taskRole

public taskRole?: aws.iam.Role;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Image

implements ContainerImageProvider

method environment

public environment(name: string, parent: pulumi.Resource): pulumi.Input<ecs.KeyValuePair[]>

method fromDockerBuild

public static fromDockerBuild(name: string, build: pulumi.Input<docker.DockerBuild>): Image

Creates an [Image] using the detailed build instructions provided in [build].

Either a [name] or [repository] needs to be provided where the built image will be pushed to. If [repository] is provided, it will be used as-is. Otherwise, a new one will be created on-demand, using the [name] value.

public static fromDockerBuild(repository: aws.ecr.Repository, build: pulumi.Input<docker.DockerBuild>): Image

method fromFunction

public static fromFunction(func: () => void): Image

Creates an [Image] given function code to use as the implementation of the container.

method fromPath

public static fromPath(name: string, path: pulumi.Input<string>): Image

Creates an [Image] given a path to a folder in which a Docker build should be run.

Either a [name] or [repository] needs to be provided where the built image will be pushed to. If [repository] is provided, it will be used as-is. Otherwise, a new one will be created on-demand, using the [name] value.

public static fromPath(repository: aws.ecr.Repository, path: pulumi.Input<string>): Image

method image

public image(name: string, parent: pulumi.Resource): pulumi.Input<string>

class Service

extends ComponentResource

constructor

new Service(type: string, name: string, args: ServiceArgs, isFargate: boolean, opts: pulumi.ComponentResourceOptions)

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property cluster

public cluster: ecs.Cluster;

property service

public service: aws.ecs.Service;

property taskDefinition

public taskDefinition: ecs.TaskDefinition;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class TaskDefinition

extends ComponentResource

constructor

new TaskDefinition(type: string, name: string, isFargate: boolean, args: TaskDefinitionArgs, opts?: pulumi.ComponentResourceOptions)

method createExecutionRole

public static createExecutionRole(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): aws.iam.Role

Creates the [executionRole] for a [TaskDefinition] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultRoleAssumeRolePolicy] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultExecutionRolePolicyARNs] will be used.

method createTaskRole

public static createTaskRole(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): aws.iam.Role

Creates the [taskRole] for a [TaskDefinition] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultRoleAssumeRolePolicy] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultTaskRolePolicyARNs] will be used.

method defaultExecutionRolePolicyARNs

public static defaultExecutionRolePolicyARNs(): string[]

method defaultRoleAssumeRolePolicy

public static defaultRoleAssumeRolePolicy(): aws.iam.PolicyDocument

method defaultTaskRolePolicyARNs

public static defaultTaskRolePolicyARNs(): string[]

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property containers

public containers: Record<string, ecs.Container>;

property executionRole

public executionRole?: aws.iam.Role;

property logGroup

public logGroup?: aws.cloudwatch.LogGroup;

property run

public run: (params: RunTaskRequest) => Promise<awssdk.ECS.Types.RunTaskResponse>;

Run one or more instances of this TaskDefinition using the ECS runTask API, returning the Task instances.

This wrapper around runTask provides appropriate defaults based on the TaskDefinition and allows specifying a Cluster instead of individual network configurations.

This API is designed for use at runtime.

property taskDefinition

public taskDefinition: aws.ecs.TaskDefinition;

property taskRole

public taskRole?: aws.iam.Role;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

interface ClusterArgs

Arguments bag for creating infrastructure for a new Cluster.

property cluster

cluster?: aws.ecs.Cluster | pulumi.Input<string>;

An existing Cluster (or Cluster-Id) to use for this awsx Cluster. If not provided, a default one will be created.

property name

name?: pulumi.Input<string>;

The name of the cluster (up to 255 letters, numbers, hyphens, and underscores)

property securityGroups

securityGroups?: x.ec2.SecurityGroupOrId[];

The security group to place new instances into. If not provided, a default will be created. Pass an empty array to create no security groups.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property vpc

vpc?: x.ec2.Vpc;

The network in which to create this cluster. If not provided, Vpc.getDefault() will be used.

interface Container

property command

command?: pulumi.Input<string[]>;

property cpu

property disableNetworking

disableNetworking?: pulumi.Input<boolean>;

property dnsSearchDomains

dnsSearchDomains?: pulumi.Input<string[]>;

property dnsServers

dnsServers?: pulumi.Input<string[]>;

property dockerLabels

dockerLabels?: pulumi.Input<{[label: string]: string}>;

property dockerSecurityOptions

dockerSecurityOptions?: pulumi.Input<string[]>;

property entryPoint

entryPoint?: pulumi.Input<string[]>;

property environment

environment?: pulumi.Input<KeyValuePair[]>;

property essential

essential?: pulumi.Input<boolean>;

property extraHosts

extraHosts?: pulumi.Input<aws.ecs.HostEntry[]>;

property hostname

hostname?: pulumi.Input<string>;

property image

image: pulumi.Input<string> | ContainerImageProvider;

The image id to use for the container. If this is provided then the image with this idq will be pulled from Docker Hub. To provide customized image retrieval, provide [imageProvide] which can do whatever custom work is necessary. See [Image] for common ways to create an image from a local docker build.

links?: pulumi.Input<string[]>;

property linuxParameters

linuxParameters?: pulumi.Input<aws.ecs.LinuxParameters>;

property logConfiguration

logConfiguration?: pulumi.Input<aws.ecs.LogConfiguration>;

property memory

memory?: pulumi.Input<number>;

property memoryReservation

memoryReservation?: pulumi.Input<number>;

property mountPoints

mountPoints?: pulumi.Input<aws.ecs.MountPoint[]>;

property portMappings

portMappings?: PortMapping | Promise<PortMapping> | OutputInstance<PortMapping> | ContainerPortMappingProvider[];

property privileged

privileged?: pulumi.Input<boolean>;

property readonlyRootFilesystem

readonlyRootFilesystem?: pulumi.Input<boolean>;

property ulimits

ulimits?: pulumi.Input<aws.ecs.Ulimit[]>;

property user

user?: pulumi.Input<string>;

property volumesFrom

volumesFrom?: pulumi.Input<aws.ecs.VolumeFrom[]>;

property workingDirectory

workingDirectory?: pulumi.Input<string>;

interface ContainerImageProvider

interface ContainerLoadBalancer

interface ContainerLoadBalancerProvider

interface ContainerPortMappingProvider

method containerPortMapping

containerPortMapping(name: string, parent: pulumi.Resource): pulumi.Input<aws.ecs.PortMapping>

interface EC2ServiceArgs

property cluster

cluster?: ecs.Cluster;

Cluster this service will run in.

property deploymentMaximumPercent

deploymentMaximumPercent?: pulumi.Input<number>;

The upper limit (as a percentage of the service’s desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy.

property deploymentMinimumHealthyPercent

deploymentMinimumHealthyPercent?: pulumi.Input<number>;

The lower limit (as a percentage of the service’s desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment.

property desiredCount

desiredCount?: pulumi.Input<number>;

The number of instances of the task definition to place and keep running. Defaults to 1. Do not specify if using the DAEMON scheduling strategy.

property healthCheckGracePeriodSeconds

healthCheckGracePeriodSeconds?: pulumi.Input<number>;

Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 7200. Only valid for services configured to use load balancers.

property iamRole

iamRole?: pulumi.Input<string>;

ARN of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service, but only if your task definition does not use the awsvpc network mode. If using awsvpc network mode, do not specify this role. If your account has already created the Amazon ECS service-linked role, that role is used by default for your service unless you specify a role here.

property loadBalancers

loadBalancers?: ServiceLoadBalancer | Promise<ServiceLoadBalancer> | OutputInstance<ServiceLoadBalancer> | ServiceLoadBalancerProvider[];

A load balancer block. Load balancers documented below.

property name

name?: pulumi.Input<string>;

The name of the service (up to 255 letters, numbers, hyphens, and underscores)

property orderedPlacementStrategies

orderedPlacementStrategies?: undefined | {
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. The maximum number of ordered_placement_strategy blocks is 5. Defined below.

property os

os?: pulumi.Input<“linux” | “windows”>;

property placementConstraints

placementConstraints?: undefined | {
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10. Defined below.

property schedulingStrategy

schedulingStrategy?: pulumi.Input<string>;

The scheduling strategy to use for the service. The valid values are REPLICA and DAEMON. Defaults to REPLICA. Note that Fargate tasks do not support the DAEMON scheduling strategy.

property securityGroups

securityGroups?: x.ec2.SecurityGroupOrId[];

The security groups to use for the instances.

Defaults to [cluster.securityGroups] if unspecified.

property serviceRegistries

serviceRegistries?: undefined | {
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
} | Promise<{
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
}> | OutputInstance<{
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
}>;

The service discovery registries for the service. The maximum number of service_registries blocks is 1.

property subnets

subnets?: pulumi.Input<pulumi.Input<string>[]>;

The subnets to connect the instances to. If unspecified then these will be the public subnets of the cluster’s vpc.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property taskDefinition

taskDefinition?: EC2TaskDefinition;

The task definition to create the service from. Either [taskDefinition] or [taskDefinitionArgs] must be provided.

property taskDefinitionArgs

taskDefinitionArgs?: EC2TaskDefinitionArgs;

The task definition to create the service from. Either [taskDefinition] or [taskDefinitionArgs] must be provided.

property waitForSteadyState

waitForSteadyState?: pulumi.Input<boolean>;

Wait for the service to reach a steady state (like aws ecs wait services-stable) before continuing. Defaults to true.

interface EC2TaskDefinitionArgs

property container

container?: ecs.Container;

Single container to make a TaskDefinition from. Useful for simple cases where there aren’t multiple containers, especially when creating a TaskDefinition to call [run] on.

Either [container] or [containers] must be provided.

property containers

containers?: Record<string, ecs.Container>;

All the containers to make a TaskDefinition from. Useful when creating a Service that will contain many containers within.

Either [container] or [containers] must be provided.

property executionRole

executionRole?: aws.iam.Role;

The execution role that the Amazon ECS container agent and the Docker daemon can assume.

If undefined, a default will be created for the task. If null no role will be created.

property logGroup

logGroup?: aws.cloudwatch.LogGroup;

Log group for logging information related to the service. If undefined a default instance with a one-day retention policy will be created. If null no log group will be created.

property networkMode

networkMode?: pulumi.Input<“none” | “bridge” | “awsvpc” | “host”>;

The Docker networking mode to use for the containers in the task. The valid values are none, bridge, awsvpc, and host.

property placementConstraints

placementConstraints?: undefined | {
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

A set of placement constraints rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property taskRole

taskRole?: aws.iam.Role;

IAM role that allows your Amazon ECS container task to make calls to other AWS services. If undefined, a default will be created for the task. If null no role will be created.

property volumes

volumes?: undefined | {
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[] | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]>;

A set of volume blocks that containers in your task may use.

interface FargateServiceArgs

property assignPublicIp

assignPublicIp?: pulumi.Input<boolean>;

Whether or not public IPs should be provided for the instances.

Defaults to [true] if unspecified.

property cluster

cluster?: ecs.Cluster;

Cluster this service will run in. If unspecified, [Cluster.getDefault()] will be used.

property deploymentMaximumPercent

deploymentMaximumPercent?: pulumi.Input<number>;

The upper limit (as a percentage of the service’s desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy.

property deploymentMinimumHealthyPercent

deploymentMinimumHealthyPercent?: pulumi.Input<number>;

The lower limit (as a percentage of the service’s desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment.

property desiredCount

desiredCount?: pulumi.Input<number>;

The number of instances of the task definition to place and keep running. Defaults to 1. Do not specify if using the DAEMON scheduling strategy.

property healthCheckGracePeriodSeconds

healthCheckGracePeriodSeconds?: pulumi.Input<number>;

Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 7200. Only valid for services configured to use load balancers.

property iamRole

iamRole?: pulumi.Input<string>;

ARN of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service, but only if your task definition does not use the awsvpc network mode. If using awsvpc network mode, do not specify this role. If your account has already created the Amazon ECS service-linked role, that role is used by default for your service unless you specify a role here.

property loadBalancers

loadBalancers?: ServiceLoadBalancer | Promise<ServiceLoadBalancer> | OutputInstance<ServiceLoadBalancer> | ServiceLoadBalancerProvider[];

A load balancer block. Load balancers documented below.

property name

name?: pulumi.Input<string>;

The name of the service (up to 255 letters, numbers, hyphens, and underscores)

property orderedPlacementStrategies

orderedPlacementStrategies?: undefined | {
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. The maximum number of ordered_placement_strategy blocks is 5. Defined below.

property os

os?: pulumi.Input<“linux” | “windows”>;

property placementConstraints

placementConstraints?: undefined | {
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10. Defined below.

property schedulingStrategy

schedulingStrategy?: pulumi.Input<string>;

The scheduling strategy to use for the service. The valid values are REPLICA and DAEMON. Defaults to REPLICA. Note that Fargate tasks do not support the DAEMON scheduling strategy.

property securityGroups

securityGroups?: x.ec2.SecurityGroupOrId[];

The security groups to use for the instances.

Defaults to [cluster.securityGroups] if unspecified.

property serviceRegistries

serviceRegistries?: undefined | {
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
} | Promise<{
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
}> | OutputInstance<{
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
}>;

The service discovery registries for the service. The maximum number of service_registries blocks is 1.

property subnets

subnets?: pulumi.Input<pulumi.Input<string>[]>;

The subnets to connect the instances to. If unspecified and [assignPublicIp] is true, then these will be the public subnets of the cluster’s vpc. If unspecified and [assignPublicIp] is false, then these will be the private subnets of the cluster’s vpc.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property taskDefinition

taskDefinition?: ecs.FargateTaskDefinition;

The task definition to create the service from. Either [taskDefinition] or [taskDefinitionArgs] must be provided.

property taskDefinitionArgs

taskDefinitionArgs?: FargateTaskDefinitionArgs;

The task definition to create the service from. Either [taskDefinition] or [taskDefinitionArgs] must be provided.

property waitForSteadyState

waitForSteadyState?: pulumi.Input<boolean>;

Wait for the service to reach a steady state (like aws ecs wait services-stable) before continuing. Defaults to true.

interface FargateTaskDefinitionArgs

property container

container?: ecs.Container;

Single container to make a TaskDefinition from. Useful for simple cases where there aren’t multiple containers, especially when creating a TaskDefinition to call [run] on.

Either [container] or [containers] must be provided.

property containers

containers?: Record<string, ecs.Container>;

All the containers to make a TaskDefinition from. Useful when creating a Service that will contain many containers within.

Either [container] or [containers] must be provided.

property cpu

cpu?: pulumi.Input<string>;

The number of cpu units used by the task. If not provided, a default will be computed based on the cumulative needs specified by [containerDefinitions]

property executionRole

executionRole?: aws.iam.Role;

The execution role that the Amazon ECS container agent and the Docker daemon can assume.

If undefined, a default will be created for the task. If null no role will be created.

property logGroup

logGroup?: aws.cloudwatch.LogGroup;

Log group for logging information related to the service. If undefined a default instance with a one-day retention policy will be created. If null no log group will be created.

property memory

memory?: pulumi.Input<string>;

The amount (in MiB) of memory used by the task. If not provided, a default will be computed based on the cumulative needs specified by [containerDefinitions]

property placementConstraints

placementConstraints?: undefined | {
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

A set of placement constraints rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property taskRole

taskRole?: aws.iam.Role;

IAM role that allows your Amazon ECS container task to make calls to other AWS services. If undefined, a default will be created for the task. If null no role will be created.

property volumes

volumes?: undefined | {
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[] | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]>;

A set of volume blocks that containers in your task may use.

interface KeyValuePair

See https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_KeyValuePair.html for more details.

property name

name: pulumi.Input<string>;

The name of the key-value pair. For environment variables, this is the name of the environment variable.

property value

value: pulumi.Input<string>;

The value of the key-value pair. For environment variables, this is the value of the environment variable.

interface NetworkConfiguration

property assignPublicIp

assignPublicIp?: pulumi.Input<boolean>;

Assign a public IP address to the ENI (Fargate launch type only). Valid values are true or false. Default false.

property securityGroups

securityGroups?: pulumi.Input<pulumi.Input<string>[]>;

The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.

property subnets

subnets: pulumi.Input<pulumi.Input<string>[]>;

The subnets associated with the task or service.

interface RunTaskRequest

property cluster

cluster: ecs.Cluster;

The Cluster to run the Task within.

property count

count?: awssdk.ECS.BoxedInteger;

The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per call.

property enableECSManagedTags

enableECSManagedTags?: awssdk.ECS.Boolean;

Specifies whether to enable Amazon ECS managed tags for the task. For more information, see Tagging Your Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide.

property group

group?: awssdk.ECS.String;

The name of the task group to associate with the task. The default value is the family name of the task definition (for example, family:my-family-name).

property networkConfiguration

networkConfiguration?: awssdk.ECS.NetworkConfiguration;

The network configuration for the task. This parameter is required for task definitions that use the awsvpc network mode to receive their own elastic network interface, and it is not supported for other network modes. For more information, see Task Networking in the Amazon Elastic Container Service Developer Guide.

property overrides

overrides?: awssdk.ECS.TaskOverride;

A list of container overrides in JSON format that specify the name of a container in the specified task definition and the overrides it should receive. You can override the default command for a container (that is specified in the task definition or Docker image) with a command override. You can also override existing environment variables (that are specified in the task definition or Docker image) on a container or add new environment variables to it with an environment override. A total of 8192 characters are allowed for overrides. This limit includes the JSON formatting characters of the override structure.

property placementConstraints

placementConstraints?: awssdk.ECS.PlacementConstraints;

An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime).

property placementStrategy

placementStrategy?: awssdk.ECS.PlacementStrategies;

The placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.

property platformVersion

platformVersion?: awssdk.ECS.String;

The platform version the task should run. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.

property propagateTags

propagateTags?: awssdk.ECS.PropagateTags;

Specifies whether to propagate the tags from the task definition or the service to the task. If no value is specified, the tags are not propagated.

property startedBy

startedBy?: awssdk.ECS.String;

An optional tag specified when a task is started. For example, if you automatically trigger a task to run a batch process job, you could apply a unique identifier for that job to your task with the startedBy parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks call with the startedBy value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.

property tags

tags?: awssdk.ECS.Tags;

The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

interface ServiceArgs

property cluster

cluster?: ecs.Cluster;

Cluster this service will run in. If not specified [Cluster.getDefault()] will be used.

property deploymentMaximumPercent

deploymentMaximumPercent?: pulumi.Input<number>;

The upper limit (as a percentage of the service’s desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy.

property deploymentMinimumHealthyPercent

deploymentMinimumHealthyPercent?: pulumi.Input<number>;

The lower limit (as a percentage of the service’s desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment.

property desiredCount

desiredCount?: pulumi.Input<number>;

The number of instances of the task definition to place and keep running. Defaults to 1. Do not specify if using the DAEMON scheduling strategy.

property healthCheckGracePeriodSeconds

healthCheckGracePeriodSeconds?: pulumi.Input<number>;

Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 7200. Only valid for services configured to use load balancers.

property iamRole

iamRole?: pulumi.Input<string>;

ARN of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service, but only if your task definition does not use the awsvpc network mode. If using awsvpc network mode, do not specify this role. If your account has already created the Amazon ECS service-linked role, that role is used by default for your service unless you specify a role here.

property launchType

launchType?: pulumi.Input<“EC2” | “FARGATE”>;

The launch type on which to run your service. The valid values are EC2 and FARGATE. Defaults to EC2.

property loadBalancers

loadBalancers?: ServiceLoadBalancer | Promise<ServiceLoadBalancer> | OutputInstance<ServiceLoadBalancer> | ServiceLoadBalancerProvider[];

A load balancer block. Load balancers documented below.

property name

name?: pulumi.Input<string>;

The name of the service (up to 255 letters, numbers, hyphens, and underscores)

property networkConfiguration

networkConfiguration?: pulumi.Input<NetworkConfiguration>;

The network configuration for the service. This parameter is required for task definitions that use the awsvpc network mode to receive their own Elastic Network Interface, and it is not supported for other network modes.

property orderedPlacementStrategies

orderedPlacementStrategies?: undefined | {
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    field: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. The maximum number of ordered_placement_strategy blocks is 5. Defined below.

property placementConstraints

placementConstraints?: undefined | {
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10. Defined below.

property schedulingStrategy

schedulingStrategy?: pulumi.Input<string>;

The scheduling strategy to use for the service. The valid values are REPLICA and DAEMON. Defaults to REPLICA. Note that Fargate tasks do not support the DAEMON scheduling strategy.

property securityGroups

securityGroups: x.ec2.SecurityGroup[];

Security groups determining how this service can be reached.

property serviceRegistries

serviceRegistries?: undefined | {
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
} | Promise<{
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
}> | OutputInstance<{
    containerName: pulumi.Input<string>;
    containerPort: pulumi.Input<number>;
    port: pulumi.Input<number>;
    registryArn: pulumi.Input<string>;
}>;

The service discovery registries for the service. The maximum number of service_registries blocks is 1.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property taskDefinition

taskDefinition: ecs.TaskDefinition;

The task definition to create the service from.

property waitForSteadyState

waitForSteadyState?: pulumi.Input<boolean>;

Wait for the service to reach a steady state (like aws ecs wait services-stable) before continuing. Defaults to true.

interface ServiceLoadBalancer

interface ServiceLoadBalancerProvider

interface TaskDefinitionArgs

property containers

containers: Record<string, ecs.Container>;

All the containers to make a ClusterTaskDefinition from. Useful when creating a ClusterService that will contain many containers within.

Either [container] or [containers] must be provided.

property cpu

cpu?: pulumi.Input<string>;

The number of cpu units used by the task. If not provided, a default will be computed based on the cumulative needs specified by [containerDefinitions]

property executionRole

executionRole?: aws.iam.Role;

The execution role that the Amazon ECS container agent and the Docker daemon can assume.

If undefined, a default will be created for the task. If null, no task will be created.

property logGroup

logGroup?: aws.cloudwatch.LogGroup;

Log group for logging information related to the service. If undefined a default instance with a one-day retention policy will be created. If null, no log group will be created.

property memory

memory?: pulumi.Input<string>;

The amount (in MiB) of memory used by the task. If not provided, a default will be computed based on the cumulative needs specified by [containerDefinitions]

property networkMode

networkMode?: pulumi.Input<“none” | “bridge” | “awsvpc” | “host”>;

The Docker networking mode to use for the containers in the task. The valid values are none, bridge, awsvpc, and host.

property placementConstraints

placementConstraints?: undefined | {
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[] | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
} | Promise<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}> | OutputInstance<{
    expression: pulumi.Input<string>;
    type: pulumi.Input<string>;
}>[]>;

A set of placement constraints rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10.

property requiresCompatibilities

requiresCompatibilities: pulumi.Input<[, “FARGATE”] | [, “EC2”]>;

A set of launch types required by the task. The valid values are EC2 and FARGATE.

property tags

tags?: pulumi.Input<aws.Tags>;

Key-value mapping of resource tags

property taskRole

taskRole?: aws.iam.Role;

IAM role that allows your Amazon ECS container task to make calls to other AWS services. If undefined, a default will be created for the task. If null, no task will be created.

property volumes

volumes?: undefined | {
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[] | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
} | Promise<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}> | OutputInstance<{
    dockerVolumeConfiguration: pulumi.Input<{
        autoprovision: pulumi.Input<boolean>;
        driver: pulumi.Input<string>;
        driverOpts: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        labels: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
        scope: pulumi.Input<string>;
    }>;
    hostPath: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]>;

A set of volume blocks that containers in your task may use.

module metrics

function cpuReservation

cpuReservation(change?: EcsMetricChange): Metric

The percentage of CPU units that are reserved by running tasks in the cluster.

Cluster CPU reservation (this metric can only be filtered by ClusterName) is measured as the total CPU units that are reserved by Amazon ECS tasks on the cluster, divided by the total CPU units that were registered for all of the container instances in the cluster. This metric is only used for tasks using the EC2 launch type.

Valid dimensions: ClusterName.

Valid statistics: Average, Minimum, Maximum, Sum, Sample Count. The most useful statistic is Average.

Unit: Percent.

function cpuUtilization

cpuUtilization(change?: EcsMetricChange): Metric

The percentage of CPU units that are used in the cluster or service.

Cluster CPU utilization (metrics that are filtered by ClusterName without ServiceName) is measured as the total CPU units in use by Amazon ECS tasks on the cluster, divided by the total CPU units that were registered for all of the container instances in the cluster. Cluster CPU utilization metrics are only used for tasks using the EC2 launch type.

Service CPU utilization (metrics that are filtered by ClusterName and ServiceName) is measured as the total CPU units in use by the tasks that belong to the service, divided by the total number of CPU units that are reserved for the tasks that belong to the service. Service CPU utilization metrics are used for tasks using both the Fargate and the EC2 launch type.

Valid dimensions: ClusterName, ServiceName.

Valid statistics: Average, Minimum, Maximum, Sum, Sample Count. The most useful statistic is Average.

Unit: Percent.

function gpuReservation

gpuReservation(change?: EcsMetricChange): Metric

The percentage of total available GPUs that are reserved by running tasks in the cluster.

Cluster GPU reservation is measured as the number of GPUs reserved by Amazon ECS tasks on the cluster, divided by the total number of GPUs that was available on all of the GPU-enabled container instances in the cluster.

Valid dimensions: ClusterName.

Valid statistics: Average, Minimum, Maximum, Sum, Sample Count. The most useful statistic is Average.

Unit: Percent.

function memoryReservation

memoryReservation(change?: EcsMetricChange): Metric

The percentage of memory that is reserved by running tasks in the cluster.

Cluster memory reservation (this metric can only be filtered by ClusterName) is measured as the total memory that is reserved by Amazon ECS tasks on the cluster, divided by the total amount of memory that was registered for all of the container instances in the cluster. This metric is only used for tasks using the EC2 launch type.

Valid dimensions: ClusterName.

Valid statistics: Average, Minimum, Maximum, Sum, Sample Count. The most useful statistic is Average.

Unit: Percent.

function memoryUtilization

memoryUtilization(change?: EcsMetricChange): Metric

The percentage of memory that is used in the cluster or service.

Cluster memory utilization (metrics that are filtered by ClusterName without ServiceName) is measured as the total memory in use by Amazon ECS tasks on the cluster, divided by the total amount of memory that was registered for all of the container instances in the cluster. Cluster memory utilization metrics are only used for tasks using the EC2 launch type.

Service memory utilization (metrics that are filtered by ClusterName and ServiceName) is measured as the total memory in use by the tasks that belong to the service, divided by the total memory that is reserved for the tasks that belong to the service. Service memory utilization metrics are used for tasks using both the Fargate and EC2 launch types.

Valid dimensions: ClusterName, ServiceName.

Valid statistics: Average, Minimum, Maximum, Sum, Sample Count. The most useful statistic is Average.

Unit: Percent.

function metric

metric(metricName: EcsMetricName, change: EcsMetricChange): Metric

Creates an AWS/ECS metric with the requested [metricName]. See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-metrics.html for list of all metric-names.

Note, individual metrics can easily be obtained without supplying the name using the other [metricXXX] functions.

You can monitor your Amazon ECS resources using Amazon CloudWatch, which collects and processes raw data from Amazon ECS into readable, near real-time metrics. These statistics are recorded for a period of two weeks so that you can access historical information and gain a better perspective on how your clusters or services are performing. Amazon ECS metric data is automatically sent to CloudWatch in 1-minute periods. For more information about CloudWatch, see the Amazon-CloudWatch-User-Guide.

Amazon ECS metrics use the AWS/ECS namespace and provide metrics for the following dimensions.

  1. “ClusterName”: This dimension filters the data that you request for all resources in a specified cluster. All Amazon ECS metrics are filtered by ClusterName.
  2. “ServiceName”: This dimension filters the data that you request for all resources in a specified service within a specified cluster.

interface EcsMetricChange

type EcsMetricName

type EcsMetricName = “CPUReservation” | “CPUUtilization” | “MemoryReservation” | “MemoryUtilization” | “GPUReservation”;