@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.
Files changed (234) hide show
  1. package/dist/lib/app.d.ts +90 -107
  2. package/dist/lib/app.js +149 -139
  3. package/dist/lib/config/aws/__t17fixture.d.ts +1 -0
  4. package/dist/lib/config/aws/__t17fixture.js +3 -0
  5. package/dist/lib/config/aws/__t17fixtureType.d.ts +2 -0
  6. package/dist/lib/config/aws/__t17fixtureType.js +1 -0
  7. package/dist/lib/config/aws/alarmTopic.js +8 -4
  8. package/dist/lib/config/aws/cloudTrail.js +1 -1
  9. package/dist/lib/config/aws/disasterRecovery.js +11 -16
  10. package/dist/lib/config/aws/ecrDefaultImage.d.ts +0 -1
  11. package/dist/lib/config/aws/ecrDefaultImage.js +13 -23
  12. package/dist/lib/config/aws/identityCenter.d.ts +10 -3
  13. package/dist/lib/config/aws/identityCenter.js +101 -37
  14. package/dist/lib/config/aws/identityCenterGroupMembership.js +8 -2
  15. package/dist/lib/config/aws/identityCenterMembership.d.ts +11 -0
  16. package/dist/lib/config/aws/identityCenterMembership.js +61 -0
  17. package/dist/lib/config/aws/index.d.ts +1 -1
  18. package/dist/lib/config/aws/index.js +1 -1
  19. package/dist/lib/config/aws/ipam.js +6 -11
  20. package/dist/lib/config/aws/oidcConnector.js +5 -1
  21. package/dist/lib/config/aws/scpPreset.js +4 -1
  22. package/dist/lib/patterns/aws/_eslint_test_tmp/leak.d.ts +1 -0
  23. package/dist/lib/patterns/aws/_eslint_test_tmp/leak.js +4 -0
  24. package/dist/lib/patterns/aws/account.js +7 -8
  25. package/dist/lib/patterns/aws/apexDomainPattern.js +10 -10
  26. package/dist/lib/patterns/aws/bastionFactory.d.ts +10 -0
  27. package/dist/lib/patterns/aws/bastionFactory.js +29 -0
  28. package/dist/lib/patterns/aws/buildkite.d.ts +2 -2
  29. package/dist/lib/patterns/aws/buildkite.js +51 -97
  30. package/dist/lib/patterns/aws/cdn.js +1 -1
  31. package/dist/lib/patterns/aws/clickhouseDatabase.d.ts +172 -0
  32. package/dist/lib/patterns/aws/clickhouseDatabase.js +600 -0
  33. package/dist/lib/patterns/aws/compute.d.ts +4 -6
  34. package/dist/lib/patterns/aws/compute.js +7 -13
  35. package/dist/lib/patterns/aws/computeEcs.d.ts +95 -396
  36. package/dist/lib/patterns/aws/computeEcs.js +880 -46
  37. package/dist/lib/patterns/aws/computeEcsTypes.d.ts +889 -0
  38. package/dist/lib/patterns/aws/computeEcsTypes.js +12 -0
  39. package/dist/lib/patterns/aws/computeLambda.d.ts +0 -5
  40. package/dist/lib/patterns/aws/computeLambda.js +1 -2
  41. package/dist/lib/patterns/aws/database.d.ts +50 -8
  42. package/dist/lib/patterns/aws/database.js +183 -27
  43. package/dist/lib/patterns/aws/domain.js +8 -7
  44. package/dist/lib/patterns/aws/index.d.ts +3 -0
  45. package/dist/lib/patterns/aws/index.js +3 -0
  46. package/dist/lib/patterns/aws/interfaces/compute.d.ts +13 -1
  47. package/dist/lib/patterns/aws/interfaces/connector.d.ts +1 -1
  48. package/dist/lib/patterns/aws/interfaces/connector.js +1 -1
  49. package/dist/lib/patterns/aws/interfaces/database.d.ts +187 -8
  50. package/dist/lib/patterns/aws/interfaces/database.js +17 -3
  51. package/dist/lib/patterns/aws/interfaces/index.d.ts +4 -2
  52. package/dist/lib/patterns/aws/interfaces/index.js +4 -2
  53. package/dist/lib/patterns/aws/interfaces/messaging.d.ts +7 -0
  54. package/dist/lib/patterns/aws/interfaces/migrationContributor.d.ts +47 -0
  55. package/dist/lib/patterns/aws/interfaces/migrationContributor.js +9 -0
  56. package/dist/lib/patterns/aws/interfaces/vpcPeer.d.ts +7 -0
  57. package/dist/lib/patterns/aws/interfaces/vpcPeer.js +1 -0
  58. package/dist/lib/patterns/aws/messaging.d.ts +66 -10
  59. package/dist/lib/patterns/aws/messaging.js +115 -20
  60. package/dist/lib/patterns/aws/network.js +16 -7
  61. package/dist/lib/patterns/aws/organisation.d.ts +4 -0
  62. package/dist/lib/patterns/aws/organisation.js +24 -5
  63. package/dist/lib/patterns/aws/storage.d.ts +1 -2
  64. package/dist/lib/patterns/aws/storage.js +3 -2
  65. package/dist/lib/patterns/aws/vpcPeer.d.ts +34 -0
  66. package/dist/lib/patterns/aws/vpcPeer.js +38 -0
  67. package/dist/lib/patterns/aws/vpcPeerAccepter.d.ts +29 -0
  68. package/dist/lib/patterns/aws/vpcPeerAccepter.js +196 -0
  69. package/dist/lib/resources/aws/analytics/clickhouse.js +25 -7
  70. package/dist/lib/resources/aws/analytics/clickhouseAlarms.d.ts +49 -0
  71. package/dist/lib/resources/aws/analytics/clickhouseAlarms.js +140 -0
  72. package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +4 -4
  73. package/dist/lib/resources/aws/analytics/clickhouseConstants.js +6 -4
  74. package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +12 -0
  75. package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +1 -0
  76. package/dist/lib/resources/aws/analytics/clickhouseUserData.js +56 -5
  77. package/dist/lib/resources/aws/analytics/index.d.ts +2 -0
  78. package/dist/lib/resources/aws/analytics/index.js +1 -0
  79. package/dist/lib/resources/aws/base/awsStack.js +4 -2
  80. package/dist/lib/resources/aws/compute/__tmp__/regression-shape.d.ts +2 -0
  81. package/dist/lib/resources/aws/compute/__tmp__/regression-shape.js +11 -0
  82. package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.d.ts +52 -0
  83. package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.js +60 -0
  84. package/dist/lib/resources/aws/compute/blockDeviceVolume.d.ts +8 -0
  85. package/dist/lib/resources/aws/compute/blockDeviceVolume.js +10 -0
  86. package/dist/lib/resources/aws/compute/ec2.d.ts +132 -12
  87. package/dist/lib/resources/aws/compute/ec2.js +163 -23
  88. package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.d.ts +41 -0
  89. package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.js +194 -0
  90. package/dist/lib/resources/aws/compute/ec2GracefulTerminationLambda.source.cjs +458 -0
  91. package/dist/lib/resources/aws/compute/ecs.d.ts +27 -1
  92. package/dist/lib/resources/aws/compute/ecs.js +42 -2
  93. package/dist/lib/resources/aws/compute/ecsConstants.d.ts +9 -0
  94. package/dist/lib/resources/aws/compute/ecsConstants.js +16 -0
  95. package/dist/lib/resources/aws/compute/ecsImages.js +32 -20
  96. package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.d.ts +96 -0
  97. package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.js +113 -0
  98. package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +2 -1
  99. package/dist/lib/resources/aws/compute/ecsNetworking.js +18 -6
  100. package/dist/lib/resources/aws/compute/ecsRemoteConnections.d.ts +38 -0
  101. package/dist/lib/resources/aws/compute/ecsRemoteConnections.js +80 -0
  102. package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +13 -4
  103. package/dist/lib/resources/aws/compute/ecsServiceFactory.js +155 -33
  104. package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +31 -1
  105. package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +110 -6
  106. package/dist/lib/resources/aws/compute/ecsTypes.d.ts +180 -13
  107. package/dist/lib/resources/aws/compute/ecsValidation.d.ts +9 -0
  108. package/dist/lib/resources/aws/compute/ecsValidation.js +63 -0
  109. package/dist/lib/resources/aws/compute/index.d.ts +2 -0
  110. package/dist/lib/resources/aws/compute/index.js +2 -0
  111. package/dist/lib/resources/aws/compute/lambda.d.ts +7 -13
  112. package/dist/lib/resources/aws/compute/lambda.js +30 -38
  113. package/dist/lib/resources/aws/compute/lifecycleHookLambda.source.cjs +192 -0
  114. package/dist/lib/resources/aws/compute/persistentDataVolume.d.ts +104 -0
  115. package/dist/lib/resources/aws/compute/persistentDataVolume.js +245 -0
  116. package/dist/lib/resources/aws/compute/persistentDataVolumeLambda.source.cjs +398 -0
  117. package/dist/lib/resources/aws/compute/samApplication.d.ts +15 -0
  118. package/dist/lib/resources/aws/compute/samApplication.js +27 -0
  119. package/dist/lib/resources/aws/database/clickhouseConstants.d.ts +159 -0
  120. package/dist/lib/resources/aws/database/clickhouseConstants.js +181 -0
  121. package/dist/lib/resources/aws/database/clickhouseSchemas.d.ts +71 -0
  122. package/dist/lib/resources/aws/database/clickhouseSchemas.js +157 -0
  123. package/dist/lib/resources/aws/database/clickhouseSecurityGroup.d.ts +14 -0
  124. package/dist/lib/resources/aws/database/clickhouseSecurityGroup.js +23 -0
  125. package/dist/lib/resources/aws/database/clickhouseUserData.d.ts +69 -0
  126. package/dist/lib/resources/aws/database/clickhouseUserData.js +371 -0
  127. package/dist/lib/resources/aws/database/clickhouseXmlRenderer.d.ts +56 -0
  128. package/dist/lib/resources/aws/database/clickhouseXmlRenderer.js +112 -0
  129. package/dist/lib/resources/aws/database/rdsAurora.d.ts +8 -1
  130. package/dist/lib/resources/aws/database/rdsAurora.js +42 -32
  131. package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +15 -2
  132. package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +39 -43
  133. package/dist/lib/resources/aws/database/rdsDefaults.d.ts +6 -0
  134. package/dist/lib/resources/aws/database/rdsDefaults.js +7 -1
  135. package/dist/lib/resources/aws/database/rdsHelpers.d.ts +3 -3
  136. package/dist/lib/resources/aws/database/rdsHelpers.js +1 -0
  137. package/dist/lib/resources/aws/database/rdsInstance.d.ts +8 -1
  138. package/dist/lib/resources/aws/database/rdsInstance.js +51 -34
  139. package/dist/lib/resources/aws/database/rdsProxyOutput.d.ts +1 -1
  140. package/dist/lib/resources/aws/database/rdsProxyOutput.js +1 -1
  141. package/dist/lib/resources/aws/iam/delegationRole.js +12 -5
  142. package/dist/lib/resources/aws/iam/identityCenter/groupMembership.d.ts +9 -0
  143. package/dist/lib/resources/aws/iam/identityCenter/groupMembership.js +12 -0
  144. package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +1 -0
  145. package/dist/lib/resources/aws/iam/identityCenter/index.js +1 -0
  146. package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -0
  147. package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +1 -0
  148. package/dist/lib/resources/aws/logging/logGroup.d.ts +0 -8
  149. package/dist/lib/resources/aws/logging/logGroup.js +0 -11
  150. package/dist/lib/resources/aws/messaging/defaultEventBus.d.ts +7 -0
  151. package/dist/lib/resources/aws/messaging/defaultEventBus.js +21 -0
  152. package/dist/lib/resources/aws/messaging/eventBridgeRule.d.ts +96 -0
  153. package/dist/lib/resources/aws/messaging/eventBridgeRule.js +110 -0
  154. package/dist/lib/resources/aws/messaging/eventTargets.d.ts +84 -0
  155. package/dist/lib/resources/aws/messaging/eventTargets.js +152 -0
  156. package/dist/lib/resources/aws/messaging/eventbridge.d.ts +25 -2
  157. package/dist/lib/resources/aws/messaging/eventbridge.js +22 -10
  158. package/dist/lib/resources/aws/messaging/index.d.ts +5 -0
  159. package/dist/lib/resources/aws/messaging/index.js +2 -0
  160. package/dist/lib/resources/aws/messaging/schedule.d.ts +118 -0
  161. package/dist/lib/resources/aws/messaging/schedule.js +64 -0
  162. package/dist/lib/resources/aws/messaging/sns.d.ts +2 -1
  163. package/dist/lib/resources/aws/messaging/sqs.d.ts +2 -1
  164. package/dist/lib/resources/aws/messaging/subscription.d.ts +112 -0
  165. package/dist/lib/resources/aws/messaging/subscription.js +67 -0
  166. package/dist/lib/resources/aws/messaging/utils.d.ts +6 -0
  167. package/dist/lib/resources/aws/messaging/utils.js +10 -0
  168. package/dist/lib/resources/aws/monitoring/clickhouseAlarms.d.ts +60 -0
  169. package/dist/lib/resources/aws/monitoring/clickhouseAlarms.js +139 -0
  170. package/dist/lib/resources/aws/monitoring/index.d.ts +2 -0
  171. package/dist/lib/resources/aws/monitoring/index.js +2 -0
  172. package/dist/lib/resources/aws/monitoring/scheduleAlarms.d.ts +47 -0
  173. package/dist/lib/resources/aws/monitoring/scheduleAlarms.js +106 -0
  174. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +6 -3
  175. package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.d.ts +40 -0
  176. package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.js +158 -0
  177. package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +7 -4
  178. package/dist/lib/resources/aws/networking/domainCertificate.d.ts +2 -2
  179. package/dist/lib/resources/aws/networking/domainCertificate.js +6 -3
  180. package/dist/lib/resources/aws/networking/hostedZone.js +6 -4
  181. package/dist/lib/resources/aws/networking/index.d.ts +3 -0
  182. package/dist/lib/resources/aws/networking/index.js +3 -0
  183. package/dist/lib/resources/aws/networking/serviceDiscovery.d.ts +96 -0
  184. package/dist/lib/resources/aws/networking/serviceDiscovery.js +96 -0
  185. package/dist/lib/resources/aws/networking/vpc.d.ts +4 -1
  186. package/dist/lib/resources/aws/networking/vpc.js +10 -3
  187. package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.d.ts +18 -0
  188. package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.js +61 -0
  189. package/dist/lib/resources/aws/networking/vpcPeeringConnection.d.ts +49 -0
  190. package/dist/lib/resources/aws/networking/vpcPeeringConnection.js +106 -0
  191. package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +16 -5
  192. package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +17 -3
  193. package/dist/lib/resources/aws/organisation/index.d.ts +1 -1
  194. package/dist/lib/resources/aws/organisation/organisationPolicy.d.ts +2 -0
  195. package/dist/lib/resources/aws/organisation/organisationPolicy.js +3 -2
  196. package/dist/lib/resources/aws/secrets/secret.d.ts +7 -0
  197. package/dist/lib/resources/aws/secrets/secret.js +4 -3
  198. package/dist/lib/resources/aws/storage/bucketDeployment.d.ts +16 -0
  199. package/dist/lib/resources/aws/storage/bucketDeployment.js +17 -0
  200. package/dist/lib/resources/aws/storage/ecr.js +5 -5
  201. package/dist/lib/resources/aws/storage/index.d.ts +1 -0
  202. package/dist/lib/resources/aws/storage/index.js +1 -0
  203. package/dist/lib/resources/aws/storage/s3.js +10 -3
  204. package/dist/lib/resources/aws/utilities/customResource.js +18 -9
  205. package/dist/lib/synth_dump.d.ts +1 -0
  206. package/dist/lib/synth_dump.js +42 -0
  207. package/dist/lib/utils/bastionFactory.d.ts +10 -0
  208. package/dist/lib/utils/bastionFactory.js +29 -0
  209. package/dist/lib/utils/capitaliseString.d.ts +1 -1
  210. package/dist/lib/utils/capitaliseString.js +1 -1
  211. package/dist/lib/utils/cdkContext.d.ts +10 -0
  212. package/dist/lib/utils/cdkContext.js +13 -0
  213. package/dist/lib/utils/connections.d.ts +7 -1
  214. package/dist/lib/utils/connections.js +21 -0
  215. package/dist/lib/utils/connector.d.ts +30 -2
  216. package/dist/lib/utils/connector.js +6 -1
  217. package/dist/lib/utils/costAllocationTags.d.ts +15 -0
  218. package/dist/lib/utils/costAllocationTags.js +16 -0
  219. package/dist/lib/utils/databaseTypes.d.ts +14 -0
  220. package/dist/lib/utils/getConfig.d.ts +2 -0
  221. package/dist/lib/utils/getConfig.js +2 -0
  222. package/dist/lib/utils/index.d.ts +4 -0
  223. package/dist/lib/utils/index.js +4 -0
  224. package/dist/lib/utils/manifestWriter.d.ts +6 -89
  225. package/dist/lib/utils/manifestWriter.js +36 -23
  226. package/dist/lib/utils/migrationVersionResolvers.d.ts +2 -0
  227. package/dist/lib/utils/migrationVersionResolvers.js +2 -0
  228. package/dist/lib/utils/orgConfigParser.js +2 -1
  229. package/dist/lib/utils/resolveAlertsTopic.d.ts +14 -0
  230. package/dist/lib/utils/resolveAlertsTopic.js +30 -0
  231. package/dist/lib/utils/validationLogger.js +6 -3
  232. package/dist/lib/utils/vpcPeerInterface.d.ts +22 -0
  233. package/dist/lib/utils/vpcPeerInterface.js +1 -0
  234. package/package.json +22 -18
@@ -1,6 +1,9 @@
1
- import { type ContainerDefinition, type RepositoryImage } from "aws-cdk-lib/aws-ecs";
2
- import { type IVpc } from "aws-cdk-lib/aws-ec2";
1
+ import { type ContainerDefinition, type NetworkMode, type PortMapping, type RepositoryImage } from "aws-cdk-lib/aws-ecs";
2
+ import { type BlockDevice, type IMachineImage, type ISecurityGroup, type IVpc, type UserData } from "aws-cdk-lib/aws-ec2";
3
+ import { type Monitoring } from "aws-cdk-lib/aws-autoscaling";
4
+ import { type IService } from "aws-cdk-lib/aws-servicediscovery";
3
5
  import { type IManagedPolicy, type PolicyDocument } from "aws-cdk-lib/aws-iam";
6
+ import type { DockerBuild } from "@fjall/util/manifest/schemas";
4
7
  import { type TargetTrackingScalingPolicy } from "aws-cdk-lib/aws-applicationautoscaling";
5
8
  import { type GeoLocation } from "aws-cdk-lib/aws-route53";
6
9
  import { type Repository } from "aws-cdk-lib/aws-ecr";
@@ -10,10 +13,12 @@ import { type Role } from "aws-cdk-lib/aws-iam";
10
13
  import { type HostedZone as FjallHostedZone } from "../networking/hostedZone.js";
11
14
  import { type Certificate } from "aws-cdk-lib/aws-certificatemanager";
12
15
  import { type ConnectionSpec } from "../../../utils/connector.js";
16
+ import { type RemoteConnectionSpec } from "./ecsRemoteConnections.js";
13
17
  import { type SecretImport } from "../secrets/index.js";
14
18
  import type { ManagedDomainExports } from "../../../utils/domainTypes.js";
15
19
  import type { ITopic } from "aws-cdk-lib/aws-sns";
16
20
  import type { EcsServiceAlarmThresholds } from "../monitoring/index.js";
21
+ import { type Ec2InstancePersistentDataVolumeConfig } from "./ec2.js";
17
22
  export declare enum Protocol {
18
23
  HTTP = 0,
19
24
  HTTPS = 1
@@ -22,7 +27,8 @@ export declare enum ScalingType {
22
27
  CPU = "ECSServiceAverageCPUUtilization",
23
28
  MEMORY = "ECSServiceAverageMemoryUtilization"
24
29
  }
25
- export type EcsCapacityProvider = "FARGATE" | "FARGATE_SPOT" | "EC2";
30
+ import type { EcsCapacityProvider } from "@fjall/generator";
31
+ export type { EcsCapacityProvider };
26
32
  /**
27
33
  * EC2 capacity configuration for ECS EC2-backed clusters.
28
34
  * Only used when capacityProvider is "EC2".
@@ -46,6 +52,52 @@ export interface Ec2CapacityConfig {
46
52
  /** Return instances to the pool on scale-in instead of terminating. Default: true */
47
53
  reuseOnScaleIn?: boolean;
48
54
  };
55
+ /** CDK `AutoScalingGroupProps.desiredCapacity` — initial instance count. */
56
+ desiredCapacity?: number;
57
+ /**
58
+ * CDK `LaunchTemplateProps.machineImage`. When provided, overrides the
59
+ * default `EcsOptimizedImage.amazonLinux2023(amiHardwareType)`. Use for
60
+ * stateful workloads requiring a custom AMI.
61
+ */
62
+ machineImage?: IMachineImage;
63
+ /**
64
+ * CDK `aws-cdk-lib/aws-autoscaling.Monitoring`. Routes through the
65
+ * LaunchTemplate's `detailedMonitoring` field. Default: `Monitoring.BASIC`.
66
+ */
67
+ instanceMonitoring?: Monitoring;
68
+ /** CDK `LaunchTemplateProps.blockDevices`. Use for EBS attachments. */
69
+ blockDevices?: BlockDevice[];
70
+ /**
71
+ * CDK `LaunchTemplateProps.userData`. When provided, overrides the
72
+ * default empty `UserData.forLinux()`.
73
+ */
74
+ userData?: UserData;
75
+ /** CDK `LaunchTemplateProps.associatePublicIpAddress`. */
76
+ associatePublicIpAddress?: boolean;
77
+ /**
78
+ * Pin the ASG to a specific set of availability zones. When
79
+ * `persistentDataVolume` is set, MUST contain exactly one entry matching
80
+ * `persistentDataVolume.availabilityZone` — the standalone EBS volume is
81
+ * AZ-local and cannot follow a multi-AZ ASG. Merged into `vpcSubnets` at
82
+ * the `Ec2Instance` boundary.
83
+ */
84
+ availabilityZones?: string[];
85
+ /**
86
+ * Pairs the EC2 capacity ASG with a standalone EBS data volume that
87
+ * re-attaches across instance refreshes. Forwarded to `Ec2Instance` which
88
+ * locates and detaches the volume via TERMINATING/LAUNCHING lifecycle
89
+ * hooks. Implies a singleton service — do not share an ASG across
90
+ * services when this is set (`getEc2ConfigKey` adds a discriminator to
91
+ * keep them apart).
92
+ */
93
+ persistentDataVolume?: Ec2InstancePersistentDataVolumeConfig;
94
+ /**
95
+ * Tags applied to the underlying ASG with `applyToLaunchedInstances: true`
96
+ * so every launched EC2 instance carries the tags. Used for tag-based SSM
97
+ * `SendCommand` targeting (`Targets: [{ Key: "tag:<name>", Values: […] }]`).
98
+ * Empty-string keys or values are rejected at the resources layer.
99
+ */
100
+ tags?: Record<string, string>;
49
101
  }
50
102
  /**
51
103
  * Domain configuration for HTTPS and DNS.
@@ -68,6 +120,17 @@ export interface GeoLocationDomainConfig extends DomainBaseConfig {
68
120
  geoLocation: GeoLocation;
69
121
  }
70
122
  export type DomainConfig = DomainBaseConfig | LatencyDomainConfig | WeightedDomainConfig | GeoLocationDomainConfig;
123
+ /**
124
+ * A dependency on another container in the same task definition.
125
+ * Maps directly to ECS `ContainerDependency`. See `ContainerDependency` in
126
+ * the factory layer (`computeEcsTypes.ts`) for the public-facing variant.
127
+ *
128
+ * @internal
129
+ */
130
+ export interface EcsContainerDependency {
131
+ container: string;
132
+ condition: "START" | "COMPLETE" | "SUCCESS" | "HEALTHY";
133
+ }
71
134
  /**
72
135
  * Internal configuration for a container in a multi-container ECS task.
73
136
  *
@@ -135,6 +198,32 @@ export interface EcsClusterContainerConfig {
135
198
  retries?: number;
136
199
  startPeriod?: number;
137
200
  };
201
+ /**
202
+ * Containers in the same service that must reach a given state before this
203
+ * container starts. Resolved at synth time against the service's container names.
204
+ */
205
+ dependsOn?: EcsContainerDependency[];
206
+ /**
207
+ * Multi-port containers (CDK `PortMapping[]`). Mutually exclusive with
208
+ * `port` — supplying both throws at synth (AC30).
209
+ */
210
+ portMappings?: PortMapping[];
211
+ /**
212
+ * Host-bind volumes mounted into this container. Each entry produces a
213
+ * matching `taskDefinition.addVolume(...)` + `container.addMountPoints(...)`
214
+ * pair (AC31).
215
+ */
216
+ volumes?: Array<{
217
+ name: string;
218
+ hostSourcePath?: string;
219
+ mountPath: string;
220
+ readOnly?: boolean;
221
+ }>;
222
+ /**
223
+ * Time (seconds) ECS waits for the container to exit gracefully after
224
+ * SIGTERM before sending SIGKILL. Range 1–120. Default: ECS default (30s).
225
+ */
226
+ stopTimeout?: number;
138
227
  }
139
228
  /**
140
229
  * Cluster-level configuration.
@@ -166,6 +255,12 @@ export interface EcsClusterClusterConfig {
166
255
  * Only used when domain is specified.
167
256
  */
168
257
  domainConfig?: DomainConfig;
258
+ /**
259
+ * Externally-supplied EC2 capacity security group. When provided, the ECS
260
+ * service factory uses this SG instead of constructing its own. Pre-resolved
261
+ * by the patterns layer (AC26 — `EcsClusterConfig.securityGroup`).
262
+ */
263
+ securityGroup?: ISecurityGroup;
169
264
  }
170
265
  /**
171
266
  * Routing configuration for path/host-based routing on the ALB.
@@ -205,11 +300,23 @@ export interface EcsServiceProps {
205
300
  memoryLimitMiB?: number;
206
301
  /** Desired number of tasks. Default: 2 */
207
302
  desiredCount?: number;
208
- /** Scaling type (CPU or MEMORY). Omit to disable auto-scaling. */
303
+ /**
304
+ * Scaling type (CPU or MEMORY). Omit to disable auto-scaling — no
305
+ * `ScalableTarget` is registered, and `minCapacity`/`maxCapacity` below have
306
+ * no effect. The `desiredCount: 0 + minCapacity > 0` validation throw still
307
+ * fires regardless, so operator-intent contradictions surface at synth even
308
+ * when scaling is disabled.
309
+ */
209
310
  scalingType?: ScalingType;
210
- /** Minimum number of tasks for auto-scaling. Default: 2 */
311
+ /**
312
+ * Minimum number of tasks for auto-scaling. Default: tracks `desiredCount`.
313
+ * Only consulted when `scalingType` is set.
314
+ */
211
315
  minCapacity?: number;
212
- /** Maximum number of tasks for auto-scaling. Default: 10 */
316
+ /**
317
+ * Maximum number of tasks for auto-scaling. Default: `Math.max(desiredCount + 1, 3)`.
318
+ * Only consulted when `scalingType` is set.
319
+ */
213
320
  maxCapacity?: number;
214
321
  /**
215
322
  * Routing rules for this service on the cluster's ALB.
@@ -249,6 +356,12 @@ export interface EcsServiceProps {
249
356
  * ]
250
357
  */
251
358
  connections?: ConnectionSpec[];
359
+ /**
360
+ * Cross-app resources reachable via VPC peering. Resolved at synth time
361
+ * into `${PREFIX}_HOST` / `${PREFIX}_PORT` env vars merged into every
362
+ * container in this service's task definition.
363
+ */
364
+ remoteConnections?: RemoteConnectionSpec[];
252
365
  /**
253
366
  * Capacity provider for this service. REQUIRED.
254
367
  * Each service specifies its own capacity provider.
@@ -270,14 +383,11 @@ export interface EcsServiceProps {
270
383
  */
271
384
  ssmSecretsPath?: string;
272
385
  /**
273
- * Docker build target stage for multi-stage Dockerfiles.
274
- * When specified, appends `-<target>` to the image tag.
275
- *
276
- * @example
277
- * // With dockerTarget: "api", image tag becomes: myservice-api-latest
278
- * dockerTarget: "api"
386
+ * Dockerfile build configuration for this service. When `target` is set,
387
+ * the image tag suffix becomes `<service>-<target>-latest`.
388
+ * Mutually exclusive with `image` (pre-built URI).
279
389
  */
280
- dockerTarget?: string;
390
+ docker?: DockerBuild;
281
391
  /**
282
392
  * Per-service alarm configuration.
283
393
  * - undefined: use defaults (CPU, memory, running tasks, 5xx if ALB)
@@ -285,6 +395,63 @@ export interface EcsServiceProps {
285
395
  * - object: override specific thresholds
286
396
  */
287
397
  alarms?: EcsServiceAlarmThresholds | false;
398
+ /**
399
+ * Deployment circuit breaker policy.
400
+ * - undefined (default): `{ enable: true, rollback: true }`
401
+ * - `false`: disabled entirely (no breaker)
402
+ * - `{ rollback: boolean }`: override rollback behaviour
403
+ *
404
+ * @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-circuit-breaker.html
405
+ */
406
+ circuitBreaker?: false | {
407
+ rollback?: boolean;
408
+ };
409
+ /**
410
+ * Rolling-deploy capacity bounds. Overrides the default
411
+ * `{ minHealthyPercent: 100, maxHealthyPercent: 200 }`. Singletons backed
412
+ * by an EBS volume that only one task can attach to (e.g. ClickHouse) need
413
+ * `{ minHealthyPercent: 0, maxHealthyPercent: 100 }` so the old task
414
+ * detaches before the new one starts.
415
+ *
416
+ * Bounds enforced by `validateEcsClusterProps`: `minHealthyPercent` must be
417
+ * 0–100, `maxHealthyPercent` must be 100–200, and the two cannot both be
418
+ * `100` (no capacity to drain or expand — deploys would never roll forward).
419
+ */
420
+ deployment?: {
421
+ minHealthyPercent?: number;
422
+ maxHealthyPercent?: number;
423
+ };
424
+ /**
425
+ * Pre-registered Cloud Map service. When provided, the underlying
426
+ * `Ec2Service`/`FargateService` calls `associateCloudMapService(...)` after
427
+ * construction. The patterns layer registers the service via
428
+ * `app.getNamespace().registerService({ name })` and threads the resulting
429
+ * `IService` here — keeping the resources layer free of namespace lookup.
430
+ */
431
+ cloudMapService?: IService;
432
+ /**
433
+ * DNS record type registered against `cloudMapService`. Default: `"A"`
434
+ * (matches CDK's default and works under `awsvpc`). Set to `"SRV"` when
435
+ * the service runs under `host` or `bridge` network mode — CDK's
436
+ * `Ec2Service.associateCloudMapService(...)` rejects A records there and
437
+ * requires `containerName` + `containerPort`, derived from the primary
438
+ * container.
439
+ */
440
+ cloudMapDnsRecordType?: "A" | "SRV";
441
+ /**
442
+ * Override the task definition's `NetworkMode`. Default for EC2 services
443
+ * is `AWS_VPC` (or `HOST` when `cluster.directAccess`); set to `BRIDGE`
444
+ * for dynamic-port-mapping ALB integration or when ENI quota is a concern.
445
+ */
446
+ networkMode?: NetworkMode;
447
+ /**
448
+ * Pre-existing security groups to attach to the service's task ENIs (AWS_VPC
449
+ * mode) instead of letting CDK auto-generate a default service SG. Used by
450
+ * stateful consumers (e.g. `ClickHouseDatabase`) that own a wrapper SG and
451
+ * need `this.connections.securityGroups[0]` to be the SG actually arbitrating
452
+ * inbound traffic to the task. Empty/omitted → CDK auto-creates one.
453
+ */
454
+ securityGroups?: ISecurityGroup[];
288
455
  }
289
456
  /**
290
457
  * Props for creating an ECS cluster with multiple services.
@@ -3,6 +3,15 @@ import type { EcsClusterProps } from "./ecsTypes.js";
3
3
  * Validates ECS cluster props before construction.
4
4
  * Pure function — does not depend on class state.
5
5
  *
6
+ * Note: `service.migrations` and `service.migrations.separateTaskDef` are
7
+ * intentionally validated only at the patterns layer (`validateEcsProps`
8
+ * in `lib/patterns/aws/computeEcs.ts`). The migrations sugar is a
9
+ * patterns-layer concept — it is translated into `service.containers`
10
+ * (init-container mode) or a separate Fargate task definition + lifecycle
11
+ * hook (lifecycle-hook mode) BEFORE reaching `EcsClusterProps`. Resources-
12
+ * layer consumers never see a `migrations` field, so duplicating the
13
+ * validation here would be unreachable.
14
+ *
6
15
  * @param props - The cluster props to validate
7
16
  * @throws Error if validation fails
8
17
  */
@@ -1,7 +1,17 @@
1
+ import { NetworkMode } from "aws-cdk-lib/aws-ecs";
1
2
  /**
2
3
  * Validates ECS cluster props before construction.
3
4
  * Pure function — does not depend on class state.
4
5
  *
6
+ * Note: `service.migrations` and `service.migrations.separateTaskDef` are
7
+ * intentionally validated only at the patterns layer (`validateEcsProps`
8
+ * in `lib/patterns/aws/computeEcs.ts`). The migrations sugar is a
9
+ * patterns-layer concept — it is translated into `service.containers`
10
+ * (init-container mode) or a separate Fargate task definition + lifecycle
11
+ * hook (lifecycle-hook mode) BEFORE reaching `EcsClusterProps`. Resources-
12
+ * layer consumers never see a `migrations` field, so duplicating the
13
+ * validation here would be unreachable.
14
+ *
5
15
  * @param props - The cluster props to validate
6
16
  * @throws Error if validation fails
7
17
  */
@@ -47,6 +57,59 @@ export function validateEcsClusterProps(props) {
47
57
  throw new Error(`Service '${service.name}': Duplicate container names: ` +
48
58
  `${[...new Set(duplicateContainers)].join(", ")}`);
49
59
  }
60
+ for (const container of service.containers) {
61
+ if (container.stopTimeout !== undefined) {
62
+ if (!Number.isInteger(container.stopTimeout) ||
63
+ container.stopTimeout < 1 ||
64
+ container.stopTimeout > 120) {
65
+ throw new Error(`Service '${service.name}', container '${container.name ?? "(default)"}': ` +
66
+ `stopTimeout must be an integer between 1 and 120 seconds (got ${container.stopTimeout}).`);
67
+ }
68
+ }
69
+ }
70
+ if (service.capacityProvider === "EC2" && !service.ec2Config) {
71
+ throw new Error(`Service '${service.name}' uses EC2 capacity provider but no ec2Config is defined. ` +
72
+ "Provide ec2Config on the service.");
73
+ }
74
+ if (service.deployment !== undefined) {
75
+ const min = service.deployment.minHealthyPercent;
76
+ const max = service.deployment.maxHealthyPercent;
77
+ if (min !== undefined && (min < 0 || min > 100)) {
78
+ throw new Error(`Service '${service.name}': deployment.minHealthyPercent must be between 0 and 100 (got ${min}).`);
79
+ }
80
+ if (max !== undefined && (max < 100 || max > 200)) {
81
+ throw new Error(`Service '${service.name}': deployment.maxHealthyPercent must be between 100 and 200 (got ${max}).`);
82
+ }
83
+ if (min === 100 && max === 100) {
84
+ throw new Error(`Service '${service.name}': deployment.minHealthyPercent and maxHealthyPercent cannot both be 100 ` +
85
+ "(no capacity to drain or expand — deploys would never roll forward).");
86
+ }
87
+ }
88
+ if (service.cloudMapDnsRecordType !== undefined &&
89
+ service.cloudMapService === undefined) {
90
+ throw new Error(`Service '${service.name}': cloudMapDnsRecordType is set but cloudMapService is not. ` +
91
+ "Service discovery cannot be registered without a Cloud Map namespace.");
92
+ }
93
+ if (service.desiredCount === 0 &&
94
+ service.minCapacity !== undefined &&
95
+ service.minCapacity > 0) {
96
+ throw new Error(`Service '${service.name}': scaling.minCapacity (${service.minCapacity}) cannot exceed desiredCount when desiredCount is 0. ` +
97
+ "Application Auto Scaling would immediately scale the service back up, defeating the desiredCount: 0 toggle. " +
98
+ "Either set scaling.minCapacity to 0 (placeholder service) or raise desiredCount to match scaling.minCapacity.");
99
+ }
100
+ if (service.capacityProvider === "EC2" &&
101
+ service.securityGroups !== undefined &&
102
+ service.securityGroups.length > 0) {
103
+ const directAccessForceHost = props.cluster?.directAccess === true;
104
+ const effectiveMode = service.networkMode ??
105
+ (directAccessForceHost ? NetworkMode.HOST : NetworkMode.AWS_VPC);
106
+ if (effectiveMode !== NetworkMode.AWS_VPC) {
107
+ throw new Error(`Service '${service.name}': securityGroups is only valid with networkMode AWS_VPC ` +
108
+ `(effective networkMode is '${effectiveMode}'). HOST/BRIDGE services share ` +
109
+ `the EC2 instance ENI, which is governed by the cluster-level securityGroup ` +
110
+ `on EcsClusterConfig.`);
111
+ }
112
+ }
50
113
  }
51
114
  }
52
115
  /**
@@ -1,3 +1,5 @@
1
+ export * from "./blockDeviceVolume.js";
1
2
  export * from "./ec2.js";
2
3
  export * from "./ecs.js";
3
4
  export * from "./lambda.js";
5
+ export * from "./samApplication.js";
@@ -1,3 +1,5 @@
1
+ export * from "./blockDeviceVolume.js";
1
2
  export * from "./ec2.js";
2
3
  export * from "./ecs.js";
3
4
  export * from "./lambda.js";
5
+ export * from "./samApplication.js";
@@ -2,7 +2,7 @@ import { SingletonFunction as singletonFunction, Function, Code, type Runtime, A
2
2
  import { type Bucket } from "aws-cdk-lib/aws-s3";
3
3
  import { PolicyStatement, type IRole } from "aws-cdk-lib/aws-iam";
4
4
  import { type IVpc } from "aws-cdk-lib/aws-ec2";
5
- import { Rule, type EventPattern } from "aws-cdk-lib/aws-events";
5
+ import { RetentionDays } from "aws-cdk-lib/aws-logs";
6
6
  import { type IQueue } from "aws-cdk-lib/aws-sqs";
7
7
  import { type ITable } from "aws-cdk-lib/aws-dynamodb";
8
8
  import { type Construct } from "constructs";
@@ -23,6 +23,12 @@ export interface LambdaFunctionProps {
23
23
  memorySize?: number;
24
24
  /** Ephemeral storage size in MiB */
25
25
  ephemeralStorageSize?: number;
26
+ /**
27
+ * Log retention for the auto-created LogGroup. Defaults to one week.
28
+ * Override for Lambdas whose logs back operational debugging beyond the
29
+ * default window (e.g. deployment lifecycle hooks).
30
+ */
31
+ logGroupRetention?: RetentionDays;
26
32
  inlinePolicy: PolicyStatement[];
27
33
  enableFunctionUrl?: boolean;
28
34
  functionUrlAuthType?: FunctionUrlAuthType;
@@ -30,8 +36,6 @@ export interface LambdaFunctionProps {
30
36
  /** Invoke mode for Function URL. Use RESPONSE_STREAM for Lambda streaming. */
31
37
  functionUrlInvokeMode?: InvokeMode;
32
38
  environment?: KeyValue;
33
- tags?: KeyValue;
34
- scheduleExpression?: string;
35
39
  secrets?: string[];
36
40
  ssmSecretsPath?: string;
37
41
  secretsImport?: Record<string, SecretImport>;
@@ -100,16 +104,6 @@ export declare class LambdaFunction extends Function {
100
104
  suffix?: string;
101
105
  }>;
102
106
  }): void;
103
- /**
104
- * Add an EventBridge rule as an event source for this Lambda function.
105
- * This will trigger the Lambda when events matching the pattern are published.
106
- * Useful for scheduled jobs, cross-service event handling, and custom event patterns.
107
- */
108
- addEventBridgeEventSource(ruleId: string, options: {
109
- schedule?: string;
110
- eventPattern?: EventPattern;
111
- description?: string;
112
- }): Rule;
113
107
  /**
114
108
  * Add secrets support using AWS Parameters and Secrets Lambda Extension.
115
109
  *
@@ -6,9 +6,8 @@ import { fileURLToPath } from "node:url";
6
6
  import { SqsEventSource, DynamoEventSource, S3EventSource } from "aws-cdk-lib/aws-lambda-event-sources";
7
7
  import { EventType } from "aws-cdk-lib/aws-s3";
8
8
  import { PolicyStatement, Effect } from "aws-cdk-lib/aws-iam";
9
- import { Rule, Schedule } from "aws-cdk-lib/aws-events";
10
- import { LambdaFunction as LambdaTarget } from "aws-cdk-lib/aws-events-targets";
11
- import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs";
9
+ import { RetentionDays } from "aws-cdk-lib/aws-logs";
10
+ import { LogGroup } from "../logging/logGroup.js";
12
11
  import { Secret } from "aws-cdk-lib/aws-secretsmanager";
13
12
  import { v4 as uuid } from "uuid";
14
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -20,6 +19,18 @@ function addPoliciesToRole(target, statements) {
20
19
  target.addToRolePolicy(statement);
21
20
  }
22
21
  }
22
+ /**
23
+ * CDK's auto-generated Lambda execution role does not accept a description
24
+ * through FunctionProps; reach for the L1 CfnRole and set it directly so
25
+ * SOC2 audits see a meaningful purpose on every role.
26
+ */
27
+ function applyRoleDescription(fn, description) {
28
+ if (description === undefined)
29
+ return;
30
+ const cfnRole = fn.role?.node.defaultChild;
31
+ if (cfnRole !== undefined)
32
+ cfnRole.description = description;
33
+ }
23
34
  /**
24
35
  * AWS Parameters and Secrets Lambda Extension configuration.
25
36
  * @see https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html
@@ -30,19 +41,26 @@ const SECRETS_EXTENSION = {
30
41
  /** Cache TTL in seconds - 60s supports secret rotation while reducing API calls */
31
42
  CACHE_TTL_SECONDS: "60"
32
43
  };
44
+ /**
45
+ * Default Lambda timeout in seconds. Coupled across the singleton constructor,
46
+ * the standard constructor, and the alarm wiring — drift would silently
47
+ * mis-tune alarms relative to runtime behaviour.
48
+ */
49
+ const LAMBDA_DEFAULT_TIMEOUT_SECONDS = 300;
33
50
  export class SingletonFunction extends singletonFunction {
34
51
  constructor(scope, id, props) {
35
52
  super(scope, id, {
36
53
  ...props,
37
54
  uuid: props.uuid ?? uuid(),
38
- timeout: Duration.seconds(300),
39
- description: props.lambdaDescription || `${id} singleton lambda`,
55
+ timeout: Duration.seconds(props.timeout ?? LAMBDA_DEFAULT_TIMEOUT_SECONDS),
56
+ description: props.lambdaDescription ?? `${id} singleton lambda`,
40
57
  runtime: props.runtime,
41
58
  ephemeralStorageSize: props.ephemeralStorageSize
42
59
  ? Size.mebibytes(props.ephemeralStorageSize)
43
60
  : undefined
44
61
  });
45
62
  addPoliciesToRole(this, props.inlinePolicy);
63
+ applyRoleDescription(this, props.roleDescription);
46
64
  }
47
65
  /**
48
66
  * The Lambda's execution role (auto-generated by CDK)
@@ -60,26 +78,25 @@ export class LambdaFunction extends Function {
60
78
  super(scope, id, {
61
79
  ...props,
62
80
  vpcSubnets,
63
- timeout: props.timeout
64
- ? Duration.seconds(props.timeout)
65
- : Duration.seconds(300),
66
- memorySize: props.memorySize || 128,
81
+ timeout: Duration.seconds(props.timeout ?? LAMBDA_DEFAULT_TIMEOUT_SECONDS),
82
+ memorySize: props.memorySize ?? 128,
67
83
  ephemeralStorageSize: props.ephemeralStorageSize
68
84
  ? Size.mebibytes(props.ephemeralStorageSize)
69
85
  : undefined,
70
- description: props.lambdaDescription || `${id} Lambda`,
86
+ description: props.lambdaDescription ?? `${id} Lambda`,
71
87
  environment: props.environment,
72
88
  logGroup: new LogGroup(scope, `${id}LogGroup`, {
73
- retention: RetentionDays.ONE_WEEK
89
+ retention: props.logGroupRetention ?? RetentionDays.ONE_WEEK
74
90
  })
75
91
  });
76
92
  addPoliciesToRole(this, props.inlinePolicy);
93
+ applyRoleDescription(this, props.roleDescription);
77
94
  this.addSecretsSupport(props.secrets, props.ssmSecretsPath, props.secretsImport, props.appName, props.functionName, props.architecture);
78
95
  // Sanitise id for CloudFormation output keys (must be alphanumeric)
79
96
  const outputName = toPascalCase(id);
80
97
  if (props.enableFunctionUrl) {
81
98
  const functionUrl = this.addFunctionUrl({
82
- authType: props.functionUrlAuthType || FunctionUrlAuthType.AWS_IAM,
99
+ authType: props.functionUrlAuthType ?? FunctionUrlAuthType.AWS_IAM,
83
100
  cors: props.functionUrlCors,
84
101
  invokeMode: props.functionUrlInvokeMode
85
102
  });
@@ -95,14 +112,8 @@ export class LambdaFunction extends Function {
95
112
  value: this.functionArn,
96
113
  description: `${id} Function ARN`
97
114
  });
98
- if (props.scheduleExpression) {
99
- const rule = new Rule(this, `${id}ScheduleRule`, {
100
- schedule: Schedule.expression(props.scheduleExpression)
101
- });
102
- rule.addTarget(new LambdaTarget(this));
103
- }
104
115
  if (props.alertsTopic && props.alarms !== false) {
105
- const timeoutSeconds = props.timeout ?? 300;
116
+ const timeoutSeconds = props.timeout ?? LAMBDA_DEFAULT_TIMEOUT_SECONDS;
106
117
  createLambdaAlarms({
107
118
  scope: this,
108
119
  functionName: id,
@@ -194,25 +205,6 @@ export class LambdaFunction extends Function {
194
205
  const eventSource = new S3EventSource(bucket, s3EventSourceProps);
195
206
  this.addEventSource(eventSource);
196
207
  }
197
- /**
198
- * Add an EventBridge rule as an event source for this Lambda function.
199
- * This will trigger the Lambda when events matching the pattern are published.
200
- * Useful for scheduled jobs, cross-service event handling, and custom event patterns.
201
- */
202
- addEventBridgeEventSource(ruleId, options) {
203
- if (!options.schedule && !options.eventPattern) {
204
- throw new Error("EventBridge rule requires either schedule or eventPattern");
205
- }
206
- const rule = new Rule(this, ruleId, {
207
- schedule: options.schedule
208
- ? Schedule.expression(options.schedule)
209
- : undefined,
210
- eventPattern: options.eventPattern,
211
- description: options.description
212
- });
213
- rule.addTarget(new LambdaTarget(this));
214
- return rule;
215
- }
216
208
  /**
217
209
  * Add secrets support using AWS Parameters and Secrets Lambda Extension.
218
210
  *