@fjall/components-infrastructure 0.88.3 → 0.89.2
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/LICENSE +21 -0
- package/dist/lib/app.d.ts +33 -10
- package/dist/lib/app.js +79 -36
- package/dist/lib/aspects/index.d.ts +1 -0
- package/dist/lib/aspects/index.js +6 -0
- package/dist/lib/config/aws/accountAuditRole.d.ts +20 -0
- package/dist/lib/config/aws/accountAuditRole.js +38 -0
- package/dist/lib/config/aws/accountMonitoringRole.d.ts +22 -0
- package/dist/lib/config/aws/accountMonitoringRole.js +133 -0
- package/dist/lib/config/aws/cloudTrail.d.ts +0 -3
- package/dist/lib/config/aws/cloudTrail.js +2 -2
- package/dist/lib/config/aws/disasterRecovery.js +53 -20
- package/dist/lib/config/aws/ecrDefaultImage.js +4 -3
- package/dist/lib/config/aws/index.d.ts +4 -0
- package/dist/lib/config/aws/index.js +5 -1
- package/dist/lib/config/aws/oidcConnector.d.ts +8 -0
- package/dist/lib/config/aws/oidcConnector.js +46 -0
- package/dist/lib/config/aws/platform.d.ts +2 -0
- package/dist/lib/config/aws/platform.js +6 -0
- package/dist/lib/config/index.d.ts +2 -0
- package/dist/lib/config/index.js +21 -0
- package/dist/lib/patterns/aws/account.js +22 -10
- package/dist/lib/patterns/aws/cdn.d.ts +19 -40
- package/dist/lib/patterns/aws/cdn.js +21 -17
- package/dist/lib/patterns/aws/compute.d.ts +9 -720
- package/dist/lib/patterns/aws/compute.js +27 -432
- package/dist/lib/patterns/aws/computeEc2.d.ts +67 -0
- package/dist/lib/patterns/aws/computeEc2.js +46 -0
- package/dist/lib/patterns/aws/computeEcs.d.ts +446 -0
- package/dist/lib/patterns/aws/computeEcs.js +246 -0
- package/dist/lib/patterns/aws/computeLambda.d.ts +220 -0
- package/dist/lib/patterns/aws/computeLambda.js +147 -0
- package/dist/lib/patterns/aws/database.d.ts +7 -87
- package/dist/lib/patterns/aws/database.js +15 -38
- package/dist/lib/patterns/aws/domainDelegation.d.ts +8 -0
- package/dist/lib/patterns/aws/domainDelegation.js +54 -0
- package/dist/lib/patterns/aws/domainFactory.d.ts +8 -0
- package/dist/lib/patterns/aws/domainFactory.js +23 -0
- package/dist/lib/patterns/aws/index.d.ts +4 -1
- package/dist/lib/patterns/aws/index.js +6 -2
- package/dist/lib/patterns/aws/interfaces/cdn.d.ts +26 -0
- package/dist/lib/patterns/aws/interfaces/cdn.js +14 -0
- package/dist/lib/patterns/aws/interfaces/connector.d.ts +4 -181
- package/dist/lib/patterns/aws/interfaces/connector.js +16 -113
- package/dist/lib/patterns/aws/interfaces/domain.d.ts +2 -0
- package/dist/lib/patterns/aws/interfaces/domain.js +6 -0
- package/dist/lib/patterns/aws/interfaces/index.d.ts +2 -0
- package/dist/lib/patterns/aws/interfaces/index.js +5 -2
- package/dist/lib/patterns/aws/interfaces/pattern.d.ts +9 -6
- package/dist/lib/patterns/aws/interfaces/pattern.js +1 -1
- package/dist/lib/patterns/aws/network.js +6 -9
- package/dist/lib/patterns/aws/organisation.d.ts +4 -2
- package/dist/lib/patterns/aws/organisation.js +21 -8
- package/dist/lib/patterns/aws/payload.js +21 -12
- package/dist/lib/patterns/aws/storage.d.ts +3 -2
- package/dist/lib/patterns/aws/storage.js +1 -1
- package/dist/lib/resources/aws/audit/auditRole.js +4 -4
- package/dist/lib/resources/aws/audit/index.d.ts +1 -0
- package/dist/lib/resources/aws/audit/index.js +6 -0
- package/dist/lib/resources/aws/backup/backupPlan.js +3 -2
- package/dist/lib/resources/aws/backup/backupVault.js +5 -3
- package/dist/lib/resources/aws/base/awsStack.d.ts +4 -2
- package/dist/lib/resources/aws/base/awsStack.js +8 -2
- package/dist/lib/resources/aws/cdn/cloudFront.d.ts +14 -0
- package/dist/lib/resources/aws/cdn/cloudFront.js +52 -18
- package/dist/lib/resources/aws/compute/ec2.js +18 -22
- package/dist/lib/resources/aws/compute/ecs.d.ts +23 -10
- package/dist/lib/resources/aws/compute/ecs.js +121 -64
- package/dist/lib/resources/aws/compute/index.d.ts +1 -0
- package/dist/lib/resources/aws/compute/index.js +2 -1
- package/dist/lib/resources/aws/compute/lambda.d.ts +0 -2
- package/dist/lib/resources/aws/compute/lambda.js +12 -27
- package/dist/lib/resources/aws/database/dynamodb.js +3 -13
- package/dist/lib/resources/aws/database/index.d.ts +8 -2
- package/dist/lib/resources/aws/database/index.js +19 -3
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +2 -3
- package/dist/lib/resources/aws/database/rdsAurora.js +32 -68
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +6 -6
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +25 -29
- package/dist/lib/resources/aws/database/rdsDefaults.d.ts +11 -0
- package/dist/lib/resources/aws/database/rdsDefaults.js +15 -0
- package/dist/lib/resources/aws/database/rdsHelpers.d.ts +39 -0
- package/dist/lib/resources/aws/database/rdsHelpers.js +75 -0
- package/dist/lib/resources/aws/database/rdsInstance.d.ts +7 -8
- package/dist/lib/resources/aws/database/rdsInstance.js +40 -84
- package/dist/lib/resources/aws/database/rdsProxyOutput.d.ts +7 -0
- package/dist/lib/resources/aws/database/rdsProxyOutput.js +18 -0
- package/dist/lib/resources/aws/iam/index.d.ts +0 -1
- package/dist/lib/resources/aws/iam/index.js +1 -2
- package/dist/lib/resources/aws/index.d.ts +0 -1
- package/dist/lib/resources/aws/index.js +1 -2
- package/dist/lib/resources/aws/logging/cloudTrail.js +13 -3
- package/dist/lib/resources/aws/logging/index.d.ts +2 -0
- package/dist/lib/resources/aws/logging/index.js +19 -0
- package/dist/lib/resources/aws/messaging/index.d.ts +3 -2
- package/dist/lib/resources/aws/messaging/index.js +4 -3
- package/dist/lib/resources/aws/messaging/sqs.js +14 -11
- package/dist/lib/resources/aws/messaging/utils.d.ts +1 -2
- package/dist/lib/resources/aws/messaging/utils.js +3 -4
- package/dist/lib/resources/aws/monitoring/index.d.ts +0 -1
- package/dist/lib/resources/aws/monitoring/index.js +4 -17
- package/dist/lib/resources/aws/networking/domain.d.ts +13 -0
- package/dist/lib/resources/aws/networking/domain.js +102 -0
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +13 -0
- package/dist/lib/resources/aws/networking/domainCertificate.js +28 -0
- package/dist/lib/resources/aws/networking/hostedZone.d.ts +28 -0
- package/dist/lib/resources/aws/networking/hostedZone.js +150 -0
- package/dist/lib/resources/aws/networking/index.d.ts +4 -0
- package/dist/lib/resources/aws/networking/index.js +5 -1
- package/dist/lib/resources/aws/networking/ipamPool.js +57 -31
- package/dist/lib/resources/aws/networking/securityGroup.d.ts +5 -0
- package/dist/lib/resources/aws/networking/securityGroup.js +14 -0
- package/dist/lib/resources/aws/networking/vpc.js +9 -4
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +17 -0
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +66 -0
- package/dist/lib/resources/aws/organisation/index.d.ts +1 -0
- package/dist/lib/resources/aws/organisation/index.js +4 -2
- package/dist/lib/resources/aws/secrets/index.d.ts +0 -1
- package/dist/lib/resources/aws/secrets/index.js +1 -2
- package/dist/lib/resources/aws/storage/ecr.d.ts +0 -1
- package/dist/lib/resources/aws/storage/ecr.js +5 -5
- package/dist/lib/resources/aws/storage/s3.d.ts +3 -3
- package/dist/lib/resources/aws/storage/s3.js +1 -1
- package/dist/lib/resources/aws/utilities/index.d.ts +5 -0
- package/dist/lib/resources/aws/utilities/index.js +22 -0
- package/dist/lib/utils/backupTierMapping.d.ts +11 -0
- package/dist/lib/utils/backupTierMapping.js +17 -0
- package/dist/lib/utils/capitaliseString.d.ts +1 -12
- package/dist/lib/utils/capitaliseString.js +8 -28
- package/dist/lib/utils/connections.d.ts +46 -0
- package/dist/lib/utils/connections.js +159 -0
- package/dist/lib/utils/connector.d.ts +183 -0
- package/dist/lib/utils/connector.js +117 -0
- package/dist/lib/utils/databaseTypes.d.ts +85 -0
- package/dist/lib/utils/databaseTypes.js +34 -0
- package/dist/lib/utils/dnsRecords.d.ts +4 -0
- package/dist/lib/utils/dnsRecords.js +108 -0
- package/dist/lib/utils/domainTypes.d.ts +37 -0
- package/dist/lib/utils/domainTypes.js +10 -0
- package/dist/lib/utils/env.d.ts +42 -0
- package/dist/lib/utils/env.js +122 -0
- package/dist/lib/utils/getConfig.d.ts +0 -5
- package/dist/lib/utils/getConfig.js +42 -19
- package/dist/lib/utils/index.d.ts +7 -0
- package/dist/lib/utils/index.js +8 -1
- package/dist/lib/utils/removalPolicy.d.ts +2 -0
- package/dist/lib/utils/removalPolicy.js +16 -0
- package/dist/lib/utils/standardTagsAspect.d.ts +4 -0
- package/dist/lib/utils/standardTagsAspect.js +8 -8
- package/dist/lib/utils/vpcUtils.d.ts +14 -0
- package/dist/lib/utils/vpcUtils.js +28 -0
- package/package.json +7 -6
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Connections, type IVpc, type UserData, type IMachineImage, type ISecurityGroup } from "aws-cdk-lib/aws-ec2";
|
|
4
|
-
import { Code, Runtime, type Architecture, type FunctionUrlAuthType, type FunctionUrlCorsOptions, type IFunction, type InvokeMode } from "aws-cdk-lib/aws-lambda";
|
|
5
|
-
import { type PolicyStatement, type PolicyDocument, type IManagedPolicy, type IGrantable, Grant } from "aws-cdk-lib/aws-iam";
|
|
6
|
-
import { type IApplicationLoadBalancer, type ApplicationListener } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
7
|
-
import { type IAutoScalingGroup } from "aws-cdk-lib/aws-autoscaling";
|
|
8
|
-
import { Construct } from "constructs";
|
|
1
|
+
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import { type Construct } from "constructs";
|
|
9
3
|
import { type IEcsCompute, type ILambdaCompute, type IEc2Compute, type AnyCompute, isCompute, isEcsCompute, isLambdaCompute, isEc2Compute } from "./interfaces/compute.js";
|
|
10
|
-
import { type ConnectionSpec } from "./interfaces/connector.js";
|
|
11
4
|
import type App from "../../app";
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
5
|
+
import { EcsCompute, type EcsComputeProps, type EcsServiceConfig, type EcsContainerConfig, type EcsScalingConfig, type EcsClusterConfig, type EcsRoutingConfig, type EcsCapacityProviderConfig, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, type EcsCapacityProvider, type Ec2CapacityConfig, validateEcsProps, buildContainerConfigs, type ResolvedScalingConfig, resolveScalingConfig } from "./computeEcs.js";
|
|
6
|
+
import { LambdaCompute, type LambdaComputeProps, type ContainerLambdaProps, type CodeLambdaProps, type FunctionUrlConfig, type ResolvedLambdaDeployment, resolveLambdaDeployment, Architecture, HttpMethod, InvokeMode, type FunctionUrlCorsOptions } from "./computeLambda.js";
|
|
7
|
+
import { Ec2Compute, type Ec2ComputeProps, type SshConfig } from "./computeEc2.js";
|
|
8
|
+
export { EcsCompute, type EcsComputeProps, type EcsServiceConfig, type EcsContainerConfig, type EcsScalingConfig, type EcsClusterConfig, type EcsRoutingConfig, type EcsCapacityProviderConfig, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, type EcsCapacityProvider, type Ec2CapacityConfig, validateEcsProps, buildContainerConfigs, type ResolvedScalingConfig, resolveScalingConfig, LambdaCompute, type LambdaComputeProps, type ContainerLambdaProps, type CodeLambdaProps, type FunctionUrlConfig, type ResolvedLambdaDeployment, resolveLambdaDeployment, Architecture, HttpMethod, InvokeMode, type FunctionUrlCorsOptions, Ec2Compute, type Ec2ComputeProps, type SshConfig };
|
|
16
9
|
export type ComputeType = "ecs" | "ec2" | "lambda";
|
|
17
|
-
export { ScalingType };
|
|
18
|
-
export type { EcsCapacityProvider, Ec2CapacityConfig };
|
|
19
10
|
/**
|
|
20
11
|
* Configuration defaults for each compute type.
|
|
21
12
|
*/
|
|
@@ -27,29 +18,17 @@ export interface ComputeTypeConfig {
|
|
|
27
18
|
minCapacity: number;
|
|
28
19
|
maxCapacity: number;
|
|
29
20
|
};
|
|
30
|
-
/** Whether this compute type supports security group connections */
|
|
31
|
-
supportsConnections: boolean;
|
|
32
21
|
/** Whether this compute type requires a VPC */
|
|
33
22
|
requiresVpc: boolean;
|
|
34
23
|
}
|
|
35
24
|
export declare const COMPUTE_TYPE_CONFIG: Record<ComputeType, ComputeTypeConfig>;
|
|
36
|
-
/**
|
|
37
|
-
* Configuration for ECS capacity providers.
|
|
38
|
-
*/
|
|
39
|
-
export interface EcsCapacityProviderConfig {
|
|
40
|
-
/** Whether this uses Spot pricing */
|
|
41
|
-
usesSpot: boolean;
|
|
42
|
-
/** Whether this runs on EC2 instances (vs serverless Fargate) */
|
|
43
|
-
usesEc2Instances: boolean;
|
|
44
|
-
}
|
|
45
|
-
export declare const ECS_CAPACITY_PROVIDER_CONFIG: Record<EcsCapacityProvider, EcsCapacityProviderConfig>;
|
|
46
25
|
/**
|
|
47
26
|
* Default values for compute resource configuration.
|
|
48
27
|
* Centralised constants to ensure consistency across the codebase.
|
|
49
28
|
*/
|
|
50
29
|
export declare const COMPUTE_DEFAULTS: {
|
|
51
30
|
readonly EC2: {
|
|
52
|
-
readonly INSTANCE_TYPE: "
|
|
31
|
+
readonly INSTANCE_TYPE: "t4g.micro";
|
|
53
32
|
readonly MIN_CAPACITY: 1;
|
|
54
33
|
readonly MAX_CAPACITY: 1;
|
|
55
34
|
};
|
|
@@ -62,618 +41,14 @@ export declare const COMPUTE_DEFAULTS: {
|
|
|
62
41
|
readonly LAMBDA: {
|
|
63
42
|
readonly HANDLER: "index.handler";
|
|
64
43
|
readonly RUNTIME: Runtime;
|
|
44
|
+
readonly ARCHITECTURE: Architecture;
|
|
65
45
|
};
|
|
66
46
|
};
|
|
67
47
|
export declare function getComputeTypeConfig(type: ComputeType): ComputeTypeConfig;
|
|
68
|
-
export declare function getEcsCapacityProviderConfig(provider: EcsCapacityProvider): EcsCapacityProviderConfig;
|
|
69
|
-
export { Architecture, HttpMethod, InvokeMode, type FunctionUrlCorsOptions } from "aws-cdk-lib/aws-lambda";
|
|
70
|
-
/**
|
|
71
|
-
* Configuration for a container in an ECS task.
|
|
72
|
-
*
|
|
73
|
-
* For single-container services, `name` is optional and defaults to `${serviceName}Container`.
|
|
74
|
-
* For multi-container tasks, the first container with a `port` is the **primary container**
|
|
75
|
-
* that receives load balancer traffic.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* // Single container (name auto-generated)
|
|
79
|
-
* containers: [{ port: 3000 }]
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* // Multi-container with sidecars
|
|
83
|
-
* containers: [
|
|
84
|
-
* { name: "app", port: 3000 }, // Primary - receives ALB traffic
|
|
85
|
-
* { name: "datadog", image: "datadog/agent" } // Sidecar - monitoring
|
|
86
|
-
* ]
|
|
87
|
-
*/
|
|
88
|
-
export interface EcsContainerConfig {
|
|
89
|
-
/** Container name. Optional for single-container services. */
|
|
90
|
-
name?: string;
|
|
91
|
-
/**
|
|
92
|
-
* Container image. Options:
|
|
93
|
-
* - Omit: Uses app's default ECR repository (primary container only)
|
|
94
|
-
* - string: ECR repository name or public image URL
|
|
95
|
-
* - Repository: CDK ECR Repository construct
|
|
96
|
-
*/
|
|
97
|
-
image?: string | Repository;
|
|
98
|
-
/**
|
|
99
|
-
* Port the container listens on.
|
|
100
|
-
* The first container with a port becomes the **primary container**
|
|
101
|
-
* and is registered with the load balancer.
|
|
102
|
-
*/
|
|
103
|
-
port?: number;
|
|
104
|
-
/** Environment variables */
|
|
105
|
-
environment?: Record<string, string>;
|
|
106
|
-
/**
|
|
107
|
-
* Secrets from AWS SSM Parameter Store.
|
|
108
|
-
* Array of secret names that will be fetched from the service's SSM namespace.
|
|
109
|
-
* The namespace path is auto-determined from app/cluster/service names.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* // Secrets at /myapp/api-cluster/users/API_KEY and /myapp/api-cluster/users/DB_PASSWORD
|
|
113
|
-
* secrets: ["API_KEY", "DB_PASSWORD"]
|
|
114
|
-
*/
|
|
115
|
-
secrets?: string[];
|
|
116
|
-
/** Secrets imported from other CDK resources (AWS Secrets Manager) */
|
|
117
|
-
secretsImport?: Record<string, SecretImport>;
|
|
118
|
-
/** Command to run in the container */
|
|
119
|
-
command?: string[];
|
|
120
|
-
/** Entry point for the container */
|
|
121
|
-
entryPoint?: string[];
|
|
122
|
-
/**
|
|
123
|
-
* Whether this container is essential.
|
|
124
|
-
* If an essential container stops, all containers in the task stop.
|
|
125
|
-
* Default: true
|
|
126
|
-
*/
|
|
127
|
-
essential?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Health check configuration.
|
|
130
|
-
* Default: For primary container with port, uses curl health check.
|
|
131
|
-
*/
|
|
132
|
-
healthCheck?: {
|
|
133
|
-
command: string[];
|
|
134
|
-
interval?: number;
|
|
135
|
-
timeout?: number;
|
|
136
|
-
retries?: number;
|
|
137
|
-
startPeriod?: number;
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* ECS scaling configuration.
|
|
142
|
-
* - Omit: enabled with defaults
|
|
143
|
-
* - `{}`: enabled with defaults
|
|
144
|
-
* - `{ minCapacity: 2, maxCapacity: 10 }`: custom scaling
|
|
145
|
-
* - `false`: explicitly disabled
|
|
146
|
-
*/
|
|
147
|
-
export interface EcsScalingConfig {
|
|
148
|
-
minCapacity?: number;
|
|
149
|
-
maxCapacity?: number;
|
|
150
|
-
scalingType?: ScalingType;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Cluster-level configuration.
|
|
154
|
-
* Controls the shared ALB for all services in this cluster.
|
|
155
|
-
*/
|
|
156
|
-
export interface EcsClusterConfig {
|
|
157
|
-
/**
|
|
158
|
-
* Domain for HTTPS access.
|
|
159
|
-
* - Omit: ALB created with default DNS (*.elb.amazonaws.com)
|
|
160
|
-
* - Specified: Creates ACM certificate + Route53 DNS A record
|
|
161
|
-
*/
|
|
162
|
-
domain?: string;
|
|
163
|
-
/**
|
|
164
|
-
* Load balancer configuration.
|
|
165
|
-
* - Omit or "public": Internet-facing ALB (default)
|
|
166
|
-
* - "internal": VPC-only ALB
|
|
167
|
-
* - false: No ALB (for workers/background processors)
|
|
168
|
-
*/
|
|
169
|
-
loadBalancer?: false | "public" | "internal";
|
|
170
|
-
/**
|
|
171
|
-
* Enable direct EC2 access without ALB.
|
|
172
|
-
* Uses host network mode for predictable ports.
|
|
173
|
-
* Access via EC2 public IP at container port.
|
|
174
|
-
*/
|
|
175
|
-
directAccess?: boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Advanced domain configuration for routing policies (latency, weighted, geo).
|
|
178
|
-
* Only used when domain is specified.
|
|
179
|
-
* Allows for multi-region deployments with advanced DNS routing.
|
|
180
|
-
*/
|
|
181
|
-
domainConfig?: DomainConfig;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Routing configuration for path/host-based routing on the ALB.
|
|
185
|
-
* Required when cluster has multiple services with ports.
|
|
186
|
-
* Optional for single service (gets all traffic automatically).
|
|
187
|
-
*/
|
|
188
|
-
export interface EcsRoutingConfig {
|
|
189
|
-
/**
|
|
190
|
-
* Path pattern for routing (e.g., "/api/*", "/users/*").
|
|
191
|
-
* Uses ALB path-based routing.
|
|
192
|
-
*/
|
|
193
|
-
path?: string;
|
|
194
|
-
/**
|
|
195
|
-
* Host header for routing (e.g., "api.example.com").
|
|
196
|
-
* Uses ALB host-based routing.
|
|
197
|
-
*/
|
|
198
|
-
host?: string;
|
|
199
|
-
/**
|
|
200
|
-
* Priority for this routing rule (1-50000).
|
|
201
|
-
* Lower number = higher priority.
|
|
202
|
-
* Auto-assigned if omitted.
|
|
203
|
-
*/
|
|
204
|
-
priority?: number;
|
|
205
|
-
/**
|
|
206
|
-
* Health check path for this service's target group.
|
|
207
|
-
* Default: "/"
|
|
208
|
-
*/
|
|
209
|
-
healthCheckPath?: string;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Configuration for a service in an ECS cluster.
|
|
213
|
-
* Each service gets its own task definition, scaling config, and target group.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* // Simple service
|
|
217
|
-
* { name: "api", containers: [{ port: 3000 }] }
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* // Service with routing (for multi-service clusters)
|
|
221
|
-
* { name: "users", containers: [{ port: 3000 }], routing: { path: "/users/*", priority: 100 } }
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
* // Service with multiple routing rules (same target group)
|
|
225
|
-
* { name: "web", containers: [{ port: 3000 }], routing: [
|
|
226
|
-
* { path: "/api/v2/*", priority: 50 },
|
|
227
|
-
* { path: "/*", priority: 200 },
|
|
228
|
-
* ]}
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* // Service with sidecars
|
|
232
|
-
* {
|
|
233
|
-
* name: "api",
|
|
234
|
-
* containers: [
|
|
235
|
-
* { name: "app", port: 3000 },
|
|
236
|
-
* { name: "datadog", image: "datadog/agent" }
|
|
237
|
-
* ]
|
|
238
|
-
* }
|
|
239
|
-
*/
|
|
240
|
-
export interface EcsServiceConfig {
|
|
241
|
-
/** Service name (unique within cluster) */
|
|
242
|
-
name: string;
|
|
243
|
-
/**
|
|
244
|
-
* Container image for this service (applies to first container without explicit image).
|
|
245
|
-
* - Omit: Uses app's default ECR repository
|
|
246
|
-
* - string: ECR repository name or public image URL
|
|
247
|
-
* - Repository: CDK ECR Repository construct
|
|
248
|
-
*/
|
|
249
|
-
image?: string | Repository;
|
|
250
|
-
/**
|
|
251
|
-
* Container configuration(s) for this service.
|
|
252
|
-
* For single-container services, container name is optional and auto-generated.
|
|
253
|
-
* For multi-container services, the first container with a port is the primary container.
|
|
254
|
-
*/
|
|
255
|
-
containers?: EcsContainerConfig[];
|
|
256
|
-
/**
|
|
257
|
-
* Routing rules for this service on the cluster's ALB.
|
|
258
|
-
* Required when cluster has multiple services with ports.
|
|
259
|
-
* Optional for single service (gets /* automatically).
|
|
260
|
-
* Can be a single rule or an array of rules pointing to the same target group.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* // Multiple routes for the same service
|
|
264
|
-
* routing: [
|
|
265
|
-
* { path: "/api/v2/*", priority: 50 },
|
|
266
|
-
* { path: "/*", priority: 200 },
|
|
267
|
-
* ]
|
|
268
|
-
*/
|
|
269
|
-
routing?: EcsRoutingConfig | EcsRoutingConfig[];
|
|
270
|
-
/** CPU units for this service's tasks (256-4096) */
|
|
271
|
-
cpu?: number;
|
|
272
|
-
/** Memory in MiB for this service's tasks (512-30720) */
|
|
273
|
-
memoryLimitMiB?: number;
|
|
274
|
-
/** Desired number of tasks. Default: 2 */
|
|
275
|
-
desiredCount?: number;
|
|
276
|
-
/**
|
|
277
|
-
* Scaling configuration.
|
|
278
|
-
* - Omit: enabled with defaults
|
|
279
|
-
* - false: disabled
|
|
280
|
-
*/
|
|
281
|
-
scaling?: EcsScalingConfig | false;
|
|
282
|
-
/**
|
|
283
|
-
* Path to Dockerfile for building this service's image.
|
|
284
|
-
* Metadata for CLI build process, not used during CDK synthesis.
|
|
285
|
-
*/
|
|
286
|
-
dockerfilePath?: string;
|
|
287
|
-
/**
|
|
288
|
-
* Docker build target stage for multi-stage Dockerfiles.
|
|
289
|
-
* When specified, the CLI builds with `--target <dockerTarget>`.
|
|
290
|
-
* The image tag suffix is also updated: `<service>-<target>-latest`.
|
|
291
|
-
*
|
|
292
|
-
* @example
|
|
293
|
-
* // Dockerfile: FROM node AS base ... FROM base AS api ... FROM base AS worker
|
|
294
|
-
* { name: "api", dockerTarget: "api" } // builds: myapp-api-api-latest
|
|
295
|
-
* { name: "worker", dockerTarget: "worker" } // builds: myapp-worker-worker-latest
|
|
296
|
-
*/
|
|
297
|
-
dockerTarget?: string;
|
|
298
|
-
/**
|
|
299
|
-
* Additional inline policies for this service's task role.
|
|
300
|
-
* Added on top of the default ECS Exec permissions.
|
|
301
|
-
* Use for service-specific AWS permissions (S3, DynamoDB, SQS, etc.).
|
|
302
|
-
*/
|
|
303
|
-
taskRoleInlinePolicies?: Record<string, PolicyDocument>;
|
|
304
|
-
/**
|
|
305
|
-
* Additional managed policies for this service's task role.
|
|
306
|
-
* Added on top of the default ECS Exec permissions.
|
|
307
|
-
*/
|
|
308
|
-
taskRoleManagedPolicies?: IManagedPolicy[];
|
|
309
|
-
/**
|
|
310
|
-
* Resources this service needs to connect to (e.g., databases, S3 buckets, SQS queues).
|
|
311
|
-
* Creates security group rules for IConnectable resources and IAM grants for IAM resources.
|
|
312
|
-
* Follows least-privilege - only this service gets access, not all services in the cluster.
|
|
313
|
-
*
|
|
314
|
-
* Supports:
|
|
315
|
-
* - IConnectable: Security group resources (RDS, ECS, etc.)
|
|
316
|
-
* - IStorageConnector: S3 buckets (IAM grants)
|
|
317
|
-
* - IDynamoDBConnector: DynamoDB tables (IAM grants)
|
|
318
|
-
* - IQueueConnector: SQS queues (IAM grants)
|
|
319
|
-
* - ConnectionConfig: Explicit access level configuration
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* // Simple connections (default permissions)
|
|
323
|
-
* connections: [database, bucket, cache, queue]
|
|
324
|
-
*
|
|
325
|
-
* @example
|
|
326
|
-
* // Explicit access levels
|
|
327
|
-
* connections: [
|
|
328
|
-
* database, // Security group (RDS)
|
|
329
|
-
* { resource: cache, access: "read" }, // Read-only DynamoDB
|
|
330
|
-
* { resource: bucket, access: "write" }, // Write-only S3
|
|
331
|
-
* { resource: queue, access: "consume" } // Consume-only SQS
|
|
332
|
-
* ]
|
|
333
|
-
*/
|
|
334
|
-
connections?: ConnectionSpec[];
|
|
335
|
-
/**
|
|
336
|
-
* Capacity provider for this service. REQUIRED.
|
|
337
|
-
* Each service specifies its own capacity provider.
|
|
338
|
-
*
|
|
339
|
-
* @example
|
|
340
|
-
* // Mixed FARGATE and EC2 services in same cluster
|
|
341
|
-
* {
|
|
342
|
-
* services: [
|
|
343
|
-
* { name: "api", capacityProvider: "FARGATE" },
|
|
344
|
-
* { name: "worker", capacityProvider: "EC2", ec2Config: { instanceType: "t3.micro" } }
|
|
345
|
-
* ]
|
|
346
|
-
* }
|
|
347
|
-
*/
|
|
348
|
-
capacityProvider: EcsCapacityProvider;
|
|
349
|
-
/**
|
|
350
|
-
* EC2 capacity configuration for this service.
|
|
351
|
-
* Only used when service capacityProvider is "EC2".
|
|
352
|
-
* Services with matching ec2Config share an ASG for efficiency.
|
|
353
|
-
*/
|
|
354
|
-
ec2Config?: Ec2CapacityConfig;
|
|
355
|
-
/**
|
|
356
|
-
* SSM Parameter Store path for secrets.
|
|
357
|
-
* If not specified, secrets are fetched from /<app>/<cluster>/<service>.
|
|
358
|
-
* Use this to override the default convention.
|
|
359
|
-
*
|
|
360
|
-
* @example
|
|
361
|
-
* // Override default path
|
|
362
|
-
* ssmSecretsPath: "/custom/path/to/secrets"
|
|
363
|
-
*/
|
|
364
|
-
ssmSecretsPath?: string;
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* SSH access configuration for EC2 instances.
|
|
368
|
-
* - Omit: disabled (default)
|
|
369
|
-
* - `{}`: enabled with auto-generated key
|
|
370
|
-
* - `{ keyName: "my-key" }`: enabled with existing key
|
|
371
|
-
* - `false`: explicitly disabled
|
|
372
|
-
*/
|
|
373
|
-
export interface SshConfig {
|
|
374
|
-
/** SSH key pair name */
|
|
375
|
-
keyName?: string;
|
|
376
|
-
/** Allowed CIDR blocks for SSH access */
|
|
377
|
-
allowedCidrs?: string[];
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Lambda function URL configuration.
|
|
381
|
-
* - Omit: disabled (default)
|
|
382
|
-
* - `{}`: enabled with IAM auth
|
|
383
|
-
* - `{ authType: "NONE", cors: {...} }`: public with CORS
|
|
384
|
-
* - `false`: explicitly disabled
|
|
385
|
-
*/
|
|
386
|
-
export interface FunctionUrlConfig {
|
|
387
|
-
/** Authentication type. Default: AWS_IAM */
|
|
388
|
-
authType?: FunctionUrlAuthType;
|
|
389
|
-
/** CORS configuration */
|
|
390
|
-
cors?: FunctionUrlCorsOptions;
|
|
391
|
-
/** Invoke mode. Use RESPONSE_STREAM for Lambda streaming. Default: BUFFERED */
|
|
392
|
-
invokeMode?: InvokeMode;
|
|
393
|
-
}
|
|
394
|
-
interface BaseComputeProps {
|
|
395
|
-
vpc?: IVpc;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* ECS compute configuration.
|
|
399
|
-
* Creates an ECS cluster with one or more services sharing a load balancer.
|
|
400
|
-
*
|
|
401
|
-
* @example
|
|
402
|
-
* // Single service
|
|
403
|
-
* app.addCompute(ComputeFactory.build("WebApp", {
|
|
404
|
-
* type: "ecs",
|
|
405
|
-
* cluster: { domain: "app.example.com" },
|
|
406
|
-
* services: [{ name: "web", containers: [{ port: 3000 }] }]
|
|
407
|
-
* }));
|
|
408
|
-
*
|
|
409
|
-
* @example
|
|
410
|
-
* // Multi-service cluster with routing
|
|
411
|
-
* app.addCompute(ComputeFactory.build("ApiCluster", {
|
|
412
|
-
* type: "ecs",
|
|
413
|
-
* cluster: { domain: "api.example.com" },
|
|
414
|
-
* services: [
|
|
415
|
-
* { name: "users", containers: [{ port: 3000 }], routing: { path: "/users/*" } },
|
|
416
|
-
* { name: "orders", containers: [{ port: 3001 }], routing: { path: "/orders/*" } }
|
|
417
|
-
* ]
|
|
418
|
-
* }));
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
* // Internal workers (no ALB)
|
|
422
|
-
* app.addCompute(ComputeFactory.build("Workers", {
|
|
423
|
-
* type: "ecs",
|
|
424
|
-
* cluster: { loadBalancer: false },
|
|
425
|
-
* services: [{ name: "processor" }, { name: "emailer" }]
|
|
426
|
-
* }));
|
|
427
|
-
*/
|
|
428
|
-
export interface EcsComputeProps extends BaseComputeProps {
|
|
429
|
-
type: "ecs";
|
|
430
|
-
/**
|
|
431
|
-
* Application name for SSM secrets namespace.
|
|
432
|
-
* When containers use secrets, the path is derived as: /<appName>/<clusterName>/<serviceName>
|
|
433
|
-
* Auto-derived from App.getName() if not specified.
|
|
434
|
-
*/
|
|
435
|
-
appName?: string;
|
|
436
|
-
/**
|
|
437
|
-
* Cluster configuration.
|
|
438
|
-
* Controls the shared ALB for all services in this cluster.
|
|
439
|
-
* - Omit: ALB created with default settings
|
|
440
|
-
* - `{ domain: "..." }`: ALB with HTTPS + DNS
|
|
441
|
-
* - `{ loadBalancer: false }`: No ALB (internal workers)
|
|
442
|
-
*/
|
|
443
|
-
cluster?: EcsClusterConfig;
|
|
444
|
-
/**
|
|
445
|
-
* Services in this cluster.
|
|
446
|
-
* Each service gets its own task definition, scaling, and target group.
|
|
447
|
-
* Each service MUST specify its own capacityProvider.
|
|
448
|
-
* All services share the cluster's ALB (unless disabled).
|
|
449
|
-
*/
|
|
450
|
-
services: EcsServiceConfig[];
|
|
451
|
-
/**
|
|
452
|
-
* ECR repository for all services (default image).
|
|
453
|
-
* Individual services can override with their own `image` property.
|
|
454
|
-
*/
|
|
455
|
-
ecrRepository?: Repository | RepositoryImage;
|
|
456
|
-
/**
|
|
457
|
-
* Path to Dockerfile for building custom image.
|
|
458
|
-
* Note: This is metadata for the CLI build process,
|
|
459
|
-
* not used during CDK synthesis.
|
|
460
|
-
*/
|
|
461
|
-
dockerfilePath?: string;
|
|
462
|
-
}
|
|
463
|
-
export interface Ec2ComputeProps extends BaseComputeProps {
|
|
464
|
-
type: "ec2";
|
|
465
|
-
/** EC2 instance type. Default: "t3.micro" */
|
|
466
|
-
instanceType?: string;
|
|
467
|
-
/**
|
|
468
|
-
* SSH access configuration.
|
|
469
|
-
* - Omit: disabled (default)
|
|
470
|
-
* - `{}`: enabled with defaults
|
|
471
|
-
* - `false`: explicitly disabled
|
|
472
|
-
*/
|
|
473
|
-
ssh?: SshConfig | false;
|
|
474
|
-
/** User data script */
|
|
475
|
-
userData?: UserData;
|
|
476
|
-
/** Machine image (AMI) */
|
|
477
|
-
machineImage?: IMachineImage;
|
|
478
|
-
/** Minimum number of instances. Default: 1 */
|
|
479
|
-
minCapacity?: number;
|
|
480
|
-
/** Maximum number of instances. Default: 1 */
|
|
481
|
-
maxCapacity?: number;
|
|
482
|
-
/**
|
|
483
|
-
* Percentage of capacity to run on Spot instances (0-100).
|
|
484
|
-
* - Omit or 0: All On-Demand instances (default)
|
|
485
|
-
* - 100: All Spot instances
|
|
486
|
-
* - 50: Half Spot, half On-Demand
|
|
487
|
-
*
|
|
488
|
-
* Spot instances can reduce costs by up to 90% but may be interrupted.
|
|
489
|
-
* Use for fault-tolerant workloads.
|
|
490
|
-
*/
|
|
491
|
-
spotCapacityPercentage?: number;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Base Lambda configuration shared by both container and code deployments.
|
|
495
|
-
*/
|
|
496
|
-
interface BaseLambdaProps extends BaseComputeProps {
|
|
497
|
-
type: "lambda";
|
|
498
|
-
/** Timeout in seconds. Default: 3 */
|
|
499
|
-
timeout?: number;
|
|
500
|
-
/** Memory size in MB. Default: 128 */
|
|
501
|
-
memorySize?: number;
|
|
502
|
-
ephemeralStorageSize?: number;
|
|
503
|
-
/** CPU architecture. Default: x86_64. Use Architecture.ARM_64 for Graviton2. */
|
|
504
|
-
architecture?: Architecture;
|
|
505
|
-
/** Lambda function description */
|
|
506
|
-
description?: string;
|
|
507
|
-
/** IAM role description */
|
|
508
|
-
roleDescription?: string;
|
|
509
|
-
/** Inline IAM policy statements */
|
|
510
|
-
inlinePolicy?: PolicyStatement[];
|
|
511
|
-
/**
|
|
512
|
-
* Function URL configuration.
|
|
513
|
-
* - Omit: disabled (default)
|
|
514
|
-
* - `{}`: enabled with IAM auth
|
|
515
|
-
* - `{ authType: "NONE" }`: public access
|
|
516
|
-
* - `false`: explicitly disabled
|
|
517
|
-
*/
|
|
518
|
-
functionUrl?: FunctionUrlConfig | false;
|
|
519
|
-
/** Environment variables */
|
|
520
|
-
environment?: Record<string, string>;
|
|
521
|
-
/**
|
|
522
|
-
* Secrets from AWS SSM Parameter Store.
|
|
523
|
-
* Array of secret names that will be fetched from the Lambda's SSM namespace.
|
|
524
|
-
* The namespace path is auto-determined as: /<appName>/lambda/<functionName>
|
|
525
|
-
*
|
|
526
|
-
* @example
|
|
527
|
-
* secrets: ["API_KEY", "STRIPE_SECRET"]
|
|
528
|
-
*/
|
|
529
|
-
secrets?: string[];
|
|
530
|
-
/**
|
|
531
|
-
* SSM Parameter Store path for secrets.
|
|
532
|
-
* If secrets are defined, this path is used as the base path.
|
|
533
|
-
* If not specified, uses: /<appName>/lambda/<functionName>
|
|
534
|
-
*
|
|
535
|
-
* @example
|
|
536
|
-
* ssmSecretsPath: "/myapp/custom/path"
|
|
537
|
-
*/
|
|
538
|
-
ssmSecretsPath?: string;
|
|
539
|
-
/**
|
|
540
|
-
* Secrets imported from other CDK resources (AWS Secrets Manager).
|
|
541
|
-
* Used for CDK-managed secrets like database credentials.
|
|
542
|
-
*
|
|
543
|
-
* @example
|
|
544
|
-
* secretsImport: {
|
|
545
|
-
* DATABASE_USERNAME: database.getCredentials().getImport("username"),
|
|
546
|
-
* DATABASE_PASSWORD: database.getCredentials().getImport("password")
|
|
547
|
-
* }
|
|
548
|
-
*/
|
|
549
|
-
secretsImport?: Record<string, SecretImport>;
|
|
550
|
-
/**
|
|
551
|
-
* Application name for SSM secrets path derivation.
|
|
552
|
-
* Auto-derived from App instance when using ComputeFactory.
|
|
553
|
-
* Only specify for advanced use cases.
|
|
554
|
-
*/
|
|
555
|
-
appName?: string;
|
|
556
|
-
/**
|
|
557
|
-
* Resources this Lambda needs to connect to (e.g., databases, S3 buckets, SQS queues).
|
|
558
|
-
* Creates security group rules for IConnectable resources and IAM grants for IAM resources.
|
|
559
|
-
*
|
|
560
|
-
* Supports:
|
|
561
|
-
* - IConnectable: Security group resources (RDS, ECS, etc.)
|
|
562
|
-
* - IStorageConnector: S3 buckets (IAM grants)
|
|
563
|
-
* - IDynamoDBConnector: DynamoDB tables (IAM grants)
|
|
564
|
-
* - IQueueConnector: SQS queues (IAM grants)
|
|
565
|
-
* - ConnectionConfig: Explicit access level configuration
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* connections: [
|
|
569
|
-
* database,
|
|
570
|
-
* { resource: queue, access: "send" }
|
|
571
|
-
* ]
|
|
572
|
-
*/
|
|
573
|
-
connections?: ConnectionSpec[];
|
|
574
|
-
/**
|
|
575
|
-
* EventBridge schedule expression for scheduled Lambda invocations.
|
|
576
|
-
* Uses cron or rate syntax: "rate(1 hour)" or "cron(0 12 * * ? *)".
|
|
577
|
-
*/
|
|
578
|
-
scheduleExpression?: string;
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Container-based Lambda using ECR image.
|
|
582
|
-
*
|
|
583
|
-
* Uses Docker image from ECR repository. Handler and runtime are
|
|
584
|
-
* automatically set to FROM_IMAGE.
|
|
585
|
-
*
|
|
586
|
-
* @example
|
|
587
|
-
* app.addCompute(ComputeFactory.build("ImageLambda", {
|
|
588
|
-
* type: "lambda",
|
|
589
|
-
* deployment: "container",
|
|
590
|
-
* ecrRepository: app.getDefaultContainerRegistry()
|
|
591
|
-
* }));
|
|
592
|
-
*/
|
|
593
|
-
export interface ContainerLambdaProps extends BaseLambdaProps {
|
|
594
|
-
/** Container-based deployment using ECR image */
|
|
595
|
-
deployment: "container";
|
|
596
|
-
/** ECR repository containing the Lambda container image */
|
|
597
|
-
ecrRepository: Repository | RepositoryImage;
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Code-based Lambda using inline code or S3.
|
|
601
|
-
*
|
|
602
|
-
* Uses traditional Lambda deployment with code, handler, and runtime.
|
|
603
|
-
*
|
|
604
|
-
* @example
|
|
605
|
-
* app.addCompute(ComputeFactory.build("CodeLambda", {
|
|
606
|
-
* type: "lambda",
|
|
607
|
-
* deployment: "code",
|
|
608
|
-
* code: Code.fromAsset("./lambda"),
|
|
609
|
-
* handler: "index.handler",
|
|
610
|
-
* runtime: Runtime.NODEJS_20_X
|
|
611
|
-
* }));
|
|
612
|
-
*/
|
|
613
|
-
export interface CodeLambdaProps extends BaseLambdaProps {
|
|
614
|
-
/** Code-based deployment */
|
|
615
|
-
deployment: "code";
|
|
616
|
-
/** Lambda code (from asset, S3, or inline) */
|
|
617
|
-
code: Code;
|
|
618
|
-
/** Handler function. Default: "index.handler" */
|
|
619
|
-
handler?: string;
|
|
620
|
-
/** Lambda runtime. Default: NODEJS_22_X */
|
|
621
|
-
runtime?: Runtime;
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Lambda compute configuration.
|
|
625
|
-
*
|
|
626
|
-
* Discriminated union ensuring type-safe Lambda configuration:
|
|
627
|
-
* - `deployment: "container"` requires `ecrRepository`
|
|
628
|
-
* - `deployment: "code"` requires `code` and allows `handler`/`runtime`
|
|
629
|
-
*
|
|
630
|
-
* @example
|
|
631
|
-
* // Container-based Lambda
|
|
632
|
-
* { type: "lambda", deployment: "container", ecrRepository: ecr }
|
|
633
|
-
*
|
|
634
|
-
* @example
|
|
635
|
-
* // Code-based Lambda
|
|
636
|
-
* { type: "lambda", deployment: "code", code: Code.fromAsset("./lambda") }
|
|
637
|
-
*/
|
|
638
|
-
export type LambdaComputeProps = ContainerLambdaProps | CodeLambdaProps;
|
|
639
48
|
export type IEcsComputeProps = EcsComputeProps;
|
|
640
49
|
export type ILambdaComputeProps = LambdaComputeProps;
|
|
641
50
|
export type IEc2ComputeProps = Ec2ComputeProps;
|
|
642
51
|
export type IComputeProps = IEcsComputeProps | ILambdaComputeProps | IEc2ComputeProps;
|
|
643
|
-
/**
|
|
644
|
-
* Build container configurations for an ECS service.
|
|
645
|
-
* Converts user-facing EcsContainerConfig to internal EcsClusterProps format.
|
|
646
|
-
* @internal Exported for testing only
|
|
647
|
-
*/
|
|
648
|
-
export declare function buildContainerConfigs(service: EcsServiceConfig): EcsClusterProps["services"][number]["containers"];
|
|
649
|
-
/**
|
|
650
|
-
* Resolved scaling configuration for an ECS service.
|
|
651
|
-
* @internal Exported for testing only
|
|
652
|
-
*/
|
|
653
|
-
export interface ResolvedScalingConfig {
|
|
654
|
-
scalingType: ScalingType | undefined;
|
|
655
|
-
minCapacity: number | undefined;
|
|
656
|
-
maxCapacity: number | undefined;
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Resolve scaling configuration from service props.
|
|
660
|
-
* Handles the three cases: explicit config, disabled (false), or default (undefined).
|
|
661
|
-
* @internal Exported for testing only
|
|
662
|
-
*/
|
|
663
|
-
export declare function resolveScalingConfig(scaling: EcsScalingConfig | false | undefined): ResolvedScalingConfig;
|
|
664
|
-
/**
|
|
665
|
-
* Resolved Lambda deployment configuration.
|
|
666
|
-
*/
|
|
667
|
-
export interface ResolvedLambdaDeployment {
|
|
668
|
-
code: Code;
|
|
669
|
-
handler: string;
|
|
670
|
-
runtime: Runtime;
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Resolve Lambda deployment configuration from props.
|
|
674
|
-
* Handles container vs code deployment types.
|
|
675
|
-
*/
|
|
676
|
-
export declare function resolveLambdaDeployment(props: ILambdaComputeProps): ResolvedLambdaDeployment;
|
|
677
52
|
/**
|
|
678
53
|
* Factory for creating compute resources with type-safe return types.
|
|
679
54
|
*
|
|
@@ -702,7 +77,7 @@ export declare function resolveLambdaDeployment(props: ILambdaComputeProps): Res
|
|
|
702
77
|
* // EC2 compute - returns Ec2Compute with EC2-specific methods
|
|
703
78
|
* const ec2 = app.addCompute(ComputeFactory.build("Instance", {
|
|
704
79
|
* type: "ec2",
|
|
705
|
-
* instanceType: "
|
|
80
|
+
* instanceType: "t4g.micro"
|
|
706
81
|
* }));
|
|
707
82
|
* ec2.getAutoScalingGroup(); // Available on Ec2Compute
|
|
708
83
|
*/
|
|
@@ -711,91 +86,5 @@ export declare class ComputeFactory {
|
|
|
711
86
|
static build(id: string, props: ILambdaComputeProps): (app: App, scope: Construct) => LambdaCompute;
|
|
712
87
|
static build(id: string, props: IEc2ComputeProps): (app: App, scope: Construct) => Ec2Compute;
|
|
713
88
|
}
|
|
714
|
-
/**
|
|
715
|
-
* ECS compute wrapper implementing IEcsCompute.
|
|
716
|
-
* Provides type-safe access to ECS-specific resources.
|
|
717
|
-
*/
|
|
718
|
-
export declare class EcsCompute extends Construct implements IEcsCompute {
|
|
719
|
-
readonly computeType: "ecs";
|
|
720
|
-
readonly connections: Connections;
|
|
721
|
-
private readonly ecsCluster;
|
|
722
|
-
constructor(scope: Construct, id: string, props: IEcsComputeProps);
|
|
723
|
-
/** Get the ECS cluster. */
|
|
724
|
-
getCluster(): ICluster;
|
|
725
|
-
/** Get the Application Load Balancer if one was created. */
|
|
726
|
-
getLoadBalancer(): IApplicationLoadBalancer | undefined;
|
|
727
|
-
/** Get a specific service by name. */
|
|
728
|
-
getService(name: string): IBaseService | undefined;
|
|
729
|
-
/** Get all services in the cluster. */
|
|
730
|
-
getAllServices(): IBaseService[];
|
|
731
|
-
/** Get the security group for the cluster. */
|
|
732
|
-
getSecurityGroup(): ISecurityGroup;
|
|
733
|
-
/**
|
|
734
|
-
* Get the ALB listener if this is an ECS compute with ALB.
|
|
735
|
-
*/
|
|
736
|
-
getListener(): ApplicationListener | undefined;
|
|
737
|
-
/**
|
|
738
|
-
* Get the underlying ECS cluster construct.
|
|
739
|
-
*/
|
|
740
|
-
getEcsCluster(): EcsCluster;
|
|
741
|
-
/**
|
|
742
|
-
* Grants ecs:ExecuteCommand permission for ECS services.
|
|
743
|
-
* Uses wildcard resource because ecs:ExecuteCommand targets task ARNs
|
|
744
|
-
* which are not known until runtime (tasks are ephemeral).
|
|
745
|
-
*/
|
|
746
|
-
grantExecuteCommand(grantee: IGrantable): Grant;
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Lambda compute wrapper implementing ILambdaCompute.
|
|
750
|
-
* Provides type-safe access to Lambda-specific resources.
|
|
751
|
-
*/
|
|
752
|
-
export declare class LambdaCompute extends Construct implements ILambdaCompute {
|
|
753
|
-
readonly computeType: "lambda";
|
|
754
|
-
readonly connections: Connections;
|
|
755
|
-
private readonly lambdaFunction;
|
|
756
|
-
constructor(scope: Construct, id: string, props: ILambdaComputeProps);
|
|
757
|
-
/**
|
|
758
|
-
* Get a Lambda function by name.
|
|
759
|
-
* Since we only have one function, name is ignored.
|
|
760
|
-
*/
|
|
761
|
-
getFunction(_name?: string): IFunction | undefined;
|
|
762
|
-
/** Get all Lambda functions. */
|
|
763
|
-
getAllFunctions(): IFunction[];
|
|
764
|
-
/**
|
|
765
|
-
* Get the function URL for a Lambda function.
|
|
766
|
-
*/
|
|
767
|
-
getFunctionUrl(_name?: string): string | undefined;
|
|
768
|
-
/**
|
|
769
|
-
* Grant invoke permissions to a grantee.
|
|
770
|
-
*/
|
|
771
|
-
grantInvoke(grantee: IGrantable, _functionName?: string): Grant;
|
|
772
|
-
/**
|
|
773
|
-
* Get the security group for VPC-enabled Lambda functions.
|
|
774
|
-
* Returns undefined if the Lambda is not VPC-enabled.
|
|
775
|
-
*/
|
|
776
|
-
getSecurityGroup(): ISecurityGroup | undefined;
|
|
777
|
-
/**
|
|
778
|
-
* Get the underlying Lambda function construct.
|
|
779
|
-
*/
|
|
780
|
-
getLambdaFunction(): LambdaFunction;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* EC2 compute wrapper implementing IEc2Compute.
|
|
784
|
-
* Provides type-safe access to EC2-specific resources.
|
|
785
|
-
*/
|
|
786
|
-
export declare class Ec2Compute extends Construct implements IEc2Compute {
|
|
787
|
-
readonly computeType: "ec2";
|
|
788
|
-
readonly connections: Connections;
|
|
789
|
-
private readonly ec2Instance;
|
|
790
|
-
constructor(scope: Construct, id: string, props: IEc2ComputeProps);
|
|
791
|
-
/** Get the Auto Scaling Group. */
|
|
792
|
-
getAutoScalingGroup(): IAutoScalingGroup;
|
|
793
|
-
/** Get the security group. */
|
|
794
|
-
getSecurityGroup(): ISecurityGroup;
|
|
795
|
-
/**
|
|
796
|
-
* Get the underlying EC2 instance construct.
|
|
797
|
-
*/
|
|
798
|
-
getEc2Instance(): Ec2Instance;
|
|
799
|
-
}
|
|
800
89
|
export { isCompute, isEcsCompute, isLambdaCompute, isEc2Compute };
|
|
801
90
|
export type { IEcsCompute, ILambdaCompute, IEc2Compute, AnyCompute };
|