1 | ;
|
2 | var _a, _b, _c;
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | exports.BottleRocketImage = exports.BottlerocketEcsVariant = exports.EcsOptimizedImage = exports.EcsOptimizedAmi = exports.WindowsOptimizedVersion = exports.AmiHardwareType = void 0;
|
5 | const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
|
6 | const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
7 | const ec2 = require("@aws-cdk/aws-ec2");
|
8 | const ssm = require("@aws-cdk/aws-ssm");
|
9 | /**
|
10 | * The ECS-optimized AMI variant to use. For more information, see
|
11 | * [Amazon ECS-optimized AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html).
|
12 | */
|
13 | var AmiHardwareType;
|
14 | (function (AmiHardwareType) {
|
15 | /**
|
16 | * Use the standard Amazon ECS-optimized AMI.
|
17 | */
|
18 | AmiHardwareType["STANDARD"] = "Standard";
|
19 | /**
|
20 | * Use the Amazon ECS GPU-optimized AMI.
|
21 | */
|
22 | AmiHardwareType["GPU"] = "GPU";
|
23 | /**
|
24 | * Use the Amazon ECS-optimized Amazon Linux 2 (arm64) AMI.
|
25 | */
|
26 | AmiHardwareType["ARM"] = "ARM64";
|
27 | })(AmiHardwareType = exports.AmiHardwareType || (exports.AmiHardwareType = {}));
|
28 | /**
|
29 | * ECS-optimized Windows version list
|
30 | */
|
31 | var WindowsOptimizedVersion;
|
32 | (function (WindowsOptimizedVersion) {
|
33 | WindowsOptimizedVersion["SERVER_2019"] = "2019";
|
34 | WindowsOptimizedVersion["SERVER_2016"] = "2016";
|
35 | })(WindowsOptimizedVersion = exports.WindowsOptimizedVersion || (exports.WindowsOptimizedVersion = {}));
|
36 | /*
|
37 | * TODO:v2.0.0 remove EcsOptimizedAmi
|
38 | */
|
39 | /**
|
40 | * Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
|
41 | *
|
42 | * @deprecated see {@link EcsOptimizedImage#amazonLinux}, {@link EcsOptimizedImage#amazonLinux} and {@link EcsOptimizedImage#windows}
|
43 | */
|
44 | class EcsOptimizedAmi {
|
45 | /**
|
46 | * Constructs a new instance of the EcsOptimizedAmi class.
|
47 | */
|
48 | constructor(props) {
|
49 | try {
|
50 | jsiiDeprecationWarnings.print("@aws-cdk/aws-ecs.EcsOptimizedAmi", "see {@link EcsOptimizedImage#amazonLinux}, {@link EcsOptimizedImage#amazonLinux} and {@link EcsOptimizedImage#windows}");
|
51 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_EcsOptimizedAmiProps(props);
|
52 | }
|
53 | catch (error) {
|
54 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
55 | Error.captureStackTrace(error, EcsOptimizedAmi);
|
56 | }
|
57 | throw error;
|
58 | }
|
59 | this.hwType = (props && props.hardwareType) || AmiHardwareType.STANDARD;
|
60 | if (props && props.generation) { // generation defined in the props object
|
61 | if (props.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX && this.hwType !== AmiHardwareType.STANDARD) {
|
62 | throw new Error('Amazon Linux does not support special hardware type. Use Amazon Linux 2 instead');
|
63 | }
|
64 | else if (props.windowsVersion) {
|
65 | throw new Error('"windowsVersion" and Linux image "generation" cannot be both set');
|
66 | }
|
67 | else {
|
68 | this.generation = props.generation;
|
69 | }
|
70 | }
|
71 | else if (props && props.windowsVersion) {
|
72 | if (this.hwType !== AmiHardwareType.STANDARD) {
|
73 | throw new Error('Windows Server does not support special hardware type');
|
74 | }
|
75 | else {
|
76 | this.windowsVersion = props.windowsVersion;
|
77 | }
|
78 | }
|
79 | else { // generation not defined in props object
|
80 | // always default to Amazon Linux v2 regardless of HW
|
81 | this.generation = ec2.AmazonLinuxGeneration.AMAZON_LINUX_2;
|
82 | }
|
83 | // set the SSM parameter name
|
84 | this.amiParameterName = '/aws/service/ecs/optimized-ami/'
|
85 | + (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX ? 'amazon-linux/' : '')
|
86 | + (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 ? 'amazon-linux-2/' : '')
|
87 | + (this.windowsVersion ? `windows_server/${this.windowsVersion}/english/full/` : '')
|
88 | + (this.hwType === AmiHardwareType.GPU ? 'gpu/' : '')
|
89 | + (this.hwType === AmiHardwareType.ARM ? 'arm64/' : '')
|
90 | + 'recommended/image_id';
|
91 | this.cachedInContext = props?.cachedInContext ?? false;
|
92 | }
|
93 | /**
|
94 | * Return the correct image
|
95 | */
|
96 | getImage(scope) {
|
97 | try {
|
98 | jsiiDeprecationWarnings.print("@aws-cdk/aws-ecs.EcsOptimizedAmi#getImage", "see {@link EcsOptimizedImage#amazonLinux}, {@link EcsOptimizedImage#amazonLinux} and {@link EcsOptimizedImage#windows}");
|
99 | }
|
100 | catch (error) {
|
101 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
102 | Error.captureStackTrace(error, this.getImage);
|
103 | }
|
104 | throw error;
|
105 | }
|
106 | const ami = lookupImage(scope, this.cachedInContext, this.amiParameterName);
|
107 | const osType = this.windowsVersion ? ec2.OperatingSystemType.WINDOWS : ec2.OperatingSystemType.LINUX;
|
108 | return {
|
109 | imageId: ami,
|
110 | osType,
|
111 | userData: ec2.UserData.forOperatingSystem(osType),
|
112 | };
|
113 | }
|
114 | }
|
115 | exports.EcsOptimizedAmi = EcsOptimizedAmi;
|
116 | _a = JSII_RTTI_SYMBOL_1;
|
117 | EcsOptimizedAmi[_a] = { fqn: "@aws-cdk/aws-ecs.EcsOptimizedAmi", version: "1.204.0" };
|
118 | /**
|
119 | * Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
|
120 | */
|
121 | class EcsOptimizedImage {
|
122 | /**
|
123 | * Constructs a new instance of the EcsOptimizedAmi class.
|
124 | */
|
125 | constructor(props) {
|
126 | this.hwType = props && props.hardwareType;
|
127 | if (props.windowsVersion) {
|
128 | this.windowsVersion = props.windowsVersion;
|
129 | }
|
130 | else if (props.generation) {
|
131 | this.generation = props.generation;
|
132 | }
|
133 | else {
|
134 | throw new Error('This error should never be thrown');
|
135 | }
|
136 | // set the SSM parameter name
|
137 | this.amiParameterName = '/aws/service/ecs/optimized-ami/'
|
138 | + (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX ? 'amazon-linux/' : '')
|
139 | + (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 ? 'amazon-linux-2/' : '')
|
140 | + (this.windowsVersion ? `windows_server/${this.windowsVersion}/english/full/` : '')
|
141 | + (this.hwType === AmiHardwareType.GPU ? 'gpu/' : '')
|
142 | + (this.hwType === AmiHardwareType.ARM ? 'arm64/' : '')
|
143 | + 'recommended/image_id';
|
144 | this.cachedInContext = props?.cachedInContext ?? false;
|
145 | }
|
146 | /**
|
147 | * Construct an Amazon Linux 2 image from the latest ECS Optimized AMI published in SSM
|
148 | *
|
149 | * @param hardwareType ECS-optimized AMI variant to use
|
150 | */
|
151 | static amazonLinux2(hardwareType = AmiHardwareType.STANDARD, options = {}) {
|
152 | try {
|
153 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_AmiHardwareType(hardwareType);
|
154 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_EcsOptimizedImageOptions(options);
|
155 | }
|
156 | catch (error) {
|
157 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
158 | Error.captureStackTrace(error, this.amazonLinux2);
|
159 | }
|
160 | throw error;
|
161 | }
|
162 | return new EcsOptimizedImage({
|
163 | generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
|
164 | hardwareType,
|
165 | cachedInContext: options.cachedInContext,
|
166 | });
|
167 | }
|
168 | /**
|
169 | * Construct an Amazon Linux AMI image from the latest ECS Optimized AMI published in SSM
|
170 | */
|
171 | static amazonLinux(options = {}) {
|
172 | try {
|
173 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_EcsOptimizedImageOptions(options);
|
174 | }
|
175 | catch (error) {
|
176 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
177 | Error.captureStackTrace(error, this.amazonLinux);
|
178 | }
|
179 | throw error;
|
180 | }
|
181 | return new EcsOptimizedImage({
|
182 | generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX,
|
183 | cachedInContext: options.cachedInContext,
|
184 | });
|
185 | }
|
186 | /**
|
187 | * Construct a Windows image from the latest ECS Optimized AMI published in SSM
|
188 | *
|
189 | * @param windowsVersion Windows Version to use
|
190 | */
|
191 | static windows(windowsVersion, options = {}) {
|
192 | try {
|
193 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_WindowsOptimizedVersion(windowsVersion);
|
194 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_EcsOptimizedImageOptions(options);
|
195 | }
|
196 | catch (error) {
|
197 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
198 | Error.captureStackTrace(error, this.windows);
|
199 | }
|
200 | throw error;
|
201 | }
|
202 | return new EcsOptimizedImage({
|
203 | windowsVersion,
|
204 | cachedInContext: options.cachedInContext,
|
205 | });
|
206 | }
|
207 | /**
|
208 | * Return the correct image
|
209 | */
|
210 | getImage(scope) {
|
211 | const ami = lookupImage(scope, this.cachedInContext, this.amiParameterName);
|
212 | const osType = this.windowsVersion ? ec2.OperatingSystemType.WINDOWS : ec2.OperatingSystemType.LINUX;
|
213 | return {
|
214 | imageId: ami,
|
215 | osType,
|
216 | userData: ec2.UserData.forOperatingSystem(osType),
|
217 | };
|
218 | }
|
219 | }
|
220 | exports.EcsOptimizedImage = EcsOptimizedImage;
|
221 | _b = JSII_RTTI_SYMBOL_1;
|
222 | EcsOptimizedImage[_b] = { fqn: "@aws-cdk/aws-ecs.EcsOptimizedImage", version: "1.204.0" };
|
223 | /**
|
224 | * Amazon ECS variant
|
225 | */
|
226 | var BottlerocketEcsVariant;
|
227 | (function (BottlerocketEcsVariant) {
|
228 | /**
|
229 | * aws-ecs-1 variant
|
230 | */
|
231 | BottlerocketEcsVariant["AWS_ECS_1"] = "aws-ecs-1";
|
232 | })(BottlerocketEcsVariant = exports.BottlerocketEcsVariant || (exports.BottlerocketEcsVariant = {}));
|
233 | /**
|
234 | * Construct an Bottlerocket image from the latest AMI published in SSM
|
235 | */
|
236 | class BottleRocketImage {
|
237 | /**
|
238 | * Constructs a new instance of the BottleRocketImage class.
|
239 | */
|
240 | constructor(props = {}) {
|
241 | try {
|
242 | jsiiDeprecationWarnings._aws_cdk_aws_ecs_BottleRocketImageProps(props);
|
243 | }
|
244 | catch (error) {
|
245 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
246 | Error.captureStackTrace(error, BottleRocketImage);
|
247 | }
|
248 | throw error;
|
249 | }
|
250 | this.variant = props.variant ?? BottlerocketEcsVariant.AWS_ECS_1;
|
251 | this.architecture = props.architecture ?? ec2.InstanceArchitecture.X86_64;
|
252 | // set the SSM parameter name
|
253 | this.amiParameterName = `/aws/service/bottlerocket/${this.variant}/${this.architecture}/latest/image_id`;
|
254 | this.cachedInContext = props.cachedInContext ?? false;
|
255 | }
|
256 | /**
|
257 | * Return the correct image
|
258 | */
|
259 | getImage(scope) {
|
260 | const ami = lookupImage(scope, this.cachedInContext, this.amiParameterName);
|
261 | return {
|
262 | imageId: ami,
|
263 | osType: ec2.OperatingSystemType.LINUX,
|
264 | userData: ec2.UserData.custom(''),
|
265 | };
|
266 | }
|
267 | }
|
268 | exports.BottleRocketImage = BottleRocketImage;
|
269 | _c = JSII_RTTI_SYMBOL_1;
|
270 | BottleRocketImage[_c] = { fqn: "@aws-cdk/aws-ecs.BottleRocketImage", version: "1.204.0" };
|
271 | function lookupImage(scope, cachedInContext, parameterName) {
|
272 | return cachedInContext
|
273 | ? ssm.StringParameter.valueFromLookup(scope, parameterName)
|
274 | : ssm.StringParameter.valueForTypedStringParameter(scope, parameterName, ssm.ParameterType.AWS_EC2_IMAGE_ID);
|
275 | }
|
276 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW1pcy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