UNPKG

3.3 kBTypeScriptView Raw
1import * as ec2 from '@aws-cdk/aws-ec2';
2import * as ecs from '@aws-cdk/aws-ecs';
3import * as events from '@aws-cdk/aws-events';
4import * as iam from '@aws-cdk/aws-iam';
5import { ContainerOverride } from './ecs-task-properties';
6/**
7 * Properties to define an ECS Event Task
8 */
9export interface EcsTaskProps {
10 /**
11 * Cluster where service will be deployed
12 */
13 readonly cluster: ecs.ICluster;
14 /**
15 * Task Definition of the task that should be started
16 */
17 readonly taskDefinition: ecs.ITaskDefinition;
18 /**
19 * How many tasks should be started when this event is triggered
20 *
21 * @default 1
22 */
23 readonly taskCount?: number;
24 /**
25 * Container setting overrides
26 *
27 * Key is the name of the container to override, value is the
28 * values you want to override.
29 */
30 readonly containerOverrides?: ContainerOverride[];
31 /**
32 * In what subnets to place the task's ENIs
33 *
34 * (Only applicable in case the TaskDefinition is configured for AwsVpc networking)
35 *
36 * @default Private subnets
37 */
38 readonly subnetSelection?: ec2.SubnetSelection;
39 /**
40 * Existing security group to use for the task's ENIs
41 *
42 * (Only applicable in case the TaskDefinition is configured for AwsVpc networking)
43 *
44 * @default A new security group is created
45 * @deprecated use securityGroups instead
46 */
47 readonly securityGroup?: ec2.ISecurityGroup;
48 /**
49 * Existing security groups to use for the task's ENIs
50 *
51 * (Only applicable in case the TaskDefinition is configured for AwsVpc networking)
52 *
53 * @default A new security group is created
54 */
55 readonly securityGroups?: ec2.ISecurityGroup[];
56 /**
57 * Existing IAM role to run the ECS task
58 *
59 * @default A new IAM role is created
60 */
61 readonly role?: iam.IRole;
62 /**
63 * The platform version on which to run your task
64 *
65 * Unless you have specific compatibility requirements, you don't need to specify this.
66 *
67 * @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html
68 *
69 * @default - ECS will set the Fargate platform version to 'LATEST'
70 */
71 readonly platformVersion?: ecs.FargatePlatformVersion;
72}
73/**
74 * Start a task on an ECS cluster
75 */
76export declare class EcsTask implements events.IRuleTarget {
77 private readonly props;
78 /**
79 * The security group associated with the task. Only applicable with awsvpc network mode.
80 *
81 * @default - A new security group is created.
82 * @deprecated use securityGroups instead.
83 */
84 readonly securityGroup?: ec2.ISecurityGroup;
85 /**
86 * The security groups associated with the task. Only applicable with awsvpc network mode.
87 *
88 * @default - A new security group is created.
89 */
90 readonly securityGroups?: ec2.ISecurityGroup[];
91 private readonly cluster;
92 private readonly taskDefinition;
93 private readonly taskCount;
94 private readonly role;
95 private readonly platformVersion?;
96 constructor(props: EcsTaskProps);
97 /**
98 * Allows using tasks as target of EventBridge events
99 */
100 bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig;
101 private createEventRolePolicyStatements;
102}