Skip to content
v2.274.0

EcsRunTaskBaseProps Struct ​

Parameters for scheduling ECS Run Task (common to EC2 and Fargate launch types).

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_scheduler as scheduler } from 'aws-cdk-lib';
import { aws_scheduler_targets as scheduler_targets } from 'aws-cdk-lib';
import { aws_sqs as sqs } from 'aws-cdk-lib';

declare const queue: sqs.Queue;
declare const role: iam.Role;
declare const scheduleTargetInput: scheduler.ScheduleTargetInput;
declare const securityGroup: ec2.SecurityGroup;
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const taskDefinition: ecs.TaskDefinition;
const ecsRunTaskBaseProps: scheduler_targets.EcsRunTaskBaseProps = {
  taskDefinition: taskDefinition,

  // the properties below are optional
  capacityProviderStrategies: [{
    capacityProvider: 'capacityProvider',

    // the properties below are optional
    base: 123,
    weight: 123,
  }],
  deadLetterQueue: queue,
  enableEcsManagedTags: false,
  enableExecuteCommand: false,
  group: 'group',
  input: scheduleTargetInput,
  maxEventAge: cdk.Duration.minutes(30),
  propagateTags: false,
  referenceId: 'referenceId',
  retryAttempts: 123,
  role: role,
  securityGroups: [securityGroup],
  tags: [{
    key: 'key',
    value: 'value',
  }],
  taskCount: 123,
  vpcSubnets: {
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  },
};

Properties ​

capacityProviderStrategiesoptionalCapacityProviderStrategy[]capacity_provider_strategiesoptionaltyping.List[CapacityProviderStrategy]capacityProviderStrategiesoptionalList<CapacityProviderStrategy>CapacityProviderStrategiesoptionalCapacityProviderStrategy[]CapacityProviderStrategiesoptional*[]CapacityProviderStrategy#
The capacity provider strategy to use for the task.

Default: No capacity provider strategy

deadLetterQueueoptionalIQueuedead_letter_queueoptionalIQueuedeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueue#
The SQS queue to be used as deadLetterQueue.

Default: no dead-letter queue

notes

The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.

enableEcsManagedTagsoptionalbooleanenable_ecs_managed_tagsoptionalboolenableEcsManagedTagsoptionalBooleanEnableEcsManagedTagsoptionalboolEnableEcsManagedTagsoptional*bool= false#
Specifies whether to enable Amazon ECS managed tags for the task.
enableExecuteCommandoptionalbooleanenable_execute_commandoptionalboolenableExecuteCommandoptionalBooleanEnableExecuteCommandoptionalboolEnableExecuteCommandoptional*bool= false#
Whether to enable execute command functionality for the containers in this task.

If true, this enables execute command functionality on all containers in the task.

groupoptionalstringgroupoptionalstrgroupoptionalStringGroupoptionalstringGroupoptional*string#
Specifies an ECS task group for the task.

Default: No group

inputoptionalScheduleTargetInputinputoptionalScheduleTargetInputinputoptionalScheduleTargetInputInputoptionalScheduleTargetInputInputoptionalScheduleTargetInput#
Input passed to the target.

Default: no input.

maxEventAgeoptionalDurationmax_event_ageoptionalDurationmaxEventAgeoptionalDurationMaxEventAgeoptionalDurationMaxEventAgeoptionalDuration= Duration.hours(24)#
The maximum age of a request that Scheduler sends to a target for processing.

Minimum value of 60. Maximum value of 86400.

propagateTagsoptionalbooleanpropagate_tagsoptionalboolpropagateTagsoptionalBooleanPropagateTagsoptionalboolPropagateTagsoptional*bool#
Specifies whether to propagate the tags from the task definition to the task.

Default: No tag propagation

If no value is specified, the tags are not propagated.

referenceIdoptionalstringreference_idoptionalstrreferenceIdoptionalStringReferenceIdoptionalstringReferenceIdoptional*string#
The reference ID to use for the task.

Default: No reference ID.

retryAttemptsoptionalnumberretry_attemptsoptionalint | floatretryAttemptsoptionalNumberRetryAttemptsoptionaldoubleRetryAttemptsoptional*float64= 185#
The maximum number of times to retry when the target returns an error.

Minimum value of 0. Maximum value of 185.

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.

Default: created by target

notes

If none provided templates target will automatically create an IAM role with all the minimum necessary permissions to interact with the templated target. If you wish you may specify your own IAM role, then the templated targets will grant minimal required permissions.

securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#
The security groups associated with the task.

Default: The security group for the VPC is used.

These security groups must all be in the same VPC. Controls inbound and outbound network access for the task.

tagsoptionalTag[]tagsoptionaltyping.List[Tag]tagsoptionalList<Tag>TagsoptionalTag[]Tagsoptional*[]Tag#
The metadata that you apply to the task to help you categorize and organize them.

Default: No tags

Each tag consists of a key and an optional value, both of which you define.

taskCountoptionalnumbertask_countoptionalint | floattaskCountoptionalNumberTaskCountoptionaldoubleTaskCountoptional*float64= 1#
The number of tasks to create based on TaskDefinition.
taskDefinitionTaskDefinitiontask_definitionTaskDefinitiontaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionrequired#
The task definition to use for scheduled tasks.

Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using a Universal target.

vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#
The subnets associated with the task.

Default: all private subnets of the VPC are selected.

These subnets must all be in the same VPC. The task will be launched in these subnets.