AWS::Events::Rule EcsParameters - AWS CloudFormation

AWS::Events::Rule EcsParameters

The custom parameters to be used when the target is an Amazon ECS task.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "CapacityProviderStrategy" : [ CapacityProviderStrategyItem, ... ], "EnableECSManagedTags" : Boolean, "EnableExecuteCommand" : Boolean, "Group" : String, "LaunchType" : String, "NetworkConfiguration" : NetworkConfiguration, "PlacementConstraints" : [ PlacementConstraint, ... ], "PlacementStrategies" : [ PlacementStrategy, ... ], "PlatformVersion" : String, "PropagateTags" : String, "ReferenceId" : String, "TagList" : [ Tag, ... ], "TaskCount" : Integer, "TaskDefinitionArn" : String }

Properties

CapacityProviderStrategy

The capacity provider strategy to use for the task.

If a capacityProviderStrategy is specified, the launchType parameter must be omitted. If no capacityProviderStrategy or launchType is specified, the defaultCapacityProviderStrategy for the cluster is used.

Required: No

Type: Array of CapacityProviderStrategyItem

Maximum: 6

Update requires: No interruption

EnableECSManagedTags

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.

Required: No

Type: Boolean

Update requires: No interruption

EnableExecuteCommand

Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.

Required: No

Type: Boolean

Update requires: No interruption

Group

Specifies an ECS task group for the task. The maximum length is 255 characters.

Required: No

Type: String

Update requires: No interruption

LaunchType

Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. The FARGATE value is supported only in the Regions where AWS Fargate with Amazon ECS is supported. For more information, see AWS Fargate on Amazon ECS in the Amazon Elastic Container Service Developer Guide.

Required: No

Type: String

Allowed values: EC2 | FARGATE | EXTERNAL

Update requires: No interruption

NetworkConfiguration

Use this structure if the Amazon ECS task uses the awsvpc network mode. This structure specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. This structure is required if LaunchType is FARGATE because the awsvpc mode is required for Fargate tasks.

If you specify NetworkConfiguration when the target ECS task does not use the awsvpc network mode, the task fails.

Required: No

Type: NetworkConfiguration

Update requires: No interruption

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).

Required: No

Type: Array of PlacementConstraint

Maximum: 10

Update requires: No interruption

PlacementStrategies

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

Required: No

Type: Array of PlacementStrategy

Maximum: 5

Update requires: No interruption

PlatformVersion

Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as 1.1.0.

This structure is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.

Required: No

Type: String

Update requires: No interruption

PropagateTags

Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task creation, use the TagResource API action.

Required: No

Type: String

Allowed values: TASK_DEFINITION

Update requires: No interruption

ReferenceId

The reference ID to use for the task.

Required: No

Type: String

Maximum: 1024

Update requires: No interruption

TagList

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. To learn more, see RunTask in the Amazon ECS API Reference.

Required: No

Type: Array of Tag

Update requires: No interruption

TaskCount

The number of tasks to create based on TaskDefinition. The default is 1.

Required: No

Type: Integer

Minimum: 1

Update requires: No interruption

TaskDefinitionArn

The ARN of the task definition to use if the event target is an Amazon ECS task.

Required: Yes

Type: String

Minimum: 1

Maximum: 1600

Update requires: No interruption

Examples

ECS example

The following example defines the ECS parameters.

JSON

{ "LaunchType": "FARGATE", "NetworkConfiguration": { "AwsVpcConfiguration": { "AssignPublicIp": "DISABLED", "SecurityGroups": [ { "Fn: : GetAtt": [ "ScheduledFargateTaskScheduledTaskDefSecurityGroupE075BC19", "GroupId" ] } ], "Subnets": [ { "Ref": "Vpc01" } ] } }, "TaskCount": 2, "TaskDefinitionArn": { "Ref": "ScheduledFargateTaskScheduledTaskDef521FA675" }, "enableECSManagedTags": true, "placementConstraints": [ { "expression": "attribute:ecs.instance-type == t2.small", "type": "memberOf" } ], "placementStrategy": [ { "field": "instanceId", "type ": "binpack" } ], "propagateTags": "TASK_DEFINITION", "referenceId": "idopsks", "startedBy": "user1", "tags": [ { "key": "maintask", "value ": "taskvalue" } ] }

YAML

LaunchType: "FARGATE" NetworkConfiguration: AwsVpcConfiguration: AssignPublicIp: "DISABLED" SecurityGroups: Fn: : GetAtt: "ScheduledFargateTaskScheduledTaskDefSecurityGroupE075BC19", "GroupId" Subnets: Ref: "Vpc01" TaskCount: 2 TaskDefinitionArn: Ref: "ScheduledFargateTaskScheduledTaskDef521FA675" enableECSManagedTags: true placementConstraints: expression: "attribute:ecs.instance-type == t2.small" type: "memberOf" placementStrategy: field: "instanceId" type: "binpack" propagateTags: "TASK_DEFINITION" referenceId: "idopsks" startedBy: "user1" tags: key: "maintask" value: "taskvalue"