Configuration options for the [[GuEcsTask]] pattern.

See [[ContainerConfiguration]] for details of how to configure the container used to run the task.

taskTimeoutInMinutes does what is says on the tin. The default timeout is 15 minutes.

The taskCommand prop allows you to specify a command to run when the task starts (this can also be done via a CMD statement in your Dockerfile). For example:

const props = { //other props taskCommand: `aws s3 cp s3://${distbucket}/${stack}/${stage}/${app}/task.sh . && ./task.sh }

It is advisable to configure alarms for when the job fails/times out. To do this specify the alarmSnsTopicArn prop.

customTaskPolicies allows your task to interact with other AWS services. By default a task will have read access to the distribution bucket for your account.

You can specify security groups to apply to task using the securityGroups prop.

You can also set the memory and cpu units for your task. See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size for further details.

If you want to pass input from the step function into your EcsTask you can do so via the environmentOverrides prop, which allows you to wire up step function input JSON to environment variables set on the container. For example, const props = { ...otherProps environmentOverrides: [ { name: "VERSION", value: JsonPath.stringAt("$.version"), }, } With the above override, your task will attempt to find a version property in the JSON input passed to the step function, and apply it to the VERSION environment variable. Alternatively, you could hard code a value for the variable in CDK. See https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html for further detail and other override options - this construct currently only supports environment variables.

Hierarchy

Properties

app: string
containerConfiguration: ContainerConfiguration
cpu?: number
customTaskPolicies?: PolicyStatement[]
environmentOverrides?: TaskEnvironmentVariable[]
memory?: number
monitoringConfiguration: NoMonitoring | GuEcsTaskMonitoringProps
securityGroups?: ISecurityGroup[]
storage?: number
taskCommand?: string
taskTimeoutInMinutes?: number
vpc: IVpc

Generated using TypeDoc