@fjall/components-infrastructure 0.95.0 → 0.99.1
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/lib/app.d.ts +90 -107
- package/dist/lib/app.js +149 -139
- package/dist/lib/config/aws/__t17fixture.d.ts +1 -0
- package/dist/lib/config/aws/__t17fixture.js +3 -0
- package/dist/lib/config/aws/__t17fixtureType.d.ts +2 -0
- package/dist/lib/config/aws/__t17fixtureType.js +1 -0
- package/dist/lib/config/aws/alarmTopic.js +8 -4
- package/dist/lib/config/aws/cloudTrail.js +1 -1
- package/dist/lib/config/aws/disasterRecovery.js +11 -16
- package/dist/lib/config/aws/ecrDefaultImage.d.ts +0 -1
- package/dist/lib/config/aws/ecrDefaultImage.js +13 -23
- package/dist/lib/config/aws/identityCenter.d.ts +10 -3
- package/dist/lib/config/aws/identityCenter.js +101 -37
- package/dist/lib/config/aws/identityCenterGroupMembership.js +8 -2
- package/dist/lib/config/aws/identityCenterMembership.d.ts +11 -0
- package/dist/lib/config/aws/identityCenterMembership.js +61 -0
- package/dist/lib/config/aws/index.d.ts +1 -1
- package/dist/lib/config/aws/index.js +1 -1
- package/dist/lib/config/aws/ipam.js +6 -11
- package/dist/lib/config/aws/oidcConnector.js +5 -1
- package/dist/lib/config/aws/scpPreset.js +4 -1
- package/dist/lib/patterns/aws/_eslint_test_tmp/leak.d.ts +1 -0
- package/dist/lib/patterns/aws/_eslint_test_tmp/leak.js +4 -0
- package/dist/lib/patterns/aws/account.js +7 -8
- package/dist/lib/patterns/aws/apexDomainPattern.js +10 -10
- package/dist/lib/patterns/aws/bastionFactory.d.ts +10 -0
- package/dist/lib/patterns/aws/bastionFactory.js +29 -0
- package/dist/lib/patterns/aws/buildkite.d.ts +2 -2
- package/dist/lib/patterns/aws/buildkite.js +51 -97
- package/dist/lib/patterns/aws/cdn.js +1 -1
- package/dist/lib/patterns/aws/clickhouseDatabase.d.ts +172 -0
- package/dist/lib/patterns/aws/clickhouseDatabase.js +600 -0
- package/dist/lib/patterns/aws/compute.d.ts +4 -6
- package/dist/lib/patterns/aws/compute.js +7 -13
- package/dist/lib/patterns/aws/computeEcs.d.ts +95 -396
- package/dist/lib/patterns/aws/computeEcs.js +880 -46
- package/dist/lib/patterns/aws/computeEcsTypes.d.ts +889 -0
- package/dist/lib/patterns/aws/computeEcsTypes.js +12 -0
- package/dist/lib/patterns/aws/computeLambda.d.ts +0 -5
- package/dist/lib/patterns/aws/computeLambda.js +1 -2
- package/dist/lib/patterns/aws/database.d.ts +50 -8
- package/dist/lib/patterns/aws/database.js +183 -27
- package/dist/lib/patterns/aws/domain.js +8 -7
- package/dist/lib/patterns/aws/index.d.ts +3 -0
- package/dist/lib/patterns/aws/index.js +3 -0
- package/dist/lib/patterns/aws/interfaces/compute.d.ts +13 -1
- package/dist/lib/patterns/aws/interfaces/connector.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/connector.js +1 -1
- package/dist/lib/patterns/aws/interfaces/database.d.ts +187 -8
- package/dist/lib/patterns/aws/interfaces/database.js +17 -3
- package/dist/lib/patterns/aws/interfaces/index.d.ts +4 -2
- package/dist/lib/patterns/aws/interfaces/index.js +4 -2
- package/dist/lib/patterns/aws/interfaces/messaging.d.ts +7 -0
- package/dist/lib/patterns/aws/interfaces/migrationContributor.d.ts +47 -0
- package/dist/lib/patterns/aws/interfaces/migrationContributor.js +9 -0
- package/dist/lib/patterns/aws/interfaces/vpcPeer.d.ts +7 -0
- package/dist/lib/patterns/aws/interfaces/vpcPeer.js +1 -0
- package/dist/lib/patterns/aws/messaging.d.ts +66 -10
- package/dist/lib/patterns/aws/messaging.js +115 -20
- package/dist/lib/patterns/aws/network.js +16 -7
- package/dist/lib/patterns/aws/organisation.d.ts +4 -0
- package/dist/lib/patterns/aws/organisation.js +24 -5
- package/dist/lib/patterns/aws/storage.d.ts +1 -2
- package/dist/lib/patterns/aws/storage.js +3 -2
- package/dist/lib/patterns/aws/vpcPeer.d.ts +34 -0
- package/dist/lib/patterns/aws/vpcPeer.js +38 -0
- package/dist/lib/patterns/aws/vpcPeerAccepter.d.ts +29 -0
- package/dist/lib/patterns/aws/vpcPeerAccepter.js +196 -0
- package/dist/lib/resources/aws/analytics/clickhouse.js +25 -7
- package/dist/lib/resources/aws/analytics/clickhouseAlarms.d.ts +49 -0
- package/dist/lib/resources/aws/analytics/clickhouseAlarms.js +140 -0
- package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +4 -4
- package/dist/lib/resources/aws/analytics/clickhouseConstants.js +6 -4
- package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +12 -0
- package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +1 -0
- package/dist/lib/resources/aws/analytics/clickhouseUserData.js +56 -5
- package/dist/lib/resources/aws/analytics/index.d.ts +2 -0
- package/dist/lib/resources/aws/analytics/index.js +1 -0
- package/dist/lib/resources/aws/base/awsStack.js +4 -2
- package/dist/lib/resources/aws/compute/__tmp__/regression-shape.d.ts +2 -0
- package/dist/lib/resources/aws/compute/__tmp__/regression-shape.js +11 -0
- package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.d.ts +52 -0
- package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.js +60 -0
- package/dist/lib/resources/aws/compute/blockDeviceVolume.d.ts +8 -0
- package/dist/lib/resources/aws/compute/blockDeviceVolume.js +10 -0
- package/dist/lib/resources/aws/compute/ec2.d.ts +132 -12
- package/dist/lib/resources/aws/compute/ec2.js +163 -23
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.d.ts +41 -0
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.js +194 -0
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationLambda.source.cjs +458 -0
- package/dist/lib/resources/aws/compute/ecs.d.ts +27 -1
- package/dist/lib/resources/aws/compute/ecs.js +42 -2
- package/dist/lib/resources/aws/compute/ecsConstants.d.ts +9 -0
- package/dist/lib/resources/aws/compute/ecsConstants.js +16 -0
- package/dist/lib/resources/aws/compute/ecsImages.js +32 -20
- package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.d.ts +96 -0
- package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.js +113 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +2 -1
- package/dist/lib/resources/aws/compute/ecsNetworking.js +18 -6
- package/dist/lib/resources/aws/compute/ecsRemoteConnections.d.ts +38 -0
- package/dist/lib/resources/aws/compute/ecsRemoteConnections.js +80 -0
- package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +13 -4
- package/dist/lib/resources/aws/compute/ecsServiceFactory.js +155 -33
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +31 -1
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +110 -6
- package/dist/lib/resources/aws/compute/ecsTypes.d.ts +180 -13
- package/dist/lib/resources/aws/compute/ecsValidation.d.ts +9 -0
- package/dist/lib/resources/aws/compute/ecsValidation.js +63 -0
- package/dist/lib/resources/aws/compute/index.d.ts +2 -0
- package/dist/lib/resources/aws/compute/index.js +2 -0
- package/dist/lib/resources/aws/compute/lambda.d.ts +7 -13
- package/dist/lib/resources/aws/compute/lambda.js +30 -38
- package/dist/lib/resources/aws/compute/lifecycleHookLambda.source.cjs +192 -0
- package/dist/lib/resources/aws/compute/persistentDataVolume.d.ts +104 -0
- package/dist/lib/resources/aws/compute/persistentDataVolume.js +245 -0
- package/dist/lib/resources/aws/compute/persistentDataVolumeLambda.source.cjs +398 -0
- package/dist/lib/resources/aws/compute/samApplication.d.ts +15 -0
- package/dist/lib/resources/aws/compute/samApplication.js +27 -0
- package/dist/lib/resources/aws/database/clickhouseConstants.d.ts +159 -0
- package/dist/lib/resources/aws/database/clickhouseConstants.js +181 -0
- package/dist/lib/resources/aws/database/clickhouseSchemas.d.ts +71 -0
- package/dist/lib/resources/aws/database/clickhouseSchemas.js +157 -0
- package/dist/lib/resources/aws/database/clickhouseSecurityGroup.d.ts +14 -0
- package/dist/lib/resources/aws/database/clickhouseSecurityGroup.js +23 -0
- package/dist/lib/resources/aws/database/clickhouseUserData.d.ts +69 -0
- package/dist/lib/resources/aws/database/clickhouseUserData.js +371 -0
- package/dist/lib/resources/aws/database/clickhouseXmlRenderer.d.ts +56 -0
- package/dist/lib/resources/aws/database/clickhouseXmlRenderer.js +112 -0
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +8 -1
- package/dist/lib/resources/aws/database/rdsAurora.js +42 -32
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +15 -2
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +39 -43
- package/dist/lib/resources/aws/database/rdsDefaults.d.ts +6 -0
- package/dist/lib/resources/aws/database/rdsDefaults.js +7 -1
- package/dist/lib/resources/aws/database/rdsHelpers.d.ts +3 -3
- package/dist/lib/resources/aws/database/rdsHelpers.js +1 -0
- package/dist/lib/resources/aws/database/rdsInstance.d.ts +8 -1
- package/dist/lib/resources/aws/database/rdsInstance.js +51 -34
- package/dist/lib/resources/aws/database/rdsProxyOutput.d.ts +1 -1
- package/dist/lib/resources/aws/database/rdsProxyOutput.js +1 -1
- package/dist/lib/resources/aws/iam/delegationRole.js +12 -5
- package/dist/lib/resources/aws/iam/identityCenter/groupMembership.d.ts +9 -0
- package/dist/lib/resources/aws/iam/identityCenter/groupMembership.js +12 -0
- package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +1 -0
- package/dist/lib/resources/aws/iam/identityCenter/index.js +1 -0
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -0
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +1 -0
- package/dist/lib/resources/aws/logging/logGroup.d.ts +0 -8
- package/dist/lib/resources/aws/logging/logGroup.js +0 -11
- package/dist/lib/resources/aws/messaging/defaultEventBus.d.ts +7 -0
- package/dist/lib/resources/aws/messaging/defaultEventBus.js +21 -0
- package/dist/lib/resources/aws/messaging/eventBridgeRule.d.ts +96 -0
- package/dist/lib/resources/aws/messaging/eventBridgeRule.js +110 -0
- package/dist/lib/resources/aws/messaging/eventTargets.d.ts +84 -0
- package/dist/lib/resources/aws/messaging/eventTargets.js +152 -0
- package/dist/lib/resources/aws/messaging/eventbridge.d.ts +25 -2
- package/dist/lib/resources/aws/messaging/eventbridge.js +22 -10
- package/dist/lib/resources/aws/messaging/index.d.ts +5 -0
- package/dist/lib/resources/aws/messaging/index.js +2 -0
- package/dist/lib/resources/aws/messaging/schedule.d.ts +118 -0
- package/dist/lib/resources/aws/messaging/schedule.js +64 -0
- package/dist/lib/resources/aws/messaging/sns.d.ts +2 -1
- package/dist/lib/resources/aws/messaging/sqs.d.ts +2 -1
- package/dist/lib/resources/aws/messaging/subscription.d.ts +112 -0
- package/dist/lib/resources/aws/messaging/subscription.js +67 -0
- package/dist/lib/resources/aws/messaging/utils.d.ts +6 -0
- package/dist/lib/resources/aws/messaging/utils.js +10 -0
- package/dist/lib/resources/aws/monitoring/clickhouseAlarms.d.ts +60 -0
- package/dist/lib/resources/aws/monitoring/clickhouseAlarms.js +139 -0
- package/dist/lib/resources/aws/monitoring/index.d.ts +2 -0
- package/dist/lib/resources/aws/monitoring/index.js +2 -0
- package/dist/lib/resources/aws/monitoring/scheduleAlarms.d.ts +47 -0
- package/dist/lib/resources/aws/monitoring/scheduleAlarms.js +106 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +6 -3
- package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.d.ts +40 -0
- package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.js +158 -0
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +7 -4
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +2 -2
- package/dist/lib/resources/aws/networking/domainCertificate.js +6 -3
- package/dist/lib/resources/aws/networking/hostedZone.js +6 -4
- package/dist/lib/resources/aws/networking/index.d.ts +3 -0
- package/dist/lib/resources/aws/networking/index.js +3 -0
- package/dist/lib/resources/aws/networking/serviceDiscovery.d.ts +96 -0
- package/dist/lib/resources/aws/networking/serviceDiscovery.js +96 -0
- package/dist/lib/resources/aws/networking/vpc.d.ts +4 -1
- package/dist/lib/resources/aws/networking/vpc.js +10 -3
- package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.d.ts +18 -0
- package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.js +61 -0
- package/dist/lib/resources/aws/networking/vpcPeeringConnection.d.ts +49 -0
- package/dist/lib/resources/aws/networking/vpcPeeringConnection.js +106 -0
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +16 -5
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +17 -3
- package/dist/lib/resources/aws/organisation/index.d.ts +1 -1
- package/dist/lib/resources/aws/organisation/organisationPolicy.d.ts +2 -0
- package/dist/lib/resources/aws/organisation/organisationPolicy.js +3 -2
- package/dist/lib/resources/aws/secrets/secret.d.ts +7 -0
- package/dist/lib/resources/aws/secrets/secret.js +4 -3
- package/dist/lib/resources/aws/storage/bucketDeployment.d.ts +16 -0
- package/dist/lib/resources/aws/storage/bucketDeployment.js +17 -0
- package/dist/lib/resources/aws/storage/ecr.js +5 -5
- package/dist/lib/resources/aws/storage/index.d.ts +1 -0
- package/dist/lib/resources/aws/storage/index.js +1 -0
- package/dist/lib/resources/aws/storage/s3.js +10 -3
- package/dist/lib/resources/aws/utilities/customResource.js +18 -9
- package/dist/lib/synth_dump.d.ts +1 -0
- package/dist/lib/synth_dump.js +42 -0
- package/dist/lib/utils/bastionFactory.d.ts +10 -0
- package/dist/lib/utils/bastionFactory.js +29 -0
- package/dist/lib/utils/capitaliseString.d.ts +1 -1
- package/dist/lib/utils/capitaliseString.js +1 -1
- package/dist/lib/utils/cdkContext.d.ts +10 -0
- package/dist/lib/utils/cdkContext.js +13 -0
- package/dist/lib/utils/connections.d.ts +7 -1
- package/dist/lib/utils/connections.js +21 -0
- package/dist/lib/utils/connector.d.ts +30 -2
- package/dist/lib/utils/connector.js +6 -1
- package/dist/lib/utils/costAllocationTags.d.ts +15 -0
- package/dist/lib/utils/costAllocationTags.js +16 -0
- package/dist/lib/utils/databaseTypes.d.ts +14 -0
- package/dist/lib/utils/getConfig.d.ts +2 -0
- package/dist/lib/utils/getConfig.js +2 -0
- package/dist/lib/utils/index.d.ts +4 -0
- package/dist/lib/utils/index.js +4 -0
- package/dist/lib/utils/manifestWriter.d.ts +6 -89
- package/dist/lib/utils/manifestWriter.js +36 -23
- package/dist/lib/utils/migrationVersionResolvers.d.ts +2 -0
- package/dist/lib/utils/migrationVersionResolvers.js +2 -0
- package/dist/lib/utils/orgConfigParser.js +2 -1
- package/dist/lib/utils/resolveAlertsTopic.d.ts +14 -0
- package/dist/lib/utils/resolveAlertsTopic.js +30 -0
- package/dist/lib/utils/validationLogger.js +6 -3
- package/dist/lib/utils/vpcPeerInterface.d.ts +22 -0
- package/dist/lib/utils/vpcPeerInterface.js +1 -0
- package/package.json +22 -18
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
2
2
|
import { isCompute, isEcsCompute, isLambdaCompute, isEc2Compute } from "./interfaces/compute.js";
|
|
3
3
|
import { warnIfPropertiesIgnored } from "../../utils/validationLogger.js";
|
|
4
|
+
import { DEFAULT_ECS_FALLBACK_IMAGE, DEFAULT_EC2_INSTANCE_TYPE } from "../../resources/aws/compute/ecsConstants.js";
|
|
4
5
|
// Import and re-export from per-pattern files
|
|
5
|
-
import { EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, resolveScalingConfig } from "./computeEcs.js";
|
|
6
|
+
import { EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, expandMigrationsSugar, resolveScalingConfig } from "./computeEcs.js";
|
|
6
7
|
import { LambdaCompute, resolveLambdaDeployment, Architecture, HttpMethod, InvokeMode } from "./computeLambda.js";
|
|
7
8
|
import { Ec2Compute } from "./computeEc2.js";
|
|
8
9
|
// Re-export everything from per-pattern files
|
|
9
10
|
export {
|
|
10
11
|
// ECS
|
|
11
|
-
EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, resolveScalingConfig,
|
|
12
|
+
EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, expandMigrationsSugar, resolveScalingConfig,
|
|
12
13
|
// Lambda
|
|
13
14
|
LambdaCompute, resolveLambdaDeployment, Architecture, HttpMethod, InvokeMode,
|
|
14
15
|
// EC2
|
|
@@ -36,14 +37,12 @@ export const COMPUTE_TYPE_CONFIG = {
|
|
|
36
37
|
*/
|
|
37
38
|
export const COMPUTE_DEFAULTS = {
|
|
38
39
|
EC2: {
|
|
39
|
-
INSTANCE_TYPE:
|
|
40
|
+
INSTANCE_TYPE: DEFAULT_EC2_INSTANCE_TYPE,
|
|
40
41
|
MIN_CAPACITY: 1,
|
|
41
42
|
MAX_CAPACITY: 1
|
|
42
43
|
},
|
|
43
44
|
ECS: {
|
|
44
|
-
|
|
45
|
-
FALLBACK_IMAGE: "amazon/amazon-ecs-sample",
|
|
46
|
-
/** Default tag for ECR images */
|
|
45
|
+
FALLBACK_IMAGE: DEFAULT_ECS_FALLBACK_IMAGE,
|
|
47
46
|
IMAGE_TAG: "latest"
|
|
48
47
|
},
|
|
49
48
|
LAMBDA: {
|
|
@@ -140,13 +139,8 @@ export class ComputeFactory {
|
|
|
140
139
|
name: service.name,
|
|
141
140
|
clusterName
|
|
142
141
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
manifestService.dockerfilePath = service.dockerfilePath;
|
|
146
|
-
}
|
|
147
|
-
// Include dockerTarget if specified (metadata for CLI)
|
|
148
|
-
if (service.dockerTarget) {
|
|
149
|
-
manifestService.dockerTarget = service.dockerTarget;
|
|
142
|
+
if (service.docker !== undefined) {
|
|
143
|
+
manifestService.docker = service.docker;
|
|
150
144
|
}
|
|
151
145
|
// Find container port from first container with a port
|
|
152
146
|
const containerWithPort = service.containers?.find((c) => c.port !== undefined);
|
|
@@ -1,416 +1,54 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
4
|
-
import { type PolicyDocument, type IManagedPolicy, type IGrantable, Grant } from "aws-cdk-lib/aws-iam";
|
|
1
|
+
import { type ICluster, type IBaseService, type TaskDefinition, type FargateTaskDefinition } from "aws-cdk-lib/aws-ecs";
|
|
2
|
+
import { type Connections, type ISecurityGroup } from "aws-cdk-lib/aws-ec2";
|
|
3
|
+
import { type IGrantable, type IRole, Grant } from "aws-cdk-lib/aws-iam";
|
|
5
4
|
import { type IApplicationLoadBalancer, type ApplicationListener } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
6
5
|
import { Construct } from "constructs";
|
|
7
|
-
import type { ITopic } from "aws-cdk-lib/aws-sns";
|
|
8
6
|
import { type IEcsCompute } from "./interfaces/compute.js";
|
|
9
|
-
import { type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { type
|
|
13
|
-
export { ScalingType };
|
|
14
|
-
export type { EcsCapacityProvider, Ec2CapacityConfig };
|
|
15
|
-
/**
|
|
16
|
-
* Configuration for ECS capacity providers.
|
|
17
|
-
*/
|
|
18
|
-
export interface EcsCapacityProviderConfig {
|
|
19
|
-
/** Whether this uses Spot pricing */
|
|
20
|
-
usesSpot: boolean;
|
|
21
|
-
/** Whether this runs on EC2 instances (vs serverless Fargate) */
|
|
22
|
-
usesEc2Instances: boolean;
|
|
23
|
-
}
|
|
7
|
+
import EcsCluster, { type EcsClusterProps } from "../../resources/aws/compute/ecs.js";
|
|
8
|
+
export { ScalingType } from "./computeEcsTypes.js";
|
|
9
|
+
export type { EcsCapacityProvider, Ec2CapacityConfig, RemoteConnectionSpec, EcsCapacityProviderConfig, EcsContainerConfig, ContainerDependency, ContainerVolume, EcsScheduledTaskConfig, EcsLifecycleHookMigrationsConfig, EcsPostDeployMigrationsConfig, EcsHookMigrationsConfig, EcsMigrationsConfig, EcsMigrationsMode, EcsCircuitBreakerConfig, EcsScalingConfig, EcsClusterConfig, EcsRoutingConfig, EcsServiceConfig, EcsComputeProps } from "./computeEcsTypes.js";
|
|
10
|
+
import { ScalingType, type EcsCapacityProviderConfig, type EcsCapacityProvider, type EcsContainerConfig, type EcsScalingConfig, type EcsServiceConfig, type EcsComputeProps } from "./computeEcsTypes.js";
|
|
24
11
|
export declare const ECS_CAPACITY_PROVIDER_CONFIG: Record<EcsCapacityProvider, EcsCapacityProviderConfig>;
|
|
25
12
|
export declare function getEcsCapacityProviderConfig(provider: EcsCapacityProvider): EcsCapacityProviderConfig;
|
|
26
13
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* For single-container services, `name` is optional and defaults to `${serviceName}Container`.
|
|
30
|
-
* For multi-container tasks, the first container with a `port` is the **primary container**
|
|
31
|
-
* that receives load balancer traffic.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Single container (name auto-generated)
|
|
35
|
-
* containers: [{ port: 3000 }]
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* // Multi-container with sidecars
|
|
39
|
-
* containers: [
|
|
40
|
-
* { name: "app", port: 3000 }, // Primary - receives ALB traffic
|
|
41
|
-
* { name: "datadog", image: "datadog/agent" } // Sidecar - monitoring
|
|
42
|
-
* ]
|
|
43
|
-
*/
|
|
44
|
-
export interface EcsContainerConfig {
|
|
45
|
-
/** Container name. Optional for single-container services. */
|
|
46
|
-
name?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Container image. Options:
|
|
49
|
-
* - Omit: Uses app's default ECR repository (primary container only)
|
|
50
|
-
* - string: ECR repository name or public image URL
|
|
51
|
-
* - Repository: CDK ECR Repository construct
|
|
52
|
-
*/
|
|
53
|
-
image?: string | Repository;
|
|
54
|
-
/**
|
|
55
|
-
* Port the container listens on.
|
|
56
|
-
* The first container with a port becomes the **primary container**
|
|
57
|
-
* and is registered with the load balancer.
|
|
58
|
-
*/
|
|
59
|
-
port?: number;
|
|
60
|
-
/** Environment variables */
|
|
61
|
-
environment?: Record<string, string>;
|
|
62
|
-
/**
|
|
63
|
-
* Secrets from AWS SSM Parameter Store.
|
|
64
|
-
* Array of secret names that will be fetched from the service's SSM namespace.
|
|
65
|
-
* The namespace path is auto-determined from app/cluster/service names.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* // Secrets at /myapp/api-cluster/users/API_KEY and /myapp/api-cluster/users/DB_PASSWORD
|
|
69
|
-
* secrets: ["API_KEY", "DB_PASSWORD"]
|
|
70
|
-
*/
|
|
71
|
-
secrets?: string[];
|
|
72
|
-
/** Secrets imported from other CDK resources (AWS Secrets Manager) */
|
|
73
|
-
secretsImport?: Record<string, SecretImport>;
|
|
74
|
-
/** Command to run in the container */
|
|
75
|
-
command?: string[];
|
|
76
|
-
/** Entry point for the container */
|
|
77
|
-
entryPoint?: string[];
|
|
78
|
-
/**
|
|
79
|
-
* Whether this container is essential.
|
|
80
|
-
* If an essential container stops, all containers in the task stop.
|
|
81
|
-
* Default: true
|
|
82
|
-
*/
|
|
83
|
-
essential?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Health check configuration.
|
|
86
|
-
* Default: For primary container with port, uses curl health check.
|
|
87
|
-
*/
|
|
88
|
-
healthCheck?: {
|
|
89
|
-
command: string[];
|
|
90
|
-
interval?: number;
|
|
91
|
-
timeout?: number;
|
|
92
|
-
retries?: number;
|
|
93
|
-
startPeriod?: number;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* ECS scaling configuration.
|
|
98
|
-
* - Omit: enabled with defaults
|
|
99
|
-
* - `{}`: enabled with defaults
|
|
100
|
-
* - `{ minCapacity: 2, maxCapacity: 10 }`: custom scaling
|
|
101
|
-
* - `false`: explicitly disabled
|
|
102
|
-
*/
|
|
103
|
-
export interface EcsScalingConfig {
|
|
104
|
-
minCapacity?: number;
|
|
105
|
-
maxCapacity?: number;
|
|
106
|
-
scalingType?: ScalingType;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Cluster-level configuration.
|
|
110
|
-
* Controls the shared ALB for all services in this cluster.
|
|
111
|
-
*/
|
|
112
|
-
export interface EcsClusterConfig {
|
|
113
|
-
/**
|
|
114
|
-
* Domain for HTTPS access.
|
|
115
|
-
* - Omit: ALB created with default DNS (*.elb.amazonaws.com)
|
|
116
|
-
* - Specified: Creates ACM certificate + Route53 DNS A record
|
|
117
|
-
*/
|
|
118
|
-
domain?: string;
|
|
119
|
-
/**
|
|
120
|
-
* Load balancer configuration.
|
|
121
|
-
* - Omit or "public": Internet-facing ALB (default)
|
|
122
|
-
* - "internal": VPC-only ALB
|
|
123
|
-
* - false: No ALB (for workers/background processors)
|
|
124
|
-
*/
|
|
125
|
-
loadBalancer?: false | "public" | "internal";
|
|
126
|
-
/**
|
|
127
|
-
* Enable direct EC2 access without ALB.
|
|
128
|
-
* Uses host network mode for predictable ports.
|
|
129
|
-
* Access via EC2 public IP at container port.
|
|
130
|
-
*/
|
|
131
|
-
directAccess?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Advanced domain configuration for routing policies (latency, weighted, geo).
|
|
134
|
-
* Only used when domain is specified.
|
|
135
|
-
* Allows for multi-region deployments with advanced DNS routing.
|
|
136
|
-
*/
|
|
137
|
-
domainConfig?: DomainConfig;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Routing configuration for path/host-based routing on the ALB.
|
|
141
|
-
* Required when cluster has multiple services with ports.
|
|
142
|
-
* Optional for single service (gets all traffic automatically).
|
|
143
|
-
*/
|
|
144
|
-
export interface EcsRoutingConfig {
|
|
145
|
-
/**
|
|
146
|
-
* Path pattern for routing (e.g., "/api/*", "/users/*").
|
|
147
|
-
* Uses ALB path-based routing.
|
|
148
|
-
*/
|
|
149
|
-
path?: string;
|
|
150
|
-
/**
|
|
151
|
-
* Host header for routing (e.g., "api.example.com").
|
|
152
|
-
* Uses ALB host-based routing.
|
|
153
|
-
*/
|
|
154
|
-
host?: string;
|
|
155
|
-
/**
|
|
156
|
-
* Priority for this routing rule (1-50000).
|
|
157
|
-
* Lower number = higher priority.
|
|
158
|
-
* Auto-assigned if omitted.
|
|
159
|
-
*/
|
|
160
|
-
priority?: number;
|
|
161
|
-
/**
|
|
162
|
-
* Health check path for this service's target group.
|
|
163
|
-
* Default: "/"
|
|
164
|
-
*/
|
|
165
|
-
healthCheckPath?: string;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Configuration for a service in an ECS cluster.
|
|
169
|
-
* Each service gets its own task definition, scaling config, and target group.
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* // Simple service
|
|
173
|
-
* { name: "api", containers: [{ port: 3000 }] }
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* // Service with routing (for multi-service clusters)
|
|
177
|
-
* { name: "users", containers: [{ port: 3000 }], routing: { path: "/users/*", priority: 100 } }
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* // Service with multiple routing rules (same target group)
|
|
181
|
-
* { name: "web", containers: [{ port: 3000 }], routing: [
|
|
182
|
-
* { path: "/api/v2/*", priority: 50 },
|
|
183
|
-
* { path: "/*", priority: 200 },
|
|
184
|
-
* ]}
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* // Service with sidecars
|
|
188
|
-
* {
|
|
189
|
-
* name: "api",
|
|
190
|
-
* containers: [
|
|
191
|
-
* { name: "app", port: 3000 },
|
|
192
|
-
* { name: "datadog", image: "datadog/agent" }
|
|
193
|
-
* ]
|
|
194
|
-
* }
|
|
14
|
+
* Validates ECS-specific props.
|
|
15
|
+
* Extracted for clarity and detail parity with database/network patterns.
|
|
195
16
|
*/
|
|
196
|
-
export
|
|
197
|
-
/** Service name (unique within cluster) */
|
|
198
|
-
name: string;
|
|
199
|
-
/**
|
|
200
|
-
* Container image for this service (applies to first container without explicit image).
|
|
201
|
-
* - Omit: Uses app's default ECR repository
|
|
202
|
-
* - string: ECR repository name or public image URL
|
|
203
|
-
* - Repository: CDK ECR Repository construct
|
|
204
|
-
*/
|
|
205
|
-
image?: string | Repository;
|
|
206
|
-
/**
|
|
207
|
-
* Container configuration(s) for this service.
|
|
208
|
-
* For single-container services, container name is optional and auto-generated.
|
|
209
|
-
* For multi-container services, the first container with a port is the primary container.
|
|
210
|
-
*/
|
|
211
|
-
containers?: EcsContainerConfig[];
|
|
212
|
-
/**
|
|
213
|
-
* Routing rules for this service on the cluster's ALB.
|
|
214
|
-
* Required when cluster has multiple services with ports.
|
|
215
|
-
* Optional for single service (gets /* automatically).
|
|
216
|
-
* Can be a single rule or an array of rules pointing to the same target group.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* // Multiple routes for the same service
|
|
220
|
-
* routing: [
|
|
221
|
-
* { path: "/api/v2/*", priority: 50 },
|
|
222
|
-
* { path: "/*", priority: 200 },
|
|
223
|
-
* ]
|
|
224
|
-
*/
|
|
225
|
-
routing?: EcsRoutingConfig | EcsRoutingConfig[];
|
|
226
|
-
/** CPU units for this service's tasks (256-4096) */
|
|
227
|
-
cpu?: number;
|
|
228
|
-
/** Memory in MiB for this service's tasks (512-30720) */
|
|
229
|
-
memoryLimitMiB?: number;
|
|
230
|
-
/** Desired number of tasks. Default: 2 */
|
|
231
|
-
desiredCount?: number;
|
|
232
|
-
/**
|
|
233
|
-
* Scaling configuration.
|
|
234
|
-
* - Omit: enabled with defaults
|
|
235
|
-
* - false: disabled
|
|
236
|
-
*/
|
|
237
|
-
scaling?: EcsScalingConfig | false;
|
|
238
|
-
/**
|
|
239
|
-
* Path to Dockerfile for building this service's image.
|
|
240
|
-
* Metadata for CLI build process, not used during CDK synthesis.
|
|
241
|
-
*/
|
|
242
|
-
dockerfilePath?: string;
|
|
243
|
-
/**
|
|
244
|
-
* Docker build target stage for multi-stage Dockerfiles.
|
|
245
|
-
* When specified, the CLI builds with `--target <dockerTarget>`.
|
|
246
|
-
* The image tag suffix is also updated: `<service>-<target>-latest`.
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* // Dockerfile: FROM node AS base ... FROM base AS api ... FROM base AS worker
|
|
250
|
-
* { name: "api", dockerTarget: "api" } // builds: myapp-api-api-latest
|
|
251
|
-
* { name: "worker", dockerTarget: "worker" } // builds: myapp-worker-worker-latest
|
|
252
|
-
*/
|
|
253
|
-
dockerTarget?: string;
|
|
254
|
-
/**
|
|
255
|
-
* Additional inline policies for this service's task role.
|
|
256
|
-
* Added on top of the default ECS Exec permissions.
|
|
257
|
-
* Use for service-specific AWS permissions (S3, DynamoDB, SQS, etc.).
|
|
258
|
-
*/
|
|
259
|
-
taskRoleInlinePolicies?: Record<string, PolicyDocument>;
|
|
260
|
-
/**
|
|
261
|
-
* Additional managed policies for this service's task role.
|
|
262
|
-
* Added on top of the default ECS Exec permissions.
|
|
263
|
-
*/
|
|
264
|
-
taskRoleManagedPolicies?: IManagedPolicy[];
|
|
265
|
-
/**
|
|
266
|
-
* Resources this service needs to connect to (e.g., databases, S3 buckets, SQS queues).
|
|
267
|
-
* Creates security group rules for IConnectable resources and IAM grants for IAM resources.
|
|
268
|
-
* Follows least-privilege - only this service gets access, not all services in the cluster.
|
|
269
|
-
*
|
|
270
|
-
* Supports:
|
|
271
|
-
* - IConnectable: Security group resources (RDS, ECS, etc.)
|
|
272
|
-
* - IStorageConnector: S3 buckets (IAM grants)
|
|
273
|
-
* - IDynamoDBConnector: DynamoDB tables (IAM grants)
|
|
274
|
-
* - IQueueConnector: SQS queues (IAM grants)
|
|
275
|
-
* - ConnectionConfig: Explicit access level configuration
|
|
276
|
-
*
|
|
277
|
-
* @example
|
|
278
|
-
* // Simple connections (default permissions)
|
|
279
|
-
* connections: [database, bucket, cache, queue]
|
|
280
|
-
*
|
|
281
|
-
* @example
|
|
282
|
-
* // Explicit access levels
|
|
283
|
-
* connections: [
|
|
284
|
-
* database, // Security group (RDS)
|
|
285
|
-
* { resource: cache, access: "read" }, // Read-only DynamoDB
|
|
286
|
-
* { resource: bucket, access: "write" }, // Write-only S3
|
|
287
|
-
* { resource: queue, access: "consume" } // Consume-only SQS
|
|
288
|
-
* ]
|
|
289
|
-
*/
|
|
290
|
-
connections?: ConnectionSpec[];
|
|
291
|
-
/**
|
|
292
|
-
* Capacity provider for this service. REQUIRED.
|
|
293
|
-
* Each service specifies its own capacity provider.
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* // Mixed FARGATE and EC2 services in same cluster
|
|
297
|
-
* {
|
|
298
|
-
* services: [
|
|
299
|
-
* { name: "api", capacityProvider: "FARGATE" },
|
|
300
|
-
* { name: "worker", capacityProvider: "EC2", ec2Config: { instanceType: "t4g.micro" } }
|
|
301
|
-
* ]
|
|
302
|
-
* }
|
|
303
|
-
*/
|
|
304
|
-
capacityProvider: EcsCapacityProvider;
|
|
305
|
-
/**
|
|
306
|
-
* EC2 capacity configuration for this service.
|
|
307
|
-
* Only used when service capacityProvider is "EC2".
|
|
308
|
-
* Services with matching ec2Config share an ASG for efficiency.
|
|
309
|
-
*/
|
|
310
|
-
ec2Config?: Ec2CapacityConfig;
|
|
311
|
-
/**
|
|
312
|
-
* SSM Parameter Store path for secrets.
|
|
313
|
-
* If not specified, secrets are fetched from /<app>/<cluster>/<service>.
|
|
314
|
-
* Use this to override the default convention.
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* // Override default path
|
|
318
|
-
* ssmSecretsPath: "/custom/path/to/secrets"
|
|
319
|
-
*/
|
|
320
|
-
ssmSecretsPath?: string;
|
|
321
|
-
/**
|
|
322
|
-
* Per-service alarm configuration.
|
|
323
|
-
* - undefined: use defaults (CPU, memory, running tasks, 5xx if ALB)
|
|
324
|
-
* - false: disable alarms for this service
|
|
325
|
-
* - object: override specific thresholds
|
|
326
|
-
*/
|
|
327
|
-
alarms?: EcsServiceAlarmThresholds | false;
|
|
328
|
-
}
|
|
17
|
+
export declare function validateEcsProps(props: EcsComputeProps): void;
|
|
329
18
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
19
|
+
* Expand a service's `migrations` sugar into a synthetic init container plus
|
|
20
|
+
* auto-injected `dependsOn` entries on every other container.
|
|
332
21
|
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* }));
|
|
22
|
+
* - Synthesises a non-essential container that runs the migration command and exits.
|
|
23
|
+
* - Inherits image / environment / secrets / secretsImport from the primary container
|
|
24
|
+
* (first container with a port, or first container if none have a port).
|
|
25
|
+
* - Auto-wires every other container to wait on the migrate container's `SUCCESS`,
|
|
26
|
+
* skipping containers that already declare the dependency to keep user overrides intact.
|
|
27
|
+
* - Throws on name collision when a user-defined container shares the migrate name.
|
|
340
28
|
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* cluster: { domain: "api.example.com" },
|
|
346
|
-
* services: [
|
|
347
|
-
* { name: "users", containers: [{ port: 3000 }], routing: { path: "/users/*" } },
|
|
348
|
-
* { name: "orders", containers: [{ port: 3001 }], routing: { path: "/orders/*" } }
|
|
349
|
-
* ]
|
|
350
|
-
* }));
|
|
29
|
+
* When `migrations.mode` is a lambda-hook variant (`"lifecycle-hook"` /
|
|
30
|
+
* `"post-deploy"`), this helper is a no-op: the task
|
|
31
|
+
* definition stays unmodified and the migration is run by a deployment lifecycle
|
|
32
|
+
* hook synthesised separately at the pattern layer.
|
|
351
33
|
*
|
|
352
|
-
* @
|
|
353
|
-
* // Internal workers (no ALB)
|
|
354
|
-
* app.addCompute(ComputeFactory.build("Workers", {
|
|
355
|
-
* type: "ecs",
|
|
356
|
-
* cluster: { loadBalancer: false },
|
|
357
|
-
* services: [{ name: "processor" }, { name: "emailer" }]
|
|
358
|
-
* }));
|
|
359
|
-
*/
|
|
360
|
-
export interface EcsComputeProps {
|
|
361
|
-
type: "ecs";
|
|
362
|
-
vpc?: IVpc;
|
|
363
|
-
/**
|
|
364
|
-
* Application name for SSM secrets namespace.
|
|
365
|
-
* When containers use secrets, the path is derived as: /<appName>/<clusterName>/<serviceName>
|
|
366
|
-
* Auto-derived from App.getName() if not specified.
|
|
367
|
-
*/
|
|
368
|
-
appName?: string;
|
|
369
|
-
/**
|
|
370
|
-
* Cluster configuration.
|
|
371
|
-
* Controls the shared ALB for all services in this cluster.
|
|
372
|
-
* - Omit: ALB created with default settings
|
|
373
|
-
* - `{ domain: "..." }`: ALB with HTTPS + DNS
|
|
374
|
-
* - `{ loadBalancer: false }`: No ALB (internal workers)
|
|
375
|
-
*/
|
|
376
|
-
cluster?: EcsClusterConfig;
|
|
377
|
-
/**
|
|
378
|
-
* Services in this cluster.
|
|
379
|
-
* Each service gets its own task definition, scaling, and target group.
|
|
380
|
-
* Each service MUST specify its own capacityProvider.
|
|
381
|
-
* All services share the cluster's ALB (unless disabled).
|
|
382
|
-
*/
|
|
383
|
-
services: EcsServiceConfig[];
|
|
384
|
-
/**
|
|
385
|
-
* ECR repository for all services (default image).
|
|
386
|
-
* Individual services can override with their own `image` property.
|
|
387
|
-
*/
|
|
388
|
-
ecrRepository?: Repository | RepositoryImage;
|
|
389
|
-
/**
|
|
390
|
-
* Path to Dockerfile for building custom image.
|
|
391
|
-
* Note: This is metadata for the CLI build process,
|
|
392
|
-
* not used during CDK synthesis.
|
|
393
|
-
*/
|
|
394
|
-
dockerfilePath?: string;
|
|
395
|
-
/**
|
|
396
|
-
* SNS topic for alarm notifications. Resolved to ITopic and passed to EcsCluster.
|
|
397
|
-
* Accepts either an ITopic directly or a topic ARN string (resolved internally).
|
|
398
|
-
*/
|
|
399
|
-
alertsTopic?: ITopic | string;
|
|
400
|
-
/** Application ID for alarm tagging (used by webhook to map alarms to applications). */
|
|
401
|
-
applicationId?: string;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Validates ECS-specific props.
|
|
405
|
-
* Extracted for clarity and detail parity with database/network patterns.
|
|
34
|
+
* @internal Exported for testing only
|
|
406
35
|
*/
|
|
407
|
-
export declare function
|
|
36
|
+
export declare function expandMigrationsSugar(service: EcsServiceConfig, userContainers: EcsContainerConfig[] | undefined): EcsContainerConfig[];
|
|
408
37
|
/**
|
|
409
38
|
* Build container configurations for an ECS service.
|
|
410
39
|
* Converts user-facing EcsContainerConfig to internal EcsClusterProps format.
|
|
40
|
+
*
|
|
41
|
+
* @param service Service config from EcsComputeProps.
|
|
42
|
+
* @param schemaVersionEnv Pre-resolved `{ EXPECTED_SCHEMA_VERSION: <ver> }`
|
|
43
|
+
* from a connected database's `migrations:` config, or
|
|
44
|
+
* `undefined` when the service has no migrated DB or
|
|
45
|
+
* opted out via `schemaGate: false`.
|
|
46
|
+
* @param annotationsScope Construct used as the source for synth-time
|
|
47
|
+
* warnings when the author has set `EXPECTED_SCHEMA_VERSION`
|
|
48
|
+
* themselves and the resolved value differs.
|
|
411
49
|
* @internal Exported for testing only
|
|
412
50
|
*/
|
|
413
|
-
export declare function buildContainerConfigs(service: EcsServiceConfig): EcsClusterProps["services"][number]["containers"];
|
|
51
|
+
export declare function buildContainerConfigs(service: EcsServiceConfig, schemaVersionEnv?: Record<string, string>, annotationsScope?: Construct): EcsClusterProps["services"][number]["containers"];
|
|
414
52
|
/**
|
|
415
53
|
* Resolved scaling configuration for an ECS service.
|
|
416
54
|
* @internal Exported for testing only
|
|
@@ -434,7 +72,46 @@ export declare class EcsCompute extends Construct implements IEcsCompute {
|
|
|
434
72
|
readonly computeType: "ecs";
|
|
435
73
|
readonly connections: Connections;
|
|
436
74
|
private readonly ecsCluster;
|
|
75
|
+
private readonly clusterId;
|
|
76
|
+
private readonly appName;
|
|
77
|
+
private readonly migrationTaskDefinitions;
|
|
437
78
|
constructor(scope: Construct, id: string, props: EcsComputeProps);
|
|
79
|
+
/**
|
|
80
|
+
* Walks a service's `connections:` for a relational database carrying a
|
|
81
|
+
* `migrations:` config. Returns the schema-version gate env entries to
|
|
82
|
+
* thread into the service's containers, or `undefined` when the service is
|
|
83
|
+
* not gated.
|
|
84
|
+
*
|
|
85
|
+
* - `schemaGate: false` → returns `undefined` (auditable opt-out)
|
|
86
|
+
* - No migrated DB in connections → returns `undefined`
|
|
87
|
+
* - Exactly one migrated DB → returns `{ EXPECTED_SCHEMA_VERSION, EXPECTED_SCHEMA_VERSION_TOOL }`
|
|
88
|
+
* - Two or more migrated DBs → throws via `resolveMigrationDatabaseForService`
|
|
89
|
+
*
|
|
90
|
+
* Both envs always emit together. The tool sibling lets the runtime gate
|
|
91
|
+
* dispatch to the matching resolver (or refuse on unknown tool) instead of
|
|
92
|
+
* hardcoding one.
|
|
93
|
+
*/
|
|
94
|
+
private resolveSchemaVersionEnv;
|
|
95
|
+
private materialiseScheduledTasks;
|
|
96
|
+
private buildScheduledTaskDefinition;
|
|
97
|
+
/**
|
|
98
|
+
* For each service whose `migrations.mode` is a lambda-hook variant
|
|
99
|
+
* (`"lifecycle-hook"` for PRE_SCALE_UP, `"post-deploy"` for POST_SCALE_UP),
|
|
100
|
+
* synthesise the Lambda + IAM role + log group that backs the deployment
|
|
101
|
+
* lifecycle hook. The init-container path is unaffected — services without
|
|
102
|
+
* `mode` (or with `mode: "init-container"`) still get the synthetic
|
|
103
|
+
* migrate container injected by `expandMigrationsSugar`.
|
|
104
|
+
*/
|
|
105
|
+
private wireLifecycleHookMigrations;
|
|
106
|
+
/**
|
|
107
|
+
* Synthesise a dedicated migration task definition for a lifecycle-hook
|
|
108
|
+
* migration when `separateTaskDef` is set. Creates the migration's own
|
|
109
|
+
* execution + task roles, log group, security group (when `egressTo` is
|
|
110
|
+
* present, else reuses the service's SGs), and the Fargate task definition
|
|
111
|
+
* with the migration container baked in.
|
|
112
|
+
*/
|
|
113
|
+
private synthesiseMigrationTaskDef;
|
|
114
|
+
private resolveMigrationSecrets;
|
|
438
115
|
/** Get the ECS cluster. */
|
|
439
116
|
getCluster(): ICluster;
|
|
440
117
|
/** Get the Application Load Balancer if one was created. */
|
|
@@ -443,12 +120,21 @@ export declare class EcsCompute extends Construct implements IEcsCompute {
|
|
|
443
120
|
getService(name: string): IBaseService | undefined;
|
|
444
121
|
/** Get all services in the cluster. */
|
|
445
122
|
getAllServices(): IBaseService[];
|
|
123
|
+
getTaskDefinition(serviceName: string): TaskDefinition | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get the migration task definition for a service. Returns `undefined` when
|
|
126
|
+
* the service has no `migrations: { mode: "lifecycle-hook", separateTaskDef }`
|
|
127
|
+
* configured — escape hatch for callers that need to attach grants (e.g.
|
|
128
|
+
* `bucket.grantReadWrite(td.taskRole)`) to the migration task role.
|
|
129
|
+
*/
|
|
130
|
+
getMigrationTaskDefinition(serviceName: string): FargateTaskDefinition | undefined;
|
|
446
131
|
/** Get the security group for the cluster. */
|
|
447
132
|
getSecurityGroup(): ISecurityGroup;
|
|
448
133
|
/**
|
|
449
134
|
* Get the ALB listener if this is an ECS compute with ALB.
|
|
450
135
|
*/
|
|
451
136
|
getListener(): ApplicationListener | undefined;
|
|
137
|
+
getPrimaryListenerPort(): number | undefined;
|
|
452
138
|
/**
|
|
453
139
|
* Get the underlying ECS cluster construct.
|
|
454
140
|
*/
|
|
@@ -459,4 +145,17 @@ export declare class EcsCompute extends Construct implements IEcsCompute {
|
|
|
459
145
|
* which are not known until runtime (tasks are ephemeral).
|
|
460
146
|
*/
|
|
461
147
|
grantExecuteCommand(grantee: IGrantable): Grant;
|
|
148
|
+
/**
|
|
149
|
+
* Get the EC2 instance role for the cluster's underlying ASG. EC2-mode
|
|
150
|
+
* clusters return the ASG instance role; Fargate-only clusters return
|
|
151
|
+
* `undefined`. Use to attach S3 grants etc. that must reach the host
|
|
152
|
+
* process (D10 — single accessor; no separate `getAutoScalingGroup()`).
|
|
153
|
+
*/
|
|
154
|
+
getInstanceRole(): IRole | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Get the underlying ASG's `autoScalingGroupName` token. String-only —
|
|
157
|
+
* D10 forbids exposing the ASG construct itself. Used by alarm helpers
|
|
158
|
+
* that need a CloudWatch dimension value.
|
|
159
|
+
*/
|
|
160
|
+
getAutoScalingGroupName(): string | undefined;
|
|
462
161
|
}
|