@fjall/generator 0.88.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/ast/astComputeParser.d.ts +4 -0
- package/dist/src/ast/astComputeParser.js +427 -0
- package/dist/src/ast/astInfrastructureParser.d.ts +357 -0
- package/dist/src/ast/astInfrastructureParser.js +1925 -0
- package/dist/src/ast/astSurgicalModification.d.ts +47 -0
- package/dist/src/ast/astSurgicalModification.js +400 -0
- package/dist/src/ast/index.d.ts +2 -0
- package/dist/src/ast/index.js +2 -0
- package/dist/src/aws/regions.d.ts +30 -0
- package/dist/src/aws/regions.js +254 -0
- package/dist/src/generation/common.d.ts +86 -0
- package/dist/src/generation/common.js +187 -0
- package/dist/src/generation/compute.d.ts +6 -0
- package/dist/src/generation/compute.js +547 -0
- package/dist/src/generation/database.d.ts +54 -0
- package/dist/src/generation/database.js +201 -0
- package/dist/src/generation/index.d.ts +12 -0
- package/dist/src/generation/index.js +18 -0
- package/dist/src/generation/infrastructure.d.ts +44 -0
- package/dist/src/generation/infrastructure.js +389 -0
- package/dist/src/generation/storage.d.ts +23 -0
- package/dist/src/generation/storage.js +174 -0
- package/dist/src/generation/storageConnections.d.ts +37 -0
- package/dist/src/generation/storageConnections.js +71 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +19 -0
- package/dist/src/planning/index.d.ts +1 -0
- package/dist/src/planning/index.js +1 -0
- package/dist/src/planning/resourcePlanning.d.ts +58 -0
- package/dist/src/planning/resourcePlanning.js +216 -0
- package/dist/src/presets/index.d.ts +3 -0
- package/dist/src/presets/index.js +3 -0
- package/dist/src/presets/patternTierPresets.d.ts +93 -0
- package/dist/src/presets/patternTierPresets.js +131 -0
- package/dist/src/presets/storagePresets.d.ts +11 -0
- package/dist/src/presets/storagePresets.js +36 -0
- package/dist/src/presets/tierPresets.d.ts +59 -0
- package/dist/src/presets/tierPresets.js +384 -0
- package/dist/src/presets/tierTypes.d.ts +301 -0
- package/dist/src/presets/tierTypes.js +7 -0
- package/dist/src/schemas/constants.d.ts +74 -0
- package/dist/src/schemas/constants.js +208 -0
- package/dist/src/schemas/index.d.ts +3 -0
- package/dist/src/schemas/index.js +3 -0
- package/dist/src/schemas/instanceTypeArchitecture.d.ts +35 -0
- package/dist/src/schemas/instanceTypeArchitecture.js +75 -0
- package/dist/src/schemas/resourceSchemas.d.ts +3534 -0
- package/dist/src/schemas/resourceSchemas.js +2015 -0
- package/dist/src/types/Result.d.ts +19 -0
- package/dist/src/types/Result.js +31 -0
- package/dist/src/util/errorUtils.d.ts +2 -0
- package/dist/src/util/errorUtils.js +15 -0
- package/dist/src/validation/patterns.d.ts +300 -0
- package/dist/src/validation/patterns.js +360 -0
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier Presets
|
|
3
|
+
*
|
|
4
|
+
* This file defines the configuration presets for each tier (Tinkerer, Standard,
|
|
5
|
+
* Resilient, Enterprise) across all resource types. Both the `create` flow and
|
|
6
|
+
* `add` flow consume these presets to ensure consistency.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - TIER_PRESETS defines what each tier means for each resource type
|
|
10
|
+
* - planApplicationResources() uses these during `fjall create`
|
|
11
|
+
* - AddResourceScreen uses these during `fjall add`
|
|
12
|
+
* - Custom mode bypasses presets and prompts for each parameter
|
|
13
|
+
*
|
|
14
|
+
* Type definitions live in ./tierTypes.ts and are re-exported here.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Tier names - ordered from least to most capable/expensive
|
|
18
|
+
* This is the single source of truth for all tier-based configuration.
|
|
19
|
+
*/
|
|
20
|
+
export const TIER_NAMES = [
|
|
21
|
+
"tinkerer",
|
|
22
|
+
"lightweight",
|
|
23
|
+
"standard",
|
|
24
|
+
"resilient",
|
|
25
|
+
"enterprise",
|
|
26
|
+
];
|
|
27
|
+
export const CUSTOM_TIER = "custom";
|
|
28
|
+
export const APP_TYPES = [...TIER_NAMES, CUSTOM_TIER];
|
|
29
|
+
/**
|
|
30
|
+
* Master configuration for all tiers
|
|
31
|
+
*/
|
|
32
|
+
export const TIER_PRESETS = Object.freeze({
|
|
33
|
+
tinkerer: {
|
|
34
|
+
displayName: "Tinkerer",
|
|
35
|
+
description: "Free tier eligible, minimal cost for experimentation",
|
|
36
|
+
database: {
|
|
37
|
+
Instance: {
|
|
38
|
+
instanceType: "t4g.micro",
|
|
39
|
+
multiAz: false,
|
|
40
|
+
proxy: false,
|
|
41
|
+
readReplica: false,
|
|
42
|
+
publiclyAccessible: true,
|
|
43
|
+
},
|
|
44
|
+
Aurora: null,
|
|
45
|
+
GlobalAurora: null,
|
|
46
|
+
},
|
|
47
|
+
compute: {
|
|
48
|
+
ecs: {
|
|
49
|
+
services: [
|
|
50
|
+
{
|
|
51
|
+
name: "service", // Placeholder - overwritten by user input or app-derived name
|
|
52
|
+
capacityProvider: "EC2",
|
|
53
|
+
desiredCount: 1,
|
|
54
|
+
minCapacity: 1,
|
|
55
|
+
maxCapacity: 1,
|
|
56
|
+
ec2Config: {
|
|
57
|
+
instanceType: "t4g.micro",
|
|
58
|
+
amiHardwareType: "ARM",
|
|
59
|
+
minCapacity: 1,
|
|
60
|
+
maxCapacity: 1,
|
|
61
|
+
memoryLimitMiB: 400,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
cluster: { directAccess: true },
|
|
66
|
+
},
|
|
67
|
+
lambda: {
|
|
68
|
+
timeout: 30,
|
|
69
|
+
memory: 128,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
network: {
|
|
73
|
+
maxAzs: 2,
|
|
74
|
+
natGateways: false,
|
|
75
|
+
flowLogs: false,
|
|
76
|
+
},
|
|
77
|
+
backup: false,
|
|
78
|
+
},
|
|
79
|
+
lightweight: {
|
|
80
|
+
displayName: "Lightweight",
|
|
81
|
+
description: "Streamlined single-AZ deployment for cost efficiency",
|
|
82
|
+
database: {
|
|
83
|
+
Instance: {
|
|
84
|
+
instanceType: "t4g.small",
|
|
85
|
+
multiAz: false,
|
|
86
|
+
},
|
|
87
|
+
Aurora: {
|
|
88
|
+
readers: false,
|
|
89
|
+
},
|
|
90
|
+
GlobalAurora: null,
|
|
91
|
+
},
|
|
92
|
+
compute: {
|
|
93
|
+
ecs: {
|
|
94
|
+
services: [
|
|
95
|
+
{
|
|
96
|
+
name: "service", // Placeholder - overwritten by user input or app-derived name
|
|
97
|
+
capacityProvider: "FARGATE_SPOT",
|
|
98
|
+
cpu: 256,
|
|
99
|
+
memoryLimitMiB: 512,
|
|
100
|
+
desiredCount: 1,
|
|
101
|
+
minCapacity: 1,
|
|
102
|
+
maxCapacity: 3,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
lambda: {
|
|
107
|
+
timeout: 30,
|
|
108
|
+
memory: 256,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
network: {
|
|
112
|
+
maxAzs: 2,
|
|
113
|
+
natGateways: { count: 1 },
|
|
114
|
+
flowLogs: false,
|
|
115
|
+
},
|
|
116
|
+
backup: false,
|
|
117
|
+
},
|
|
118
|
+
standard: {
|
|
119
|
+
displayName: "Standard",
|
|
120
|
+
description: "Production-ready with sensible defaults",
|
|
121
|
+
database: {
|
|
122
|
+
Instance: {
|
|
123
|
+
instanceType: "t4g.large",
|
|
124
|
+
},
|
|
125
|
+
Aurora: {
|
|
126
|
+
readers: { count: 1 },
|
|
127
|
+
},
|
|
128
|
+
GlobalAurora: {
|
|
129
|
+
readers: { count: 1 },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
compute: {
|
|
133
|
+
ecs: {
|
|
134
|
+
services: [
|
|
135
|
+
{
|
|
136
|
+
name: "service", // Placeholder - overwritten by user input or app-derived name
|
|
137
|
+
capacityProvider: "FARGATE",
|
|
138
|
+
cpu: 512,
|
|
139
|
+
memoryLimitMiB: 1024,
|
|
140
|
+
desiredCount: 2,
|
|
141
|
+
minCapacity: 2,
|
|
142
|
+
maxCapacity: 5,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
lambda: {
|
|
147
|
+
timeout: 60,
|
|
148
|
+
memory: 256,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
network: {
|
|
152
|
+
maxAzs: 3,
|
|
153
|
+
natGateways: { count: 1 },
|
|
154
|
+
flowLogs: {},
|
|
155
|
+
vpcEndpoints: {
|
|
156
|
+
interface: { ecr: true },
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
// App-level tiers below resilient opt out of AWS Backup. Pattern tier presets
|
|
160
|
+
// define their own { tier: "standard" } because patterns always include backup
|
|
161
|
+
// from standard upward — see patternTierPresets.ts.
|
|
162
|
+
backup: false,
|
|
163
|
+
},
|
|
164
|
+
resilient: {
|
|
165
|
+
displayName: "Resilient",
|
|
166
|
+
description: "High availability with enhanced monitoring and scaling",
|
|
167
|
+
database: {
|
|
168
|
+
Instance: {
|
|
169
|
+
instanceType: "r7g.large",
|
|
170
|
+
encryption: { storageKey: { useCMK: true } },
|
|
171
|
+
databaseInsights: {
|
|
172
|
+
mode: "advanced",
|
|
173
|
+
encryptionKey: { useCMK: true },
|
|
174
|
+
},
|
|
175
|
+
proxy: { requireTLS: true },
|
|
176
|
+
},
|
|
177
|
+
Aurora: {
|
|
178
|
+
readers: { count: 2 },
|
|
179
|
+
encryption: { storageKey: { useCMK: true } },
|
|
180
|
+
databaseInsights: {
|
|
181
|
+
mode: "advanced",
|
|
182
|
+
encryptionKey: { useCMK: true },
|
|
183
|
+
},
|
|
184
|
+
proxy: { requireTLS: true },
|
|
185
|
+
backupRetention: 30,
|
|
186
|
+
},
|
|
187
|
+
GlobalAurora: {
|
|
188
|
+
readers: { count: 2 },
|
|
189
|
+
encryption: { storageKey: { useCMK: true } },
|
|
190
|
+
databaseInsights: {
|
|
191
|
+
mode: "advanced",
|
|
192
|
+
encryptionKey: { useCMK: true },
|
|
193
|
+
},
|
|
194
|
+
proxy: { requireTLS: true },
|
|
195
|
+
backupRetention: 30,
|
|
196
|
+
enableGlobalWriteForwarding: true,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
compute: {
|
|
200
|
+
ecs: {
|
|
201
|
+
services: [
|
|
202
|
+
{
|
|
203
|
+
name: "service", // Placeholder - overwritten by user input or app-derived name
|
|
204
|
+
capacityProvider: "FARGATE",
|
|
205
|
+
cpu: 1024,
|
|
206
|
+
memoryLimitMiB: 2048,
|
|
207
|
+
desiredCount: 4,
|
|
208
|
+
minCapacity: 4,
|
|
209
|
+
maxCapacity: 20,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
lambda: {
|
|
214
|
+
timeout: 120,
|
|
215
|
+
memory: 512,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
network: {
|
|
219
|
+
maxAzs: 3,
|
|
220
|
+
natGateways: { count: 3 },
|
|
221
|
+
flowLogs: { retentionDays: 90 },
|
|
222
|
+
vpcEndpoints: {
|
|
223
|
+
interface: { ecr: true, secretsManager: true },
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
backup: { tier: "resilient" },
|
|
227
|
+
},
|
|
228
|
+
enterprise: {
|
|
229
|
+
displayName: "Enterprise",
|
|
230
|
+
description: "Maximum capability with all features enabled",
|
|
231
|
+
database: {
|
|
232
|
+
Instance: {
|
|
233
|
+
instanceType: "r6g.xlarge",
|
|
234
|
+
encryption: { storageKey: { useCMK: true } },
|
|
235
|
+
databaseInsights: {
|
|
236
|
+
mode: "advanced",
|
|
237
|
+
encryptionKey: { useCMK: true },
|
|
238
|
+
},
|
|
239
|
+
proxy: { requireTLS: true },
|
|
240
|
+
readReplica: {},
|
|
241
|
+
},
|
|
242
|
+
Aurora: {
|
|
243
|
+
readers: { count: 2 },
|
|
244
|
+
encryption: { storageKey: { useCMK: true } },
|
|
245
|
+
databaseInsights: {
|
|
246
|
+
mode: "advanced",
|
|
247
|
+
encryptionKey: { useCMK: true },
|
|
248
|
+
},
|
|
249
|
+
proxy: { requireTLS: true },
|
|
250
|
+
backupRetention: 35,
|
|
251
|
+
},
|
|
252
|
+
GlobalAurora: {
|
|
253
|
+
readers: { count: 2 },
|
|
254
|
+
encryption: { storageKey: { useCMK: true } },
|
|
255
|
+
databaseInsights: {
|
|
256
|
+
mode: "advanced",
|
|
257
|
+
encryptionKey: { useCMK: true },
|
|
258
|
+
},
|
|
259
|
+
proxy: { requireTLS: true },
|
|
260
|
+
backupRetention: 35,
|
|
261
|
+
enableGlobalWriteForwarding: true,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
compute: {
|
|
265
|
+
ecs: {
|
|
266
|
+
services: [
|
|
267
|
+
{
|
|
268
|
+
name: "service", // Placeholder - overwritten by user input or app-derived name
|
|
269
|
+
capacityProvider: "FARGATE",
|
|
270
|
+
cpu: 2048,
|
|
271
|
+
memoryLimitMiB: 4096,
|
|
272
|
+
desiredCount: 6,
|
|
273
|
+
minCapacity: 6,
|
|
274
|
+
maxCapacity: 100,
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
lambda: {
|
|
279
|
+
timeout: 300,
|
|
280
|
+
memory: 1024,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
network: {
|
|
284
|
+
maxAzs: 3,
|
|
285
|
+
natGateways: { count: 3 },
|
|
286
|
+
flowLogs: { destination: "s3", retentionDays: 365 },
|
|
287
|
+
vpcEndpoints: {
|
|
288
|
+
interface: {
|
|
289
|
+
ecr: true,
|
|
290
|
+
secretsManager: true,
|
|
291
|
+
kms: true,
|
|
292
|
+
cloudwatchLogs: true,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
backup: { tier: "enterprise" },
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
export function getDatabasePreset(tier, databaseType) {
|
|
300
|
+
return TIER_PRESETS[tier].database[databaseType];
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get ECS preset for a specific tier
|
|
304
|
+
*/
|
|
305
|
+
export function getEcsPreset(tier) {
|
|
306
|
+
return TIER_PRESETS[tier].compute.ecs;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Get network preset for a specific tier
|
|
310
|
+
*/
|
|
311
|
+
export function getNetworkPreset(tier) {
|
|
312
|
+
return TIER_PRESETS[tier].network;
|
|
313
|
+
}
|
|
314
|
+
export function getAvailableTiersForDatabase(databaseType) {
|
|
315
|
+
return TIER_NAMES.filter((tier) => TIER_PRESETS[tier].database[databaseType] !== null);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Get tier options formatted for UI Select component
|
|
319
|
+
*/
|
|
320
|
+
export function getTierOptionsForDatabase(databaseType) {
|
|
321
|
+
return getAvailableTiersForDatabase(databaseType).map((tier) => ({
|
|
322
|
+
label: TIER_PRESETS[tier].displayName,
|
|
323
|
+
value: tier,
|
|
324
|
+
description: TIER_PRESETS[tier].description,
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Get the default database type for a tier
|
|
329
|
+
*/
|
|
330
|
+
export function getDefaultDatabaseTypeForTier(tier) {
|
|
331
|
+
switch (tier) {
|
|
332
|
+
case "tinkerer":
|
|
333
|
+
case "lightweight":
|
|
334
|
+
case "standard":
|
|
335
|
+
return "Instance";
|
|
336
|
+
case "resilient":
|
|
337
|
+
case "enterprise":
|
|
338
|
+
return "Aurora";
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Apply tier defaults to user-provided services.
|
|
343
|
+
* Takes user service names and applies the tier's cpu, memory, scaling,
|
|
344
|
+
* capacityProvider, and ec2Config defaults.
|
|
345
|
+
*/
|
|
346
|
+
export function applyTierDefaultsToServices(tier, userServices) {
|
|
347
|
+
const tierPreset = TIER_PRESETS[tier];
|
|
348
|
+
const ecsPreset = tierPreset.compute.ecs;
|
|
349
|
+
const templateService = ecsPreset.services[0];
|
|
350
|
+
// Only add routing if tier has a load balancer (not directAccess)
|
|
351
|
+
const hasLoadBalancer = !ecsPreset.cluster?.directAccess &&
|
|
352
|
+
ecsPreset.cluster?.loadBalancer !== false;
|
|
353
|
+
return userServices.map((userService, index) => {
|
|
354
|
+
const isFirstService = index === 0;
|
|
355
|
+
// Build routing config only if tier supports load balancer AND multiple services
|
|
356
|
+
// Single service doesn't need routing - ALB routes all traffic to it automatically
|
|
357
|
+
let routing;
|
|
358
|
+
if (hasLoadBalancer) {
|
|
359
|
+
// Use provided routing if available
|
|
360
|
+
if (userService.routing) {
|
|
361
|
+
routing = userService.routing;
|
|
362
|
+
}
|
|
363
|
+
else if (userServices.length > 1) {
|
|
364
|
+
// Multiple services need routing to differentiate traffic
|
|
365
|
+
routing = {
|
|
366
|
+
path: isFirstService ? "/*" : `/${userService.name.toLowerCase()}/*`,
|
|
367
|
+
...(isFirstService ? {} : { priority: 100 + index }),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
// Single service: no routing needed (undefined)
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
name: userService.name,
|
|
374
|
+
capacityProvider: templateService.capacityProvider,
|
|
375
|
+
ec2Config: templateService.ec2Config,
|
|
376
|
+
cpu: templateService.cpu,
|
|
377
|
+
memoryLimitMiB: templateService.memoryLimitMiB,
|
|
378
|
+
desiredCount: templateService.desiredCount,
|
|
379
|
+
minCapacity: templateService.minCapacity,
|
|
380
|
+
maxCapacity: templateService.maxCapacity,
|
|
381
|
+
routing,
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier Preset Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* All interfaces used by tier presets, pattern tier presets, and downstream
|
|
5
|
+
* consumers. Extracted from tierPresets.ts for maintainability.
|
|
6
|
+
*/
|
|
7
|
+
import type { EcsCapacityProvider, BackupVaultTier } from "../schemas/constants.js";
|
|
8
|
+
/**
|
|
9
|
+
* Proxy configuration for tier presets
|
|
10
|
+
* Presence = enabled. Use `false` to explicitly disable.
|
|
11
|
+
*/
|
|
12
|
+
export interface TierProxyConfig {
|
|
13
|
+
/** Maximum number of database connections. Default: 100 */
|
|
14
|
+
maxConnections?: number;
|
|
15
|
+
/** Maximum idle connections to maintain. Default: 50 */
|
|
16
|
+
maxIdleConnections?: number;
|
|
17
|
+
/** Timeout for borrowing connections in seconds. Default: 120 */
|
|
18
|
+
connectionBorrowTimeout?: number;
|
|
19
|
+
/** Require TLS for proxy connections. Default: true */
|
|
20
|
+
requireTLS?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read replica configuration for tier presets
|
|
24
|
+
* Presence = enabled. Use `false` to explicitly disable.
|
|
25
|
+
*/
|
|
26
|
+
export interface TierReadReplicaConfig {
|
|
27
|
+
/** Instance type for the replica. Default: same as primary */
|
|
28
|
+
instanceType?: string;
|
|
29
|
+
/** Availability zone for the replica. Default: auto-selected */
|
|
30
|
+
availabilityZone?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Credentials configuration for tier presets
|
|
34
|
+
*/
|
|
35
|
+
export interface TierCredentialsConfig {
|
|
36
|
+
/** Master username for the database. Default: "postgres" */
|
|
37
|
+
username?: string;
|
|
38
|
+
/** Secret rotation configuration. Presence enables rotation. */
|
|
39
|
+
secretRotation?: {
|
|
40
|
+
/** Days between automatic rotations. Default: 30 */
|
|
41
|
+
automaticallyAfterDays?: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Aurora readers configuration for tier presets
|
|
46
|
+
*/
|
|
47
|
+
export interface TierAuroraReadersConfig {
|
|
48
|
+
/** Number of readers. Default: 1 */
|
|
49
|
+
count?: number;
|
|
50
|
+
/** Default Database Insights setting for all readers. Default: true */
|
|
51
|
+
defaultEnableDatabaseInsights?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface TierDatabaseInsightsConfig {
|
|
54
|
+
mode?: "standard" | "advanced";
|
|
55
|
+
encryptionKey?: {
|
|
56
|
+
useCMK: true;
|
|
57
|
+
} | {
|
|
58
|
+
awsManaged: true;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface TierEncryptionConfig {
|
|
62
|
+
storageKey?: {
|
|
63
|
+
useCMK: true;
|
|
64
|
+
} | {
|
|
65
|
+
awsManaged: true;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Database tier preset configuration
|
|
70
|
+
* Null means the tier doesn't support that database type
|
|
71
|
+
*/
|
|
72
|
+
export interface DatabaseTierPreset {
|
|
73
|
+
/** Instance type for RDS (e.g., "t3.micro", "r6g.large") */
|
|
74
|
+
instanceType?: string;
|
|
75
|
+
/** Multi-AZ deployment for high availability */
|
|
76
|
+
multiAz?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Place database in public subnet with public IP.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
publiclyAccessible?: boolean;
|
|
82
|
+
encryption?: TierEncryptionConfig;
|
|
83
|
+
databaseInsights?: TierDatabaseInsightsConfig | false;
|
|
84
|
+
/** Database port. Default: 35255 (FJALL on phone keypad) */
|
|
85
|
+
port?: number;
|
|
86
|
+
/** RDS Proxy configuration for connection pooling. */
|
|
87
|
+
proxy?: TierProxyConfig | false;
|
|
88
|
+
/** Database credentials configuration including username and secret rotation. */
|
|
89
|
+
credentials?: TierCredentialsConfig;
|
|
90
|
+
/** Read replica configuration for read scaling. */
|
|
91
|
+
readReplica?: TierReadReplicaConfig | false;
|
|
92
|
+
/** Aurora readers configuration */
|
|
93
|
+
readers?: TierAuroraReadersConfig | false;
|
|
94
|
+
/** Backup retention in days. Default: 14 */
|
|
95
|
+
backupRetention?: number;
|
|
96
|
+
/** Primary region for Global Aurora */
|
|
97
|
+
primaryRegion?: string;
|
|
98
|
+
/** Secondary regions for Global Aurora replication */
|
|
99
|
+
secondaryRegions?: string[];
|
|
100
|
+
/** Enable write forwarding for Global Aurora */
|
|
101
|
+
enableGlobalWriteForwarding?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* EC2 capacity configuration for ECS EC2 capacity provider.
|
|
105
|
+
* Only applies when capacityProvider is "EC2".
|
|
106
|
+
*/
|
|
107
|
+
export interface TierEc2CapacityConfig {
|
|
108
|
+
/** EC2 instance type. Default: "t3.micro" */
|
|
109
|
+
instanceType?: string;
|
|
110
|
+
/** AMI hardware type. Default: "ARM" for cost efficiency */
|
|
111
|
+
amiHardwareType?: "ARM" | "STANDARD";
|
|
112
|
+
/** Minimum EC2 instances. Default: 1 */
|
|
113
|
+
minCapacity?: number;
|
|
114
|
+
/** Maximum EC2 instances. Default: 3 */
|
|
115
|
+
maxCapacity?: number;
|
|
116
|
+
/** Memory limit for container in MiB. Default: 400 */
|
|
117
|
+
memoryLimitMiB?: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Cluster configuration for ECS tier presets.
|
|
121
|
+
*/
|
|
122
|
+
export interface TierClusterConfig {
|
|
123
|
+
/** Enable direct EC2 access without ALB. Opens container ports on security group. */
|
|
124
|
+
directAccess?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Load balancer configuration.
|
|
127
|
+
* - false: No ALB (for workers/internal services)
|
|
128
|
+
* - "public": Internet-facing ALB (default)
|
|
129
|
+
* - "internal": VPC-only ALB
|
|
130
|
+
*/
|
|
131
|
+
loadBalancer?: false | "public" | "internal";
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Service configuration for ECS tier presets.
|
|
135
|
+
* Each service gets its own task definition, scaling, and target group.
|
|
136
|
+
* Each service MUST specify its own capacityProvider.
|
|
137
|
+
*/
|
|
138
|
+
export interface TierEcsServiceConfig {
|
|
139
|
+
/** Service name (unique within cluster) */
|
|
140
|
+
name: string;
|
|
141
|
+
/**
|
|
142
|
+
* Capacity provider for this service. REQUIRED.
|
|
143
|
+
* - FARGATE: Serverless containers (default)
|
|
144
|
+
* - FARGATE_SPOT: Serverless with spot pricing
|
|
145
|
+
* - EC2: Self-managed EC2 instances
|
|
146
|
+
*/
|
|
147
|
+
capacityProvider: EcsCapacityProvider;
|
|
148
|
+
/** EC2 capacity configuration. Only applies when capacityProvider is "EC2". */
|
|
149
|
+
ec2Config?: TierEc2CapacityConfig;
|
|
150
|
+
/** Task CPU units (256, 512, 1024, 2048, 4096). Required for Fargate. */
|
|
151
|
+
cpu?: number;
|
|
152
|
+
/** Task memory in MiB (512 - 30720). Required for Fargate. */
|
|
153
|
+
memoryLimitMiB?: number;
|
|
154
|
+
/** Desired task count. Default: 1 */
|
|
155
|
+
desiredCount?: number;
|
|
156
|
+
/** Minimum capacity for autoscaling. Default: 1 */
|
|
157
|
+
minCapacity?: number;
|
|
158
|
+
/** Maximum capacity for autoscaling. Default: 5 */
|
|
159
|
+
maxCapacity?: number;
|
|
160
|
+
/** Routing rules for this service on the cluster's ALB */
|
|
161
|
+
routing?: {
|
|
162
|
+
path?: string;
|
|
163
|
+
host?: string;
|
|
164
|
+
priority?: number;
|
|
165
|
+
} | Array<{
|
|
166
|
+
path?: string;
|
|
167
|
+
host?: string;
|
|
168
|
+
priority?: number;
|
|
169
|
+
}>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* ECS tier preset configuration.
|
|
173
|
+
* Uses services array for consistent model across all layers.
|
|
174
|
+
*/
|
|
175
|
+
export interface EcsTierPreset {
|
|
176
|
+
/**
|
|
177
|
+
* Services in this cluster.
|
|
178
|
+
* Each service MUST specify its own capacityProvider and has its own
|
|
179
|
+
* scaling, cpu, memory, and ec2Config configuration.
|
|
180
|
+
*/
|
|
181
|
+
services: TierEcsServiceConfig[];
|
|
182
|
+
/**
|
|
183
|
+
* Cluster configuration. Controls ALB and direct access settings.
|
|
184
|
+
*/
|
|
185
|
+
cluster?: TierClusterConfig;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Lambda tier preset configuration
|
|
189
|
+
*/
|
|
190
|
+
export interface LambdaTierPreset {
|
|
191
|
+
timeout?: number;
|
|
192
|
+
memory?: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* NAT gateway configuration for network tier presets.
|
|
196
|
+
* Presence = enabled. Use `false` to explicitly disable.
|
|
197
|
+
*/
|
|
198
|
+
export interface TierNatConfig {
|
|
199
|
+
/** Number of NAT gateways. Default: 1. Set to maxAzs for full redundancy. */
|
|
200
|
+
count?: number;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Flow log configuration for network tier presets.
|
|
204
|
+
* Presence = enabled. Use `false` to explicitly disable.
|
|
205
|
+
*/
|
|
206
|
+
export interface TierFlowLogConfig {
|
|
207
|
+
/** Log destination. Default: cloudwatch */
|
|
208
|
+
destination?: "cloudwatch" | "s3";
|
|
209
|
+
/** Retention period in days. Default: 14 */
|
|
210
|
+
retentionDays?: number;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Gateway VPC endpoint configuration.
|
|
214
|
+
*/
|
|
215
|
+
export interface TierGatewayEndpointsConfig {
|
|
216
|
+
/** Enable S3 Gateway endpoint. Default: true */
|
|
217
|
+
s3?: boolean;
|
|
218
|
+
/** Enable DynamoDB Gateway endpoint. Default: true */
|
|
219
|
+
dynamodb?: boolean;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Interface VPC endpoint configuration.
|
|
223
|
+
*/
|
|
224
|
+
export interface TierInterfaceEndpointsConfig {
|
|
225
|
+
/** ECR endpoints for container image pulls. ~$15/month */
|
|
226
|
+
ecr?: boolean;
|
|
227
|
+
/** Secrets Manager endpoint. ~$7/month */
|
|
228
|
+
secretsManager?: boolean;
|
|
229
|
+
/** KMS endpoint. ~$7/month */
|
|
230
|
+
kms?: boolean;
|
|
231
|
+
/** CloudWatch Logs endpoint. ~$7/month */
|
|
232
|
+
cloudwatchLogs?: boolean;
|
|
233
|
+
/** Systems Manager endpoint. ~$7/month */
|
|
234
|
+
ssm?: boolean;
|
|
235
|
+
/** STS endpoint. ~$7/month */
|
|
236
|
+
sts?: boolean;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* VPC endpoints configuration for network tier presets.
|
|
240
|
+
*/
|
|
241
|
+
export interface TierVpcEndpointsConfig {
|
|
242
|
+
/** Gateway endpoints. */
|
|
243
|
+
gateway?: TierGatewayEndpointsConfig | false;
|
|
244
|
+
/** Interface endpoints. */
|
|
245
|
+
interface?: TierInterfaceEndpointsConfig | false;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Network tier preset configuration
|
|
249
|
+
*/
|
|
250
|
+
export interface NetworkTierPreset {
|
|
251
|
+
/** Maximum Availability Zones. Default: 3 */
|
|
252
|
+
maxAzs?: number;
|
|
253
|
+
/** NAT gateway configuration. Use `false` to disable. */
|
|
254
|
+
natGateways?: TierNatConfig | false;
|
|
255
|
+
/** Flow log configuration. Use `false` to disable. */
|
|
256
|
+
flowLogs?: TierFlowLogConfig | false;
|
|
257
|
+
/** VPC endpoints configuration. */
|
|
258
|
+
vpcEndpoints?: TierVpcEndpointsConfig | false;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Complete tier preset for all resource types
|
|
262
|
+
*/
|
|
263
|
+
export interface TierPreset {
|
|
264
|
+
/** Human-readable name for UI display */
|
|
265
|
+
displayName: string;
|
|
266
|
+
/** Brief description of what this tier is for */
|
|
267
|
+
description: string;
|
|
268
|
+
/** Database presets by type. Null means not available for this tier. */
|
|
269
|
+
database: {
|
|
270
|
+
Instance: DatabaseTierPreset | null;
|
|
271
|
+
Aurora: DatabaseTierPreset | null;
|
|
272
|
+
GlobalAurora: DatabaseTierPreset | null;
|
|
273
|
+
};
|
|
274
|
+
/** Compute presets */
|
|
275
|
+
compute: {
|
|
276
|
+
ecs: EcsTierPreset;
|
|
277
|
+
lambda: LambdaTierPreset;
|
|
278
|
+
};
|
|
279
|
+
/** Network presets */
|
|
280
|
+
network: NetworkTierPreset;
|
|
281
|
+
/** Backup configuration. Object = enrol in AWS Backup, false = no backup. */
|
|
282
|
+
backup: {
|
|
283
|
+
tier: BackupVaultTier;
|
|
284
|
+
} | false;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* User-provided service configuration from the UI
|
|
288
|
+
*/
|
|
289
|
+
export interface UserServiceConfig {
|
|
290
|
+
name: string;
|
|
291
|
+
dockerfilePath?: string;
|
|
292
|
+
containerPort?: number;
|
|
293
|
+
needsDatabaseConnection?: boolean;
|
|
294
|
+
routing?: {
|
|
295
|
+
path: string;
|
|
296
|
+
priority?: number;
|
|
297
|
+
} | Array<{
|
|
298
|
+
path: string;
|
|
299
|
+
priority?: number;
|
|
300
|
+
}>;
|
|
301
|
+
}
|