UNPKG

4.5 kBTypeScriptView Raw
1import * as ec2 from '@aws-cdk/aws-ec2';
2import { Construct } from 'constructs';
3import { BaseService, BaseServiceOptions, IBaseService, IService } from '../base/base-service';
4import { TaskDefinition } from '../base/task-definition';
5import { ICluster } from '../cluster';
6/**
7 * The properties for defining a service using the Fargate launch type.
8 */
9export interface FargateServiceProps extends BaseServiceOptions {
10 /**
11 * The task definition to use for tasks in the service.
12 *
13 * [disable-awslint:ref-via-interface]
14 */
15 readonly taskDefinition: TaskDefinition;
16 /**
17 * Specifies whether the task's elastic network interface receives a public IP address.
18 *
19 * If true, each task will receive a public IP address.
20 *
21 * @default false
22 */
23 readonly assignPublicIp?: boolean;
24 /**
25 * The subnets to associate with the service.
26 *
27 * @default - Public subnets if `assignPublicIp` is set, otherwise the first available one of Private, Isolated, Public, in that order.
28 */
29 readonly vpcSubnets?: ec2.SubnetSelection;
30 /**
31 * The security groups to associate with the service. If you do not specify a security group, a new security group is created.
32 *
33 * @default - A new security group is created.
34 * @deprecated use securityGroups instead.
35 */
36 readonly securityGroup?: ec2.ISecurityGroup;
37 /**
38 * The security groups to associate with the service. If you do not specify a security group, a new security group is created.
39 *
40 * @default - A new security group is created.
41 */
42 readonly securityGroups?: ec2.ISecurityGroup[];
43 /**
44 * The platform version on which to run your service.
45 *
46 * If one is not specified, the LATEST platform version is used by default. For more information, see
47 * [AWS Fargate Platform Versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html)
48 * in the Amazon Elastic Container Service Developer Guide.
49 *
50 * @default Latest
51 */
52 readonly platformVersion?: FargatePlatformVersion;
53}
54/**
55 * The interface for a service using the Fargate launch type on an ECS cluster.
56 */
57export interface IFargateService extends IService {
58}
59/**
60 * The properties to import from the service using the Fargate launch type.
61 */
62export interface FargateServiceAttributes {
63 /**
64 * The cluster that hosts the service.
65 */
66 readonly cluster: ICluster;
67 /**
68 * The service ARN.
69 *
70 * @default - either this, or {@link serviceName}, is required
71 */
72 readonly serviceArn?: string;
73 /**
74 * The name of the service.
75 *
76 * @default - either this, or {@link serviceArn}, is required
77 */
78 readonly serviceName?: string;
79}
80/**
81 * This creates a service using the Fargate launch type on an ECS cluster.
82 *
83 * @resource AWS::ECS::Service
84 */
85export declare class FargateService extends BaseService implements IFargateService {
86 /**
87 * Imports from the specified service ARN.
88 */
89 static fromFargateServiceArn(scope: Construct, id: string, fargateServiceArn: string): IFargateService;
90 /**
91 * Imports from the specified service attrributes.
92 */
93 static fromFargateServiceAttributes(scope: Construct, id: string, attrs: FargateServiceAttributes): IBaseService;
94 /**
95 * Constructs a new instance of the FargateService class.
96 */
97 constructor(scope: Construct, id: string, props: FargateServiceProps);
98}
99/**
100 * The platform version on which to run your service.
101 *
102 * @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html
103 */
104export declare enum FargatePlatformVersion {
105 /**
106 * The latest, recommended platform version.
107 */
108 LATEST = "LATEST",
109 /**
110 * Version 1.4.0
111 *
112 * Supports EFS endpoints, CAP_SYS_PTRACE Linux capability,
113 * network performance metrics in CloudWatch Container Insights,
114 * consolidated 20 GB ephemeral volume.
115 */
116 VERSION1_4 = "1.4.0",
117 /**
118 * Version 1.3.0
119 *
120 * Supports secrets, task recycling.
121 */
122 VERSION1_3 = "1.3.0",
123 /**
124 * Version 1.2.0
125 *
126 * Supports private registries.
127 */
128 VERSION1_2 = "1.2.0",
129 /**
130 * Version 1.1.0
131 *
132 * Supports task metadata, health checks, service discovery.
133 */
134 VERSION1_1 = "1.1.0",
135 /**
136 * Initial release
137 *
138 * Based on Amazon Linux 2017.09.
139 */
140 VERSION1_0 = "1.0.0"
141}