UNPKG

11.3 kBTypeScriptView Raw
1import { Construct } from 'constructs';
2import { CfnHook } from './cfn-hook';
3import { FromCloudFormationOptions } from './helpers-internal';
4/**
5 * The possible types of traffic shifting for the blue-green deployment configuration.
6 * The type of the {@link CfnTrafficRoutingConfig.type} property.
7 */
8export declare enum CfnTrafficRoutingType {
9 /**
10 * Switch from blue to green at once.
11 */
12 ALL_AT_ONCE = "AllAtOnce",
13 /**
14 * Specifies a configuration that shifts traffic from blue to green in two increments.
15 */
16 TIME_BASED_CANARY = "TimeBasedCanary",
17 /**
18 * Specifies a configuration that shifts traffic from blue to green in equal increments,
19 * with an equal number of minutes between each increment.
20 */
21 TIME_BASED_LINEAR = "TimeBasedLinear"
22}
23/**
24 * The traffic routing configuration if {@link CfnTrafficRoutingConfig.type}
25 * is {@link CfnTrafficRoutingType.TIME_BASED_CANARY}.
26 */
27export interface CfnTrafficRoutingTimeBasedCanary {
28 /**
29 * The percentage of traffic to shift in the first increment of a time-based canary deployment.
30 * The step percentage must be 14% or greater.
31 *
32 * @default 15
33 */
34 readonly stepPercentage?: number;
35 /**
36 * The number of minutes between the first and second traffic shifts of a time-based canary deployment.
37 *
38 * @default 5
39 */
40 readonly bakeTimeMins?: number;
41}
42/**
43 * The traffic routing configuration if {@link CfnTrafficRoutingConfig.type}
44 * is {@link CfnTrafficRoutingType.TIME_BASED_LINEAR}.
45 */
46export interface CfnTrafficRoutingTimeBasedLinear {
47 /**
48 * The percentage of traffic that is shifted at the start of each increment of a time-based linear deployment.
49 * The step percentage must be 14% or greater.
50 *
51 * @default 15
52 */
53 readonly stepPercentage?: number;
54 /**
55 * The number of minutes between the first and second traffic shifts of a time-based linear deployment.
56 *
57 * @default 5
58 */
59 readonly bakeTimeMins?: number;
60}
61/**
62 * Traffic routing configuration settings.
63 * The type of the {@link CfnCodeDeployBlueGreenHookProps.trafficRoutingConfig} property.
64 */
65export interface CfnTrafficRoutingConfig {
66 /**
67 * The type of traffic shifting used by the blue-green deployment configuration.
68 */
69 readonly type: CfnTrafficRoutingType;
70 /**
71 * The configuration for traffic routing when {@link type} is
72 * {@link CfnTrafficRoutingType.TIME_BASED_CANARY}.
73 *
74 * @default - none
75 */
76 readonly timeBasedCanary?: CfnTrafficRoutingTimeBasedCanary;
77 /**
78 * The configuration for traffic routing when {@link type} is
79 * {@link CfnTrafficRoutingType.TIME_BASED_LINEAR}.
80 *
81 * @default - none
82 */
83 readonly timeBasedLinear?: CfnTrafficRoutingTimeBasedLinear;
84}
85/**
86 * Additional options for the blue/green deployment.
87 * The type of the {@link CfnCodeDeployBlueGreenHookProps.additionalOptions} property.
88 */
89export interface CfnCodeDeployBlueGreenAdditionalOptions {
90 /**
91 * Specifies time to wait, in minutes, before terminating the blue resources.
92 *
93 * @default - 5 minutes
94 */
95 readonly terminationWaitTimeInMinutes?: number;
96}
97/**
98 * Lifecycle events for blue-green deployments.
99 * The type of the {@link CfnCodeDeployBlueGreenHookProps.lifecycleEventHooks} property.
100 */
101export interface CfnCodeDeployBlueGreenLifecycleEventHooks {
102 /**
103 * Function to use to run tasks before the replacement task set is created.
104 *
105 * @default - none
106 */
107 readonly beforeInstall?: string;
108 /**
109 * Function to use to run tasks after the replacement task set is created and one of the target groups is associated with it.
110 *
111 * @default - none
112 */
113 readonly afterInstall?: string;
114 /**
115 * Function to use to run tasks after the test listener serves traffic to the replacement task set.
116 *
117 * @default - none
118 */
119 readonly afterAllowTestTraffic?: string;
120 /**
121 * Function to use to run tasks after the second target group is associated with the replacement task set,
122 * but before traffic is shifted to the replacement task set.
123 *
124 * @default - none
125 */
126 readonly beforeAllowTraffic?: string;
127 /**
128 * Function to use to run tasks after the second target group serves traffic to the replacement task set.
129 *
130 * @default - none
131 */
132 readonly afterAllowTraffic?: string;
133}
134/**
135 * Type of the {@link CfnCodeDeployBlueGreenApplication.target} property.
136 */
137export interface CfnCodeDeployBlueGreenApplicationTarget {
138 /**
139 * The resource type of the target being deployed.
140 * Right now, the only allowed value is 'AWS::ECS::Service'.
141 */
142 readonly type: string;
143 /**
144 * The logical id of the target resource.
145 */
146 readonly logicalId: string;
147}
148/**
149 * A traffic route,
150 * representing where the traffic is being directed to.
151 */
152export interface CfnTrafficRoute {
153 /**
154 * The resource type of the route.
155 * Today, the only allowed value is 'AWS::ElasticLoadBalancingV2::Listener'.
156 */
157 readonly type: string;
158 /**
159 * The logical id of the target resource.
160 */
161 readonly logicalId: string;
162}
163/**
164 * Type of the {@link CfnCodeDeployBlueGreenEcsAttributes.trafficRouting} property.
165 */
166export interface CfnTrafficRouting {
167 /**
168 * The listener to be used by your load balancer to direct traffic to your target groups.
169 */
170 readonly prodTrafficRoute: CfnTrafficRoute;
171 /**
172 * The listener to be used by your load balancer to direct traffic to your target groups.
173 */
174 readonly testTrafficRoute: CfnTrafficRoute;
175 /**
176 * The logical IDs of the blue and green, respectively,
177 * AWS::ElasticLoadBalancingV2::TargetGroup target groups.
178 */
179 readonly targetGroups: string[];
180}
181/**
182 * The attributes of the ECS Service being deployed.
183 * Type of the {@link CfnCodeDeployBlueGreenApplication.ecsAttributes} property.
184 */
185export interface CfnCodeDeployBlueGreenEcsAttributes {
186 /**
187 * The logical IDs of the blue and green, respectively,
188 * AWS::ECS::TaskDefinition task definitions.
189 */
190 readonly taskDefinitions: string[];
191 /**
192 * The logical IDs of the blue and green, respectively,
193 * AWS::ECS::TaskSet task sets.
194 */
195 readonly taskSets: string[];
196 /**
197 * The traffic routing configuration.
198 */
199 readonly trafficRouting: CfnTrafficRouting;
200}
201/**
202 * The application actually being deployed.
203 * Type of the {@link CfnCodeDeployBlueGreenHookProps.applications} property.
204 */
205export interface CfnCodeDeployBlueGreenApplication {
206 /**
207 * The target that is being deployed.
208 */
209 readonly target: CfnCodeDeployBlueGreenApplicationTarget;
210 /**
211 * The detailed attributes of the deployed target.
212 */
213 readonly ecsAttributes: CfnCodeDeployBlueGreenEcsAttributes;
214}
215/**
216 * Construction properties of {@link CfnCodeDeployBlueGreenHook}.
217 */
218export interface CfnCodeDeployBlueGreenHookProps {
219 /**
220 * The IAM Role for CloudFormation to use to perform blue-green deployments.
221 */
222 readonly serviceRole: string;
223 /**
224 * Properties of the Amazon ECS applications being deployed.
225 */
226 readonly applications: CfnCodeDeployBlueGreenApplication[];
227 /**
228 * Traffic routing configuration settings.
229 *
230 * @default - time-based canary traffic shifting, with a 15% step percentage and a five minute bake time
231 */
232 readonly trafficRoutingConfig?: CfnTrafficRoutingConfig;
233 /**
234 * Additional options for the blue/green deployment.
235 *
236 * @default - no additional options
237 */
238 readonly additionalOptions?: CfnCodeDeployBlueGreenAdditionalOptions;
239 /**
240 * Use lifecycle event hooks to specify a Lambda function that CodeDeploy can call to validate a deployment.
241 * You can use the same function or a different one for deployment lifecycle events.
242 * Following completion of the validation tests,
243 * the Lambda {@link CfnCodeDeployBlueGreenLifecycleEventHooks.afterAllowTraffic}
244 * function calls back CodeDeploy and delivers a result of 'Succeeded' or 'Failed'.
245 *
246 * @default - no lifecycle event hooks
247 */
248 readonly lifecycleEventHooks?: CfnCodeDeployBlueGreenLifecycleEventHooks;
249}
250/**
251 * A CloudFormation Hook for CodeDeploy blue-green ECS deployments.
252 *
253 * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/blue-green.html#blue-green-template-reference
254 */
255export declare class CfnCodeDeployBlueGreenHook extends CfnHook {
256 /**
257 * A factory method that creates a new instance of this class from an object
258 * containing the CloudFormation properties of this resource.
259 * Used in the @aws-cdk/cloudformation-include module.
260 *
261 * @internal
262 */
263 static _fromCloudFormation(scope: Construct, id: string, hookAttributes: any, options: FromCloudFormationOptions): CfnCodeDeployBlueGreenHook;
264 private _serviceRole;
265 private _applications;
266 private _trafficRoutingConfig?;
267 private _additionalOptions?;
268 private _lifecycleEventHooks?;
269 /**
270 * Creates a new CodeDeploy blue-green ECS Hook.
271 *
272 * @param scope the scope to create the hook in (usually the containing Stack object)
273 * @param id the identifier of the construct - will be used to generate the logical ID of the Hook
274 * @param props the properties of the Hook
275 */
276 constructor(scope: Construct, id: string, props: CfnCodeDeployBlueGreenHookProps);
277 /**
278 * The IAM Role for CloudFormation to use to perform blue-green deployments.
279 */
280 get serviceRole(): string;
281 set serviceRole(serviceRole: string);
282 /**
283 * Properties of the Amazon ECS applications being deployed.
284 */
285 get applications(): CfnCodeDeployBlueGreenApplication[];
286 set applications(value: CfnCodeDeployBlueGreenApplication[]);
287 /**
288 * Traffic routing configuration settings.
289 *
290 * @default - time-based canary traffic shifting, with a 15% step percentage and a five minute bake time
291 */
292 get trafficRoutingConfig(): CfnTrafficRoutingConfig | undefined;
293 set trafficRoutingConfig(value: CfnTrafficRoutingConfig | undefined);
294 /**
295 * Additional options for the blue/green deployment.
296 *
297 * @default - no additional options
298 */
299 get additionalOptions(): CfnCodeDeployBlueGreenAdditionalOptions | undefined;
300 set additionalOptions(value: CfnCodeDeployBlueGreenAdditionalOptions | undefined);
301 /**
302 * Use lifecycle event hooks to specify a Lambda function that CodeDeploy can call to validate a deployment.
303 * You can use the same function or a different one for deployment lifecycle events.
304 * Following completion of the validation tests,
305 * the Lambda {@link CfnCodeDeployBlueGreenLifecycleEventHooks.afterAllowTraffic}
306 * function calls back CodeDeploy and delivers a result of 'Succeeded' or 'Failed'.
307 *
308 * @default - no lifecycle event hooks
309 */
310 get lifecycleEventHooks(): CfnCodeDeployBlueGreenLifecycleEventHooks | undefined;
311 set lifecycleEventHooks(value: CfnCodeDeployBlueGreenLifecycleEventHooks | undefined);
312 protected renderProperties(_props?: {
313 [p: string]: any;
314 }): {
315 [p: string]: any;
316 } | undefined;
317}