UNPKG

7.62 kBTypeScriptView Raw
1import * as ec2 from '@aws-cdk/aws-ec2';
2import { Construct as CoreConstruct } from '@aws-cdk/core';
3/**
4 * The ECS-optimized AMI variant to use. For more information, see
5 * [Amazon ECS-optimized AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html).
6 */
7export declare enum AmiHardwareType {
8 /**
9 * Use the standard Amazon ECS-optimized AMI.
10 */
11 STANDARD = "Standard",
12 /**
13 * Use the Amazon ECS GPU-optimized AMI.
14 */
15 GPU = "GPU",
16 /**
17 * Use the Amazon ECS-optimized Amazon Linux 2 (arm64) AMI.
18 */
19 ARM = "ARM64"
20}
21/**
22 * ECS-optimized Windows version list
23 */
24export declare enum WindowsOptimizedVersion {
25 SERVER_2019 = "2019",
26 SERVER_2016 = "2016"
27}
28/**
29 * The properties that define which ECS-optimized AMI is used.
30 *
31 * @deprecated see {@link EcsOptimizedImage}
32 */
33export interface EcsOptimizedAmiProps {
34 /**
35 * The Amazon Linux generation to use.
36 *
37 * @default AmazonLinuxGeneration.AmazonLinux2
38 */
39 readonly generation?: ec2.AmazonLinuxGeneration;
40 /**
41 * The Windows Server version to use.
42 *
43 * @default none, uses Linux generation
44 */
45 readonly windowsVersion?: WindowsOptimizedVersion;
46 /**
47 * The ECS-optimized AMI variant to use.
48 *
49 * @default AmiHardwareType.Standard
50 */
51 readonly hardwareType?: AmiHardwareType;
52 /**
53 * Whether the AMI ID is cached to be stable between deployments
54 *
55 * By default, the newest image is used on each deployment. This will cause
56 * instances to be replaced whenever a new version is released, and may cause
57 * downtime if there aren't enough running instances in the AutoScalingGroup
58 * to reschedule the tasks on.
59 *
60 * If set to true, the AMI ID will be cached in `cdk.context.json` and the
61 * same value will be used on future runs. Your instances will not be replaced
62 * but your AMI version will grow old over time. To refresh the AMI lookup,
63 * you will have to evict the value from the cache using the `cdk context`
64 * command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
65 * more information.
66 *
67 * Can not be set to `true` in environment-agnostic stacks.
68 *
69 * @default false
70 */
71 readonly cachedInContext?: boolean;
72}
73/**
74 * Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
75 *
76 * @deprecated see {@link EcsOptimizedImage#amazonLinux}, {@link EcsOptimizedImage#amazonLinux} and {@link EcsOptimizedImage#windows}
77 */
78export declare class EcsOptimizedAmi implements ec2.IMachineImage {
79 private readonly generation?;
80 private readonly windowsVersion?;
81 private readonly hwType;
82 private readonly amiParameterName;
83 private readonly cachedInContext;
84 /**
85 * Constructs a new instance of the EcsOptimizedAmi class.
86 */
87 constructor(props?: EcsOptimizedAmiProps);
88 /**
89 * Return the correct image
90 */
91 getImage(scope: CoreConstruct): ec2.MachineImageConfig;
92}
93/**
94 * Additional configuration properties for EcsOptimizedImage factory functions
95 */
96export interface EcsOptimizedImageOptions {
97 /**
98 * Whether the AMI ID is cached to be stable between deployments
99 *
100 * By default, the newest image is used on each deployment. This will cause
101 * instances to be replaced whenever a new version is released, and may cause
102 * downtime if there aren't enough running instances in the AutoScalingGroup
103 * to reschedule the tasks on.
104 *
105 * If set to true, the AMI ID will be cached in `cdk.context.json` and the
106 * same value will be used on future runs. Your instances will not be replaced
107 * but your AMI version will grow old over time. To refresh the AMI lookup,
108 * you will have to evict the value from the cache using the `cdk context`
109 * command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
110 * more information.
111 *
112 * Can not be set to `true` in environment-agnostic stacks.
113 *
114 * @default false
115 */
116 readonly cachedInContext?: boolean;
117}
118/**
119 * Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
120 */
121export declare class EcsOptimizedImage implements ec2.IMachineImage {
122 /**
123 * Construct an Amazon Linux 2 image from the latest ECS Optimized AMI published in SSM
124 *
125 * @param hardwareType ECS-optimized AMI variant to use
126 */
127 static amazonLinux2(hardwareType?: AmiHardwareType, options?: EcsOptimizedImageOptions): EcsOptimizedImage;
128 /**
129 * Construct an Amazon Linux AMI image from the latest ECS Optimized AMI published in SSM
130 */
131 static amazonLinux(options?: EcsOptimizedImageOptions): EcsOptimizedImage;
132 /**
133 * Construct a Windows image from the latest ECS Optimized AMI published in SSM
134 *
135 * @param windowsVersion Windows Version to use
136 */
137 static windows(windowsVersion: WindowsOptimizedVersion, options?: EcsOptimizedImageOptions): EcsOptimizedImage;
138 private readonly generation?;
139 private readonly windowsVersion?;
140 private readonly hwType?;
141 private readonly amiParameterName;
142 private readonly cachedInContext;
143 /**
144 * Constructs a new instance of the EcsOptimizedAmi class.
145 */
146 private constructor();
147 /**
148 * Return the correct image
149 */
150 getImage(scope: CoreConstruct): ec2.MachineImageConfig;
151}
152/**
153 * Amazon ECS variant
154 */
155export declare enum BottlerocketEcsVariant {
156 /**
157 * aws-ecs-1 variant
158 */
159 AWS_ECS_1 = "aws-ecs-1"
160}
161/**
162 * Properties for BottleRocketImage
163 */
164export interface BottleRocketImageProps {
165 /**
166 * The Amazon ECS variant to use.
167 * Only `aws-ecs-1` is currently available
168 *
169 * @default - BottlerocketEcsVariant.AWS_ECS_1
170 */
171 readonly variant?: BottlerocketEcsVariant;
172 /**
173 * The CPU architecture
174 *
175 * @default - x86_64
176 */
177 readonly architecture?: ec2.InstanceArchitecture;
178 /**
179 * Whether the AMI ID is cached to be stable between deployments
180 *
181 * By default, the newest image is used on each deployment. This will cause
182 * instances to be replaced whenever a new version is released, and may cause
183 * downtime if there aren't enough running instances in the AutoScalingGroup
184 * to reschedule the tasks on.
185 *
186 * If set to true, the AMI ID will be cached in `cdk.context.json` and the
187 * same value will be used on future runs. Your instances will not be replaced
188 * but your AMI version will grow old over time. To refresh the AMI lookup,
189 * you will have to evict the value from the cache using the `cdk context`
190 * command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
191 * more information.
192 *
193 * Can not be set to `true` in environment-agnostic stacks.
194 *
195 * @default false
196 */
197 readonly cachedInContext?: boolean;
198}
199/**
200 * Construct an Bottlerocket image from the latest AMI published in SSM
201 */
202export declare class BottleRocketImage implements ec2.IMachineImage {
203 private readonly amiParameterName;
204 /**
205 * Amazon ECS variant for Bottlerocket AMI
206 */
207 private readonly variant;
208 /**
209 * Instance architecture
210 */
211 private readonly architecture;
212 private readonly cachedInContext;
213 /**
214 * Constructs a new instance of the BottleRocketImage class.
215 */
216 constructor(props?: BottleRocketImageProps);
217 /**
218 * Return the correct image
219 */
220 getImage(scope: CoreConstruct): ec2.MachineImageConfig;
221}