1 | import * as ec2 from '@aws-cdk/aws-ec2';
|
2 | import { Construct } from 'constructs';
|
3 | import { BaseService, BaseServiceOptions, IBaseService, IService } from '../base/base-service';
|
4 | import { TaskDefinition } from '../base/task-definition';
|
5 | import { ICluster } from '../cluster';
|
6 | import { PlacementConstraint, PlacementStrategy } from '../placement';
|
7 | /**
|
8 | * The properties for defining a service using the EC2 launch type.
|
9 | */
|
10 | export interface Ec2ServiceProps extends BaseServiceOptions {
|
11 | /**
|
12 | * The task definition to use for tasks in the service.
|
13 | *
|
14 | * [disable-awslint:ref-via-interface]
|
15 | */
|
16 | readonly taskDefinition: TaskDefinition;
|
17 | /**
|
18 | * Specifies whether the task's elastic network interface receives a public IP address.
|
19 | * If true, each task will receive a public IP address.
|
20 | *
|
21 | * This property is only used for tasks that use the awsvpc network mode.
|
22 | *
|
23 | * @default false
|
24 | */
|
25 | readonly assignPublicIp?: boolean;
|
26 | /**
|
27 | * The subnets to associate with the service.
|
28 | *
|
29 | * This property is only used for tasks that use the awsvpc network mode.
|
30 | *
|
31 | * @default - Public subnets if `assignPublicIp` is set, otherwise the first available one of Private, Isolated, Public, in that order.
|
32 | */
|
33 | readonly vpcSubnets?: ec2.SubnetSelection;
|
34 | /**
|
35 | * The security groups to associate with the service. If you do not specify a security group, a new security group is created.
|
36 | *
|
37 | * This property is only used for tasks that use the awsvpc network mode.
|
38 | *
|
39 | * @default - A new security group is created.
|
40 | * @deprecated use securityGroups instead.
|
41 | */
|
42 | readonly securityGroup?: ec2.ISecurityGroup;
|
43 | /**
|
44 | * The security groups to associate with the service. If you do not specify a security group, a new security group is created.
|
45 | *
|
46 | * This property is only used for tasks that use the awsvpc network mode.
|
47 | *
|
48 | * @default - A new security group is created.
|
49 | */
|
50 | readonly securityGroups?: ec2.ISecurityGroup[];
|
51 | /**
|
52 | * The placement constraints to use for tasks in the service. For more information, see
|
53 | * [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
|
54 | *
|
55 | * @default - No constraints.
|
56 | */
|
57 | readonly placementConstraints?: PlacementConstraint[];
|
58 | /**
|
59 | * The placement strategies to use for tasks in the service. For more information, see
|
60 | * [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
|
61 | *
|
62 | * @default - No strategies.
|
63 | */
|
64 | readonly placementStrategies?: PlacementStrategy[];
|
65 | /**
|
66 | * Specifies whether the service will use the daemon scheduling strategy.
|
67 | * If true, the service scheduler deploys exactly one task on each container instance in your cluster.
|
68 | *
|
69 | * When you are using this strategy, do not specify a desired number of tasks orany task placement strategies.
|
70 | *
|
71 | * @default false
|
72 | */
|
73 | readonly daemon?: boolean;
|
74 | }
|
75 | /**
|
76 | * The interface for a service using the EC2 launch type on an ECS cluster.
|
77 | */
|
78 | export interface IEc2Service extends IService {
|
79 | }
|
80 | /**
|
81 | * The properties to import from the service using the EC2 launch type.
|
82 | */
|
83 | export interface Ec2ServiceAttributes {
|
84 | /**
|
85 | * The cluster that hosts the service.
|
86 | */
|
87 | readonly cluster: ICluster;
|
88 | /**
|
89 | * The service ARN.
|
90 | *
|
91 | * @default - either this, or {@link serviceName}, is required
|
92 | */
|
93 | readonly serviceArn?: string;
|
94 | /**
|
95 | * The name of the service.
|
96 | *
|
97 | * @default - either this, or {@link serviceArn}, is required
|
98 | */
|
99 | readonly serviceName?: string;
|
100 | }
|
101 | /**
|
102 | * This creates a service using the EC2 launch type on an ECS cluster.
|
103 | *
|
104 | * @resource AWS::ECS::Service
|
105 | */
|
106 | export declare class Ec2Service extends BaseService implements IEc2Service {
|
107 | /**
|
108 | * Imports from the specified service ARN.
|
109 | */
|
110 | static fromEc2ServiceArn(scope: Construct, id: string, ec2ServiceArn: string): IEc2Service;
|
111 | /**
|
112 | * Imports from the specified service attributes.
|
113 | */
|
114 | static fromEc2ServiceAttributes(scope: Construct, id: string, attrs: Ec2ServiceAttributes): IBaseService;
|
115 | private readonly constraints;
|
116 | private readonly strategies;
|
117 | private readonly daemon;
|
118 | /**
|
119 | * Constructs a new instance of the Ec2Service class.
|
120 | */
|
121 | constructor(scope: Construct, id: string, props: Ec2ServiceProps);
|
122 | /**
|
123 | * Adds one or more placement strategies to use for tasks in the service. For more information, see
|
124 | * [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
|
125 | */
|
126 | addPlacementStrategies(...strategies: PlacementStrategy[]): void;
|
127 | /**
|
128 | * Adds one or more placement constraints to use for tasks in the service. For more information, see
|
129 | * [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
|
130 | */
|
131 | addPlacementConstraints(...constraints: PlacementConstraint[]): void;
|
132 | /**
|
133 | * Validates this Ec2Service.
|
134 | */
|
135 | protected validate(): string[];
|
136 | }
|
137 | /**
|
138 | * The built-in container instance attributes
|
139 | */
|
140 | export declare class BuiltInAttributes {
|
141 | /**
|
142 | * The id of the instance.
|
143 | */
|
144 | static readonly INSTANCE_ID = "instanceId";
|
145 | /**
|
146 | * The AvailabilityZone where the instance is running in.
|
147 | */
|
148 | static readonly AVAILABILITY_ZONE = "attribute:ecs.availability-zone";
|
149 | /**
|
150 | * The AMI id the instance is using.
|
151 | */
|
152 | static readonly AMI_ID = "attribute:ecs.ami-id";
|
153 | /**
|
154 | * The EC2 instance type.
|
155 | */
|
156 | static readonly INSTANCE_TYPE = "attribute:ecs.instance-type";
|
157 | /**
|
158 | * The operating system of the instance.
|
159 | *
|
160 | * Either 'linux' or 'windows'.
|
161 | */
|
162 | static readonly OS_TYPE = "attribute:ecs.os-type";
|
163 | }
|
164 |
|
\ | No newline at end of file |