@fjall/components-infrastructure 0.89.5 → 0.94.0

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 (378) hide show
  1. package/LICENSE +50 -21
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -18
  4. package/dist/lib/app.d.ts +12 -12
  5. package/dist/lib/app.js +61 -56
  6. package/dist/lib/aspects/index.d.ts +1 -1
  7. package/dist/lib/aspects/index.js +1 -6
  8. package/dist/lib/aspects/resourceInventory.js +6 -13
  9. package/dist/lib/config/audit.js +1 -5
  10. package/dist/lib/config/aws/accessAnalyser.d.ts +11 -0
  11. package/dist/lib/config/aws/accessAnalyser.js +17 -0
  12. package/dist/lib/config/aws/accountAuditRole.js +11 -15
  13. package/dist/lib/config/aws/accountMonitoringRole.js +25 -29
  14. package/dist/lib/config/aws/alarmTopic.d.ts +8 -0
  15. package/dist/lib/config/aws/alarmTopic.js +19 -0
  16. package/dist/lib/config/aws/cloudTrail.js +4 -9
  17. package/dist/lib/config/aws/configRecorder.d.ts +16 -0
  18. package/dist/lib/config/aws/configRecorder.js +51 -0
  19. package/dist/lib/config/aws/configRulePreset.d.ts +13 -0
  20. package/dist/lib/config/aws/configRulePreset.js +62 -0
  21. package/dist/lib/config/aws/disasterRecovery.d.ts +1 -1
  22. package/dist/lib/config/aws/disasterRecovery.js +56 -73
  23. package/dist/lib/config/aws/ebsDefaultEncryption.d.ts +8 -0
  24. package/dist/lib/config/aws/ebsDefaultEncryption.js +41 -0
  25. package/dist/lib/config/aws/ecrDefaultImage.js +25 -30
  26. package/dist/lib/config/aws/eventBus.js +8 -11
  27. package/dist/lib/config/aws/guardDutyDetector.d.ts +16 -0
  28. package/dist/lib/config/aws/guardDutyDetector.js +26 -0
  29. package/dist/lib/config/aws/identityCenter.d.ts +1 -1
  30. package/dist/lib/config/aws/identityCenter.js +23 -25
  31. package/dist/lib/config/aws/identityCenterGroupMembership.js +18 -22
  32. package/dist/lib/config/aws/index.d.ts +19 -8
  33. package/dist/lib/config/aws/index.js +19 -25
  34. package/dist/lib/config/aws/inspectorEnablement.d.ts +9 -0
  35. package/dist/lib/config/aws/inspectorEnablement.js +51 -0
  36. package/dist/lib/config/aws/ipam.js +9 -13
  37. package/dist/lib/config/aws/oidcConnector.js +8 -12
  38. package/dist/lib/config/aws/platform.js +1 -5
  39. package/dist/lib/config/aws/s3BlockPublicAccess.d.ts +9 -0
  40. package/dist/lib/config/aws/s3BlockPublicAccess.js +55 -0
  41. package/dist/lib/config/aws/scpPreset.d.ts +21 -0
  42. package/dist/lib/config/aws/scpPreset.js +311 -0
  43. package/dist/lib/config/aws/securityBaseline.d.ts +15 -0
  44. package/dist/lib/config/aws/securityBaseline.js +27 -0
  45. package/dist/lib/config/aws/securityHubHub.d.ts +15 -0
  46. package/dist/lib/config/aws/securityHubHub.js +28 -0
  47. package/dist/lib/config/aws/securityServicesAdmin.d.ts +20 -0
  48. package/dist/lib/config/aws/securityServicesAdmin.js +115 -0
  49. package/dist/lib/config/index.d.ts +2 -2
  50. package/dist/lib/config/index.js +2 -21
  51. package/dist/lib/index.d.ts +4 -4
  52. package/dist/lib/index.js +5 -26
  53. package/dist/lib/patterns/aws/account.d.ts +17 -1
  54. package/dist/lib/patterns/aws/account.js +60 -33
  55. package/dist/lib/patterns/aws/apexDomainPattern.d.ts +26 -0
  56. package/dist/lib/patterns/aws/apexDomainPattern.js +91 -0
  57. package/dist/lib/patterns/aws/auditRole.js +13 -16
  58. package/dist/lib/patterns/aws/buildkite.d.ts +1 -1
  59. package/dist/lib/patterns/aws/buildkite.js +70 -75
  60. package/dist/lib/patterns/aws/cdn.d.ts +5 -5
  61. package/dist/lib/patterns/aws/cdn.js +22 -28
  62. package/dist/lib/patterns/aws/compute.d.ts +1 -1
  63. package/dist/lib/patterns/aws/compute.js +31 -44
  64. package/dist/lib/patterns/aws/computeEc2.d.ts +1 -1
  65. package/dist/lib/patterns/aws/computeEc2.js +11 -14
  66. package/dist/lib/patterns/aws/computeEcs.d.ts +18 -2
  67. package/dist/lib/patterns/aws/computeEcs.js +41 -31
  68. package/dist/lib/patterns/aws/computeLambda.d.ts +2 -2
  69. package/dist/lib/patterns/aws/computeLambda.js +24 -31
  70. package/dist/lib/patterns/aws/database.d.ts +16 -7
  71. package/dist/lib/patterns/aws/database.js +81 -73
  72. package/dist/lib/patterns/aws/delegatedDomainPattern.d.ts +17 -0
  73. package/dist/lib/patterns/aws/delegatedDomainPattern.js +54 -0
  74. package/dist/lib/patterns/aws/dnsRecordComposer.d.ts +25 -0
  75. package/dist/lib/patterns/aws/dnsRecordComposer.js +225 -0
  76. package/dist/lib/patterns/aws/domain.d.ts +32 -0
  77. package/dist/lib/patterns/aws/domain.js +115 -0
  78. package/dist/lib/patterns/aws/domainDelegation.d.ts +3 -3
  79. package/dist/lib/patterns/aws/domainDelegation.js +28 -37
  80. package/dist/lib/patterns/aws/domainFactory.d.ts +20 -5
  81. package/dist/lib/patterns/aws/domainFactory.js +48 -10
  82. package/dist/lib/patterns/aws/domainValidation.d.ts +11 -0
  83. package/dist/lib/patterns/aws/domainValidation.js +145 -0
  84. package/dist/lib/patterns/aws/externalRecordsPattern.d.ts +18 -0
  85. package/dist/lib/patterns/aws/externalRecordsPattern.js +141 -0
  86. package/dist/lib/patterns/aws/fivetranProxy.d.ts +1 -1
  87. package/dist/lib/patterns/aws/fivetranProxy.js +6 -11
  88. package/dist/lib/patterns/aws/index.d.ts +21 -19
  89. package/dist/lib/patterns/aws/index.js +25 -36
  90. package/dist/lib/patterns/aws/interfaces/cdn.js +1 -5
  91. package/dist/lib/patterns/aws/interfaces/compute.js +4 -11
  92. package/dist/lib/patterns/aws/interfaces/connector.js +1 -15
  93. package/dist/lib/patterns/aws/interfaces/database.d.ts +1 -1
  94. package/dist/lib/patterns/aws/interfaces/database.js +6 -15
  95. package/dist/lib/patterns/aws/interfaces/domain.d.ts +80 -2
  96. package/dist/lib/patterns/aws/interfaces/domain.js +1 -6
  97. package/dist/lib/patterns/aws/interfaces/index.js +8 -41
  98. package/dist/lib/patterns/aws/interfaces/messaging.js +4 -11
  99. package/dist/lib/patterns/aws/interfaces/organisation.d.ts +1 -1
  100. package/dist/lib/patterns/aws/interfaces/organisation.js +4 -11
  101. package/dist/lib/patterns/aws/interfaces/pattern.js +2 -7
  102. package/dist/lib/patterns/aws/interfaces/storage.js +1 -5
  103. package/dist/lib/patterns/aws/managedIdentityCenter.js +7 -12
  104. package/dist/lib/patterns/aws/messaging.d.ts +7 -7
  105. package/dist/lib/patterns/aws/messaging.js +22 -33
  106. package/dist/lib/patterns/aws/network.d.ts +2 -2
  107. package/dist/lib/patterns/aws/network.js +9 -14
  108. package/dist/lib/patterns/aws/organisation.d.ts +6 -2
  109. package/dist/lib/patterns/aws/organisation.js +34 -35
  110. package/dist/lib/patterns/aws/organisationFactory.d.ts +3 -3
  111. package/dist/lib/patterns/aws/organisationFactory.js +7 -12
  112. package/dist/lib/patterns/aws/pattern.js +6 -12
  113. package/dist/lib/patterns/aws/payload.js +73 -63
  114. package/dist/lib/patterns/aws/platform.d.ts +6 -3
  115. package/dist/lib/patterns/aws/platform.js +15 -15
  116. package/dist/lib/patterns/aws/storage.d.ts +6 -4
  117. package/dist/lib/patterns/aws/storage.js +35 -40
  118. package/dist/lib/patterns/aws/subdomainHostedZone.js +11 -16
  119. package/dist/lib/patterns/aws/targets/fjallTargets.d.ts +37 -0
  120. package/dist/lib/patterns/aws/targets/fjallTargets.js +66 -0
  121. package/dist/lib/patterns/aws/targets/index.d.ts +2 -0
  122. package/dist/lib/patterns/aws/targets/index.js +2 -0
  123. package/dist/lib/patterns/aws/targets/targetResolution.d.ts +76 -0
  124. package/dist/lib/patterns/aws/targets/targetResolution.js +119 -0
  125. package/dist/lib/patterns/index.d.ts +1 -0
  126. package/dist/lib/patterns/index.js +1 -0
  127. package/dist/lib/resources/aws/analytics/clickhouse.d.ts +15 -0
  128. package/dist/lib/resources/aws/analytics/clickhouse.js +292 -0
  129. package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +73 -0
  130. package/dist/lib/resources/aws/analytics/clickhouseConstants.js +87 -0
  131. package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.d.ts +13 -0
  132. package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.js +28 -0
  133. package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +47 -0
  134. package/dist/lib/resources/aws/analytics/clickhouseTypes.js +1 -0
  135. package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +5 -0
  136. package/dist/lib/resources/aws/analytics/clickhouseUserData.js +248 -0
  137. package/dist/lib/resources/aws/analytics/index.d.ts +2 -0
  138. package/dist/lib/resources/aws/analytics/index.js +1 -0
  139. package/dist/lib/resources/aws/audit/auditRole.js +10 -15
  140. package/dist/lib/resources/aws/audit/index.d.ts +1 -1
  141. package/dist/lib/resources/aws/audit/index.js +1 -6
  142. package/dist/lib/resources/aws/backup/backupPlan.d.ts +1 -1
  143. package/dist/lib/resources/aws/backup/backupPlan.js +14 -16
  144. package/dist/lib/resources/aws/backup/backupVault.d.ts +1 -1
  145. package/dist/lib/resources/aws/backup/backupVault.js +13 -15
  146. package/dist/lib/resources/aws/backup/index.d.ts +2 -2
  147. package/dist/lib/resources/aws/backup/index.js +2 -19
  148. package/dist/lib/resources/aws/base/awsStack.js +17 -19
  149. package/dist/lib/resources/aws/base/index.d.ts +1 -1
  150. package/dist/lib/resources/aws/base/index.js +1 -18
  151. package/dist/lib/resources/aws/cdn/cloudFront.js +40 -42
  152. package/dist/lib/resources/aws/cdn/index.d.ts +1 -1
  153. package/dist/lib/resources/aws/cdn/index.js +1 -18
  154. package/dist/lib/resources/aws/compute/ec2.js +39 -39
  155. package/dist/lib/resources/aws/compute/ecs.d.ts +18 -396
  156. package/dist/lib/resources/aws/compute/ecs.js +105 -976
  157. package/dist/lib/resources/aws/compute/ecsCapacityProviderAspect.d.ts +22 -0
  158. package/dist/lib/resources/aws/compute/ecsCapacityProviderAspect.js +35 -0
  159. package/dist/lib/resources/aws/compute/ecsConstants.d.ts +20 -0
  160. package/dist/lib/resources/aws/compute/ecsConstants.js +49 -0
  161. package/dist/lib/resources/aws/compute/ecsContext.d.ts +12 -0
  162. package/dist/lib/resources/aws/compute/ecsContext.js +1 -0
  163. package/dist/lib/resources/aws/compute/ecsImages.d.ts +4 -0
  164. package/dist/lib/resources/aws/compute/ecsImages.js +35 -0
  165. package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +28 -0
  166. package/dist/lib/resources/aws/compute/ecsNetworking.js +290 -0
  167. package/dist/lib/resources/aws/compute/ecsRoles.d.ts +15 -0
  168. package/dist/lib/resources/aws/compute/ecsRoles.js +110 -0
  169. package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +33 -0
  170. package/dist/lib/resources/aws/compute/ecsServiceFactory.js +183 -0
  171. package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +30 -0
  172. package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +168 -0
  173. package/dist/lib/resources/aws/compute/ecsTypes.d.ts +337 -0
  174. package/dist/lib/resources/aws/compute/ecsTypes.js +10 -0
  175. package/dist/lib/resources/aws/compute/ecsValidation.d.ts +18 -0
  176. package/dist/lib/resources/aws/compute/ecsValidation.js +72 -0
  177. package/dist/lib/resources/aws/compute/index.d.ts +3 -3
  178. package/dist/lib/resources/aws/compute/index.js +3 -20
  179. package/dist/lib/resources/aws/compute/lambda.d.ts +10 -2
  180. package/dist/lib/resources/aws/compute/lambda.js +81 -71
  181. package/dist/lib/resources/aws/database/dynamodb.js +24 -27
  182. package/dist/lib/resources/aws/database/index.d.ts +7 -7
  183. package/dist/lib/resources/aws/database/index.js +14 -33
  184. package/dist/lib/resources/aws/database/rdsAurora.d.ts +10 -2
  185. package/dist/lib/resources/aws/database/rdsAurora.js +76 -61
  186. package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +2 -2
  187. package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +24 -21
  188. package/dist/lib/resources/aws/database/rdsDefaults.js +3 -7
  189. package/dist/lib/resources/aws/database/rdsHelpers.d.ts +2 -2
  190. package/dist/lib/resources/aws/database/rdsHelpers.js +21 -29
  191. package/dist/lib/resources/aws/database/rdsInstance.d.ts +11 -3
  192. package/dist/lib/resources/aws/database/rdsInstance.js +101 -83
  193. package/dist/lib/resources/aws/database/rdsProxyOutput.js +5 -9
  194. package/dist/lib/resources/aws/iam/delegationRole.d.ts +18 -0
  195. package/dist/lib/resources/aws/iam/delegationRole.js +60 -0
  196. package/dist/lib/resources/aws/iam/identityCenter/assignment.js +4 -9
  197. package/dist/lib/resources/aws/iam/identityCenter/group.js +5 -9
  198. package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +3 -3
  199. package/dist/lib/resources/aws/iam/identityCenter/index.js +3 -20
  200. package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -1
  201. package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +5 -9
  202. package/dist/lib/resources/aws/iam/index.d.ts +5 -4
  203. package/dist/lib/resources/aws/iam/index.js +5 -21
  204. package/dist/lib/resources/aws/iam/instanceProfile.js +2 -7
  205. package/dist/lib/resources/aws/iam/managedPolicy.js +2 -7
  206. package/dist/lib/resources/aws/iam/policy.js +2 -7
  207. package/dist/lib/resources/aws/iam/role.js +2 -7
  208. package/dist/lib/resources/aws/index.d.ts +7 -7
  209. package/dist/lib/resources/aws/index.js +7 -24
  210. package/dist/lib/resources/aws/logging/cloudTrail.d.ts +1 -1
  211. package/dist/lib/resources/aws/logging/cloudTrail.js +18 -22
  212. package/dist/lib/resources/aws/logging/index.d.ts +2 -2
  213. package/dist/lib/resources/aws/logging/index.js +2 -19
  214. package/dist/lib/resources/aws/logging/logGroup.js +4 -10
  215. package/dist/lib/resources/aws/messaging/eventbridge.js +11 -14
  216. package/dist/lib/resources/aws/messaging/index.d.ts +4 -4
  217. package/dist/lib/resources/aws/messaging/index.js +4 -21
  218. package/dist/lib/resources/aws/messaging/sns.js +11 -14
  219. package/dist/lib/resources/aws/messaging/sqs.js +32 -34
  220. package/dist/lib/resources/aws/messaging/utils.d.ts +1 -1
  221. package/dist/lib/resources/aws/messaging/utils.js +1 -6
  222. package/dist/lib/resources/aws/monitoring/alarmDefaults.d.ts +36 -0
  223. package/dist/lib/resources/aws/monitoring/alarmDefaults.js +34 -0
  224. package/dist/lib/resources/aws/monitoring/ecsAlarms.d.ts +21 -0
  225. package/dist/lib/resources/aws/monitoring/ecsAlarms.js +88 -0
  226. package/dist/lib/resources/aws/monitoring/index.d.ts +4 -0
  227. package/dist/lib/resources/aws/monitoring/index.js +4 -5
  228. package/dist/lib/resources/aws/monitoring/lambdaAlarms.d.ts +18 -0
  229. package/dist/lib/resources/aws/monitoring/lambdaAlarms.js +44 -0
  230. package/dist/lib/resources/aws/monitoring/rdsAlarms.d.ts +20 -0
  231. package/dist/lib/resources/aws/monitoring/rdsAlarms.js +52 -0
  232. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.d.ts +17 -0
  233. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +26 -0
  234. package/dist/lib/resources/aws/networking/dnsRecord/aRecord.d.ts +12 -0
  235. package/dist/lib/resources/aws/networking/dnsRecord/aRecord.js +21 -0
  236. package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.d.ts +12 -0
  237. package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.js +22 -0
  238. package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.d.ts +12 -0
  239. package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.js +23 -0
  240. package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.d.ts +17 -0
  241. package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.js +21 -0
  242. package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.d.ts +12 -0
  243. package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.js +22 -0
  244. package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.d.ts +17 -0
  245. package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +17 -0
  246. package/dist/lib/resources/aws/networking/dnsRecord/index.d.ts +10 -0
  247. package/dist/lib/resources/aws/networking/dnsRecord/index.js +10 -0
  248. package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.d.ts +16 -0
  249. package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.js +21 -0
  250. package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.d.ts +12 -0
  251. package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.js +21 -0
  252. package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.d.ts +18 -0
  253. package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.js +21 -0
  254. package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.d.ts +12 -0
  255. package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.js +21 -0
  256. package/dist/lib/resources/aws/networking/domain.d.ts +1 -1
  257. package/dist/lib/resources/aws/networking/domain.js +32 -34
  258. package/dist/lib/resources/aws/networking/domainCertificate.d.ts +8 -3
  259. package/dist/lib/resources/aws/networking/domainCertificate.js +22 -16
  260. package/dist/lib/resources/aws/networking/hostedZone.d.ts +23 -19
  261. package/dist/lib/resources/aws/networking/hostedZone.js +70 -134
  262. package/dist/lib/resources/aws/networking/index.d.ts +8 -7
  263. package/dist/lib/resources/aws/networking/index.js +8 -24
  264. package/dist/lib/resources/aws/networking/ipam.js +2 -7
  265. package/dist/lib/resources/aws/networking/ipamPool.d.ts +1 -1
  266. package/dist/lib/resources/aws/networking/ipamPool.js +45 -55
  267. package/dist/lib/resources/aws/networking/securityGroup.js +2 -7
  268. package/dist/lib/resources/aws/networking/vpc.d.ts +1 -1
  269. package/dist/lib/resources/aws/networking/vpc.js +17 -21
  270. package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +1 -1
  271. package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +11 -15
  272. package/dist/lib/resources/aws/organisation/index.d.ts +5 -5
  273. package/dist/lib/resources/aws/organisation/index.js +4 -12
  274. package/dist/lib/resources/aws/organisation/organisation.js +5 -7
  275. package/dist/lib/resources/aws/organisation/organisationAccount.js +7 -10
  276. package/dist/lib/resources/aws/organisation/organisationPolicy.js +5 -9
  277. package/dist/lib/resources/aws/organisation/organisationalUnit.js +1 -3
  278. package/dist/lib/resources/aws/secrets/alias.js +2 -7
  279. package/dist/lib/resources/aws/secrets/index.d.ts +4 -4
  280. package/dist/lib/resources/aws/secrets/index.js +4 -21
  281. package/dist/lib/resources/aws/secrets/kms.js +15 -18
  282. package/dist/lib/resources/aws/secrets/parameter.d.ts +3 -3
  283. package/dist/lib/resources/aws/secrets/parameter.js +19 -22
  284. package/dist/lib/resources/aws/secrets/secret.d.ts +2 -2
  285. package/dist/lib/resources/aws/secrets/secret.js +12 -14
  286. package/dist/lib/resources/aws/storage/ecr.d.ts +2 -2
  287. package/dist/lib/resources/aws/storage/ecr.js +7 -13
  288. package/dist/lib/resources/aws/storage/index.d.ts +2 -2
  289. package/dist/lib/resources/aws/storage/index.js +2 -19
  290. package/dist/lib/resources/aws/storage/s3.d.ts +1 -1
  291. package/dist/lib/resources/aws/storage/s3.js +24 -12
  292. package/dist/lib/resources/aws/utilities/awsCustomResource.js +3 -7
  293. package/dist/lib/resources/aws/utilities/codeBuild.js +7 -12
  294. package/dist/lib/resources/aws/utilities/customResource.js +14 -17
  295. package/dist/lib/resources/aws/utilities/customResourceProvider.js +2 -7
  296. package/dist/lib/resources/aws/utilities/index.d.ts +5 -5
  297. package/dist/lib/resources/aws/utilities/index.js +5 -22
  298. package/dist/lib/resources/aws/utilities/resourceShare.js +2 -7
  299. package/dist/lib/resources/index.d.ts +1 -1
  300. package/dist/lib/resources/index.js +1 -18
  301. package/dist/lib/types.js +1 -3
  302. package/dist/lib/utils/accountsUtils.d.ts +5 -0
  303. package/dist/lib/utils/accountsUtils.js +18 -0
  304. package/dist/lib/utils/addSuffixToEmail.js +1 -5
  305. package/dist/lib/utils/backupTierMapping.js +2 -6
  306. package/dist/lib/utils/capitaliseString.js +1 -10
  307. package/dist/lib/utils/connections.js +9 -13
  308. package/dist/lib/utils/connector.js +10 -23
  309. package/dist/lib/utils/constructMap.d.ts +33 -0
  310. package/dist/lib/utils/constructMap.js +154 -0
  311. package/dist/lib/utils/databaseTypes.js +4 -10
  312. package/dist/lib/utils/dnsRecords.d.ts +1 -1
  313. package/dist/lib/utils/dnsRecords.js +23 -27
  314. package/dist/lib/utils/domainTypes.d.ts +0 -1
  315. package/dist/lib/utils/domainTypes.js +2 -10
  316. package/dist/lib/utils/env.js +14 -26
  317. package/dist/lib/utils/getAccountId.js +3 -7
  318. package/dist/lib/utils/getAsync.js +7 -10
  319. package/dist/lib/utils/getConfig.d.ts +0 -2
  320. package/dist/lib/utils/getConfig.js +29 -47
  321. package/dist/lib/utils/getStackOutput.js +4 -8
  322. package/dist/lib/utils/index.d.ts +12 -12
  323. package/dist/lib/utils/index.js +12 -29
  324. package/dist/lib/utils/manifestWriter.d.ts +14 -3
  325. package/dist/lib/utils/manifestWriter.js +60 -43
  326. package/dist/lib/utils/orgConfigParser.d.ts +14 -0
  327. package/dist/lib/utils/orgConfigParser.js +49 -0
  328. package/dist/lib/utils/removalPolicy.js +5 -9
  329. package/dist/lib/utils/resourceNaming.js +11 -16
  330. package/dist/lib/utils/standardTagsAspect.js +9 -16
  331. package/dist/lib/utils/stripAndCamelCase.js +1 -5
  332. package/dist/lib/utils/validationLogger.js +12 -18
  333. package/dist/lib/utils/vpcUtils.js +5 -10
  334. package/package.json +25 -8
  335. package/dist/lib/config/aws/accountId.d.ts +0 -6
  336. package/dist/lib/config/aws/accountId.js +0 -32
  337. package/dist/lib/config/aws/backupGlobalSettings.d.ts +0 -29
  338. package/dist/lib/config/aws/backupGlobalSettings.js +0 -49
  339. package/dist/lib/config/aws/costAllocationTags.d.ts +0 -12
  340. package/dist/lib/config/aws/costAllocationTags.js +0 -47
  341. package/dist/lib/config/aws/ipamDelegateAdmin.d.ts +0 -8
  342. package/dist/lib/config/aws/ipamDelegateAdmin.js +0 -57
  343. package/dist/lib/config/aws/ipamPoolId.d.ts +0 -16
  344. package/dist/lib/config/aws/ipamPoolId.js +0 -42
  345. package/dist/lib/config/aws/organisation.d.ts +0 -30
  346. package/dist/lib/config/aws/organisation.js +0 -92
  347. package/dist/lib/config/aws/organisationId.d.ts +0 -7
  348. package/dist/lib/config/aws/organisationId.js +0 -45
  349. package/dist/lib/config/aws/organisationsAccess.d.ts +0 -10
  350. package/dist/lib/config/aws/organisationsAccess.js +0 -49
  351. package/dist/lib/config/aws/ramSharing.d.ts +0 -4
  352. package/dist/lib/config/aws/ramSharing.js +0 -34
  353. package/dist/lib/config/monitoring.d.ts +0 -18
  354. package/dist/lib/config/monitoring.js +0 -22
  355. package/dist/lib/patterns/aws/connections.d.ts +0 -46
  356. package/dist/lib/patterns/aws/connections.js +0 -159
  357. package/dist/lib/patterns/aws/hostedZone.d.ts +0 -28
  358. package/dist/lib/patterns/aws/hostedZone.js +0 -150
  359. package/dist/lib/patterns/aws/managedAccount.d.ts +0 -9
  360. package/dist/lib/patterns/aws/managedAccount.js +0 -55
  361. package/dist/lib/patterns/aws/managedOrganisation.d.ts +0 -36
  362. package/dist/lib/patterns/aws/managedOrganisation.js +0 -97
  363. package/dist/lib/patterns/aws/managedPlatform.d.ts +0 -12
  364. package/dist/lib/patterns/aws/managedPlatform.js +0 -29
  365. package/dist/lib/resources/aws/database/database.d.ts +0 -14
  366. package/dist/lib/resources/aws/database/database.js +0 -28
  367. package/dist/lib/resources/aws/database/databaseInstance.d.ts +0 -15
  368. package/dist/lib/resources/aws/database/databaseInstance.js +0 -30
  369. package/dist/lib/resources/aws/database/migrationLambda.d.ts +0 -80
  370. package/dist/lib/resources/aws/database/migrationLambda.js +0 -119
  371. package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.d.ts +0 -13
  372. package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.js +0 -51
  373. package/dist/lib/resources/aws/iam/securityGroup.d.ts +0 -5
  374. package/dist/lib/resources/aws/iam/securityGroup.js +0 -14
  375. package/dist/lib/resources/aws/monitoring/monitoringRole.d.ts +0 -29
  376. package/dist/lib/resources/aws/monitoring/monitoringRole.js +0 -120
  377. package/dist/lib/utils/capitalizeString.d.ts +0 -12
  378. package/dist/lib/utils/capitalizeString.js +0 -30
@@ -0,0 +1,183 @@
1
+ import { FargateService, Ec2Service, PropagatedTagSource, PlacementStrategy, AsgCapacityProvider, EcsOptimizedImage, AmiHardwareType } from "aws-cdk-lib/aws-ecs";
2
+ import { InstanceType, Peer, Port, SubnetType } from "aws-cdk-lib/aws-ec2";
3
+ import { CfnOutput, Duration } from "aws-cdk-lib";
4
+ import { PredefinedMetric, ScalableTarget, ServiceNamespace, TargetTrackingScalingPolicy } from "aws-cdk-lib/aws-applicationautoscaling";
5
+ import { AutoScalingGroup, Monitoring } from "aws-cdk-lib/aws-autoscaling";
6
+ import { SecurityGroup } from "../networking/securityGroup.js";
7
+ import { vpcHasNatGateways } from "../../../utils/vpcUtils.js";
8
+ import { toPascalCase } from "../../../utils/capitaliseString.js";
9
+ import { DEFAULT_EC2_INSTANCE_TYPE, DEFAULT_WARM_POOL_MIN_SIZE, DEFAULT_WARM_POOL_REUSE_ON_SCALE_IN, inferAmiHardwareType } from "./ecsConstants.js";
10
+ import { ScalingType } from "./ecsTypes.js";
11
+ import { isServiceFargate, isServiceEc2 } from "./ecsTaskDefinition.js";
12
+ /**
13
+ * Generates a unique key for EC2 config so services with matching
14
+ * configurations share an ASG.
15
+ */
16
+ export function getEc2ConfigKey(ec2Config) {
17
+ const instanceType = ec2Config.instanceType ?? DEFAULT_EC2_INSTANCE_TYPE;
18
+ const amiHardwareType = ec2Config.amiHardwareType ??
19
+ (inferAmiHardwareType(instanceType) === AmiHardwareType.ARM
20
+ ? "ARM"
21
+ : "STANDARD");
22
+ const warmPoolKey = ec2Config.warmPool
23
+ ? `wp${ec2Config.warmPool.minSize ?? DEFAULT_WARM_POOL_MIN_SIZE}-${ec2Config.warmPool.reuseOnScaleIn ?? DEFAULT_WARM_POOL_REUSE_ON_SCALE_IN}`
24
+ : "nowp";
25
+ return `${instanceType}-${amiHardwareType}-${warmPoolKey}`;
26
+ }
27
+ /**
28
+ * Gets or creates an ASG capacity provider for an EC2-backed service.
29
+ * Services with matching EC2 configs share the same ASG.
30
+ *
31
+ * Mutates `state` to track the provider and first ASG/security group.
32
+ */
33
+ export function getOrCreateAsgCapacityProvider(ctx, serviceProps, state) {
34
+ const ec2Config = serviceProps.ec2Config ?? {};
35
+ const key = getEc2ConfigKey(ec2Config);
36
+ const existing = state.providers.get(key);
37
+ if (existing) {
38
+ return existing;
39
+ }
40
+ const safeKey = key.replace(/[^a-zA-Z0-9]/g, "");
41
+ const instanceType = ec2Config.instanceType ?? DEFAULT_EC2_INSTANCE_TYPE;
42
+ const amiHardwareType = ec2Config.amiHardwareType
43
+ ? ec2Config.amiHardwareType === "STANDARD"
44
+ ? AmiHardwareType.STANDARD
45
+ : AmiHardwareType.ARM
46
+ : inferAmiHardwareType(instanceType);
47
+ const minCapacity = ec2Config.minCapacity ?? 2;
48
+ const maxCapacity = ec2Config.maxCapacity ?? 3;
49
+ const asgSecurityGroup = new SecurityGroup(ctx.scope, `${safeKey}AsgSecurityGroup`, {
50
+ vpc: ctx.cluster.vpc,
51
+ description: `Security group for ${key} auto scaling group`
52
+ });
53
+ if (ctx.directAccessEnabled) {
54
+ for (const service of ctx.props.services) {
55
+ if (isServiceEc2(service)) {
56
+ for (const container of service.containers) {
57
+ if (container.port) {
58
+ asgSecurityGroup.addIngressRule(Peer.anyIpv4(), Port.tcp(container.port), `Direct access to container port ${container.port}`);
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ const hasNat = vpcHasNatGateways(ctx.cluster.vpc);
65
+ const asg = new AutoScalingGroup(ctx.scope, `${safeKey}AutoScalingGroup`, {
66
+ autoScalingGroupName: `${ctx.props.clusterName}-${safeKey}-Asg`,
67
+ vpc: ctx.cluster.vpc,
68
+ vpcSubnets: {
69
+ subnetType: hasNat ? SubnetType.PRIVATE_WITH_EGRESS : SubnetType.PUBLIC
70
+ },
71
+ securityGroup: asgSecurityGroup,
72
+ minCapacity,
73
+ maxCapacity,
74
+ instanceType: new InstanceType(instanceType),
75
+ capacityRebalance: true,
76
+ instanceMonitoring: Monitoring.BASIC,
77
+ machineImage: EcsOptimizedImage.amazonLinux2023(amiHardwareType)
78
+ });
79
+ if (ec2Config.warmPool) {
80
+ asg.addWarmPool({
81
+ minSize: ec2Config.warmPool.minSize ?? DEFAULT_WARM_POOL_MIN_SIZE,
82
+ reuseOnScaleIn: ec2Config.warmPool.reuseOnScaleIn ?? DEFAULT_WARM_POOL_REUSE_ON_SCALE_IN
83
+ });
84
+ }
85
+ const provider = new AsgCapacityProvider(ctx.scope, `${safeKey}AsgCapacityProvider`, {
86
+ autoScalingGroup: asg,
87
+ enableManagedDraining: true,
88
+ enableManagedTerminationProtection: false
89
+ });
90
+ ctx.cluster.addAsgCapacityProvider(provider);
91
+ state.providers.set(key, provider);
92
+ if (!state.autoScalingGroup) {
93
+ state.autoScalingGroup = asg;
94
+ }
95
+ if (!state.asgSecurityGroup) {
96
+ state.asgSecurityGroup = asgSecurityGroup;
97
+ }
98
+ return provider;
99
+ }
100
+ /**
101
+ * Creates a Fargate or EC2 service and emits a CfnOutput for its ARN.
102
+ */
103
+ export function createService(ctx, serviceName, serviceProps, taskDefinition, asgState) {
104
+ const desiredCount = serviceProps.desiredCount ?? 2;
105
+ let service;
106
+ if (isServiceFargate(serviceProps)) {
107
+ const hasNat = vpcHasNatGateways(ctx.cluster.vpc);
108
+ service = new FargateService(ctx.scope, `${serviceName}Service`, {
109
+ cluster: ctx.cluster,
110
+ taskDefinition: taskDefinition,
111
+ desiredCount,
112
+ serviceName,
113
+ vpcSubnets: {
114
+ subnetType: hasNat ? SubnetType.PRIVATE_WITH_EGRESS : SubnetType.PUBLIC
115
+ },
116
+ assignPublicIp: !hasNat,
117
+ capacityProviderStrategies: [
118
+ {
119
+ capacityProvider: serviceProps.capacityProvider,
120
+ weight: 1
121
+ }
122
+ ],
123
+ propagateTags: PropagatedTagSource.SERVICE,
124
+ circuitBreaker: { enable: true, rollback: true },
125
+ enableECSManagedTags: true,
126
+ enableExecuteCommand: true,
127
+ healthCheckGracePeriod: Duration.seconds(120),
128
+ minHealthyPercent: 100,
129
+ maxHealthyPercent: 200
130
+ });
131
+ }
132
+ else {
133
+ const asgProvider = getOrCreateAsgCapacityProvider(ctx, serviceProps, asgState);
134
+ service = new Ec2Service(ctx.scope, `${serviceName}Service`, {
135
+ cluster: ctx.cluster,
136
+ taskDefinition: taskDefinition,
137
+ desiredCount,
138
+ serviceName,
139
+ capacityProviderStrategies: [
140
+ {
141
+ capacityProvider: asgProvider.capacityProviderName,
142
+ weight: 1
143
+ }
144
+ ],
145
+ propagateTags: PropagatedTagSource.SERVICE,
146
+ circuitBreaker: { enable: true, rollback: true },
147
+ placementStrategies: [PlacementStrategy.spreadAcrossInstances()],
148
+ enableECSManagedTags: true,
149
+ enableExecuteCommand: true,
150
+ healthCheckGracePeriod: Duration.seconds(120),
151
+ minHealthyPercent: 100,
152
+ maxHealthyPercent: 200
153
+ });
154
+ }
155
+ new CfnOutput(ctx.scope, `${ctx.outputName}${toPascalCase(serviceName)}ServiceArn`, {
156
+ key: `${ctx.outputName}${toPascalCase(serviceName)}ServiceArn`,
157
+ exportName: `${ctx.props.clusterName}${serviceName}ServiceArn`,
158
+ value: service.serviceArn,
159
+ description: `ECS Service ARN for ${serviceName}`
160
+ });
161
+ return service;
162
+ }
163
+ /**
164
+ * Adds auto-scaling to an ECS service based on CPU or memory utilisation.
165
+ */
166
+ export function addServiceScaling(ctx, serviceName, serviceProps, service) {
167
+ const scalableTarget = new ScalableTarget(ctx.scope, `${serviceName}ScalableTarget`, {
168
+ serviceNamespace: ServiceNamespace.ECS,
169
+ resourceId: `service/${ctx.cluster.clusterName}/${service.serviceName}`,
170
+ scalableDimension: "ecs:service:DesiredCount",
171
+ minCapacity: serviceProps.minCapacity ?? 2,
172
+ maxCapacity: serviceProps.maxCapacity ?? 10
173
+ });
174
+ return new TargetTrackingScalingPolicy(ctx.scope, `${serviceName}ScalingPolicy`, {
175
+ scalingTarget: scalableTarget,
176
+ predefinedMetric: serviceProps.scalingType === ScalingType.MEMORY
177
+ ? PredefinedMetric.ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION
178
+ : PredefinedMetric.ECS_SERVICE_AVERAGE_CPU_UTILIZATION,
179
+ targetValue: 50,
180
+ scaleInCooldown: Duration.seconds(60),
181
+ scaleOutCooldown: Duration.seconds(60)
182
+ });
183
+ }
@@ -0,0 +1,30 @@
1
+ import { FargateTaskDefinition, Ec2TaskDefinition, type ContainerDefinition } from "aws-cdk-lib/aws-ecs";
2
+ import { type Role } from "aws-cdk-lib/aws-iam";
3
+ import type { EcsConstructContext } from "./ecsContext.js";
4
+ import type { EcsClusterProps, EcsServiceProps, EcsCapacityProvider } from "./ecsTypes.js";
5
+ export { createExecutionRole, createTaskRole } from "./ecsRoles.js";
6
+ export { getContainerImage } from "./ecsImages.js";
7
+ /**
8
+ * Gets the capacity provider for a service.
9
+ * Each service MUST specify its own capacityProvider.
10
+ */
11
+ export declare function getServiceCapacityProvider(serviceProps: EcsServiceProps): EcsCapacityProvider;
12
+ /** Checks if a service uses a Fargate capacity provider. */
13
+ export declare function isServiceFargate(serviceProps: EcsServiceProps): boolean;
14
+ /** Checks if a service uses an EC2 capacity provider. */
15
+ export declare function isServiceEc2(serviceProps: EcsServiceProps): boolean;
16
+ /**
17
+ * Collects Secrets Manager secret names from secretsImport for a specific service.
18
+ * Scoped per service to enforce least-privilege on execution roles.
19
+ */
20
+ export declare function collectSecretsManagerSecretNames(props: EcsClusterProps, serviceName: string): string[];
21
+ /**
22
+ * Derives the SSM secrets path for a service.
23
+ * Uses explicit path if provided, otherwise derives from app/cluster/service names.
24
+ */
25
+ export declare function deriveSsmSecretsPath(props: EcsClusterProps, serviceName: string, explicitPath?: string): string;
26
+ export declare function createTaskDefinition(ctx: EcsConstructContext, serviceName: string, serviceProps: EcsServiceProps, executionRole: Role, taskRole: Role): FargateTaskDefinition | Ec2TaskDefinition;
27
+ export declare function addContainersToTask(ctx: EcsConstructContext, serviceName: string, serviceProps: EcsServiceProps, taskDefinition: FargateTaskDefinition | Ec2TaskDefinition): {
28
+ containers: ContainerDefinition[];
29
+ primaryContainer?: ContainerDefinition;
30
+ };
@@ -0,0 +1,168 @@
1
+ import { AwsLogDriver, FargateTaskDefinition, Ec2TaskDefinition, NetworkMode, CpuArchitecture, OperatingSystemFamily } from "aws-cdk-lib/aws-ecs";
2
+ import { Duration } from "aws-cdk-lib";
3
+ import { Secret as EcsSecret } from "aws-cdk-lib/aws-ecs";
4
+ import { Secret } from "aws-cdk-lib/aws-secretsmanager";
5
+ import { StringParameter } from "aws-cdk-lib/aws-ssm";
6
+ import { validateSsmPathComponent } from "./ecsValidation.js";
7
+ import { DEFAULT_LOG_RETENTION_DAYS } from "./ecsConstants.js";
8
+ import { getContainerImage } from "./ecsImages.js";
9
+ // Re-export extracted functions so existing consumers are not broken
10
+ export { createExecutionRole, createTaskRole } from "./ecsRoles.js";
11
+ export { getContainerImage } from "./ecsImages.js";
12
+ /**
13
+ * Gets the capacity provider for a service.
14
+ * Each service MUST specify its own capacityProvider.
15
+ */
16
+ export function getServiceCapacityProvider(serviceProps) {
17
+ return serviceProps.capacityProvider;
18
+ }
19
+ /** Checks if a service uses a Fargate capacity provider. */
20
+ export function isServiceFargate(serviceProps) {
21
+ const provider = getServiceCapacityProvider(serviceProps);
22
+ return provider === "FARGATE" || provider === "FARGATE_SPOT";
23
+ }
24
+ /** Checks if a service uses an EC2 capacity provider. */
25
+ export function isServiceEc2(serviceProps) {
26
+ return getServiceCapacityProvider(serviceProps) === "EC2";
27
+ }
28
+ /**
29
+ * Collects Secrets Manager secret names from secretsImport for a specific service.
30
+ * Scoped per service to enforce least-privilege on execution roles.
31
+ */
32
+ export function collectSecretsManagerSecretNames(props, serviceName) {
33
+ const service = props.services.find((s) => s.name === serviceName);
34
+ if (!service)
35
+ return [];
36
+ const secretNames = new Set();
37
+ for (const container of service.containers) {
38
+ if (container.secretsImport) {
39
+ for (const secretImport of Object.values(container.secretsImport)) {
40
+ secretNames.add(secretImport.name);
41
+ }
42
+ }
43
+ }
44
+ return Array.from(secretNames);
45
+ }
46
+ /**
47
+ * Derives the SSM secrets path for a service.
48
+ * Uses explicit path if provided, otherwise derives from app/cluster/service names.
49
+ */
50
+ export function deriveSsmSecretsPath(props, serviceName, explicitPath) {
51
+ if (explicitPath) {
52
+ return explicitPath;
53
+ }
54
+ const appName = props.appName;
55
+ if (!appName) {
56
+ throw new Error(`Service '${serviceName}' has secrets defined but no ssmSecretsPath is set ` +
57
+ `and appName is not configured on the cluster. ` +
58
+ `Either set ssmSecretsPath on the service, or set appName on the cluster props ` +
59
+ `to enable automatic path derivation (/<appName>/<clusterName>/<serviceName>).`);
60
+ }
61
+ validateSsmPathComponent(appName, "appName");
62
+ validateSsmPathComponent(props.clusterName, "clusterName");
63
+ validateSsmPathComponent(serviceName, "serviceName");
64
+ return `/${appName}/${props.clusterName}/${serviceName}`;
65
+ }
66
+ export function createTaskDefinition(ctx, serviceName, serviceProps, executionRole, taskRole) {
67
+ const cpu = serviceProps.cpu ?? 256;
68
+ const memoryLimitMiB = serviceProps.memoryLimitMiB ?? 512;
69
+ if (isServiceFargate(serviceProps)) {
70
+ return new FargateTaskDefinition(ctx.scope, `${serviceName}TaskDefinition`, {
71
+ family: `${ctx.props.clusterName}-${serviceName}`,
72
+ cpu,
73
+ memoryLimitMiB,
74
+ executionRole,
75
+ taskRole,
76
+ runtimePlatform: {
77
+ cpuArchitecture: CpuArchitecture.ARM64,
78
+ operatingSystemFamily: OperatingSystemFamily.LINUX
79
+ }
80
+ });
81
+ }
82
+ else {
83
+ return new Ec2TaskDefinition(ctx.scope, `${serviceName}TaskDefinition`, {
84
+ family: `${ctx.props.clusterName}-${serviceName}`,
85
+ executionRole,
86
+ taskRole,
87
+ ...(ctx.directAccessEnabled && { networkMode: NetworkMode.HOST })
88
+ });
89
+ }
90
+ }
91
+ export function addContainersToTask(ctx, serviceName, serviceProps, taskDefinition) {
92
+ const containers = [];
93
+ let primaryContainer;
94
+ for (const containerConfig of serviceProps.containers) {
95
+ const image = getContainerImage(ctx, serviceName, containerConfig, serviceProps);
96
+ const isFirstWithPort = !primaryContainer && containerConfig.port !== undefined;
97
+ const secrets = {};
98
+ if (containerConfig.secretsImport) {
99
+ for (const [key, secretImport] of Object.entries(containerConfig.secretsImport)) {
100
+ const secret = Secret.fromSecretNameV2(ctx.scope, `${ctx.props.clusterName}${serviceName}${containerConfig.name}${key}Secret`, secretImport.name);
101
+ secrets[key] = EcsSecret.fromSecretsManager(secret, secretImport.field);
102
+ }
103
+ }
104
+ if (containerConfig.secrets && containerConfig.secrets.length > 0) {
105
+ if (containerConfig.secretsImport) {
106
+ const secretsImportKeys = Object.keys(containerConfig.secretsImport);
107
+ const duplicateKeys = containerConfig.secrets.filter((key) => secretsImportKeys.includes(key));
108
+ if (duplicateKeys.length > 0) {
109
+ throw new Error(`Container '${containerConfig.name}' in service '${serviceName}' has duplicate secret keys ` +
110
+ `defined in both secrets and secretsImport: ${duplicateKeys.join(", ")}. ` +
111
+ `Each secret key must be unique across both sources.`);
112
+ }
113
+ }
114
+ const ssmSecretsPath = deriveSsmSecretsPath(ctx.props, serviceName, serviceProps.ssmSecretsPath);
115
+ for (const secretName of containerConfig.secrets) {
116
+ const paramPath = `${ssmSecretsPath}/${secretName}`;
117
+ const param = StringParameter.fromSecureStringParameterAttributes(ctx.scope, `${ctx.props.clusterName}${serviceName}${containerConfig.name}${secretName}SsmParam`, { parameterName: paramPath });
118
+ secrets[secretName] = EcsSecret.fromSsmParameter(param);
119
+ }
120
+ }
121
+ const container = taskDefinition.addContainer(`${serviceName}${containerConfig.name}`, {
122
+ image,
123
+ containerName: containerConfig.name,
124
+ logging: new AwsLogDriver({
125
+ streamPrefix: `/ecs/${ctx.props.clusterName}/${serviceName}`,
126
+ logRetention: DEFAULT_LOG_RETENTION_DAYS
127
+ }),
128
+ environment: {
129
+ ...containerConfig.environment,
130
+ ...(containerConfig.port
131
+ ? { PORT: String(containerConfig.port) }
132
+ : {})
133
+ },
134
+ secrets,
135
+ command: containerConfig.command,
136
+ entryPoint: containerConfig.entryPoint,
137
+ essential: containerConfig.essential ?? true,
138
+ healthCheck: containerConfig.healthCheck
139
+ ? {
140
+ command: containerConfig.healthCheck.command,
141
+ interval: containerConfig.healthCheck.interval
142
+ ? Duration.seconds(containerConfig.healthCheck.interval)
143
+ : undefined,
144
+ timeout: containerConfig.healthCheck.timeout
145
+ ? Duration.seconds(containerConfig.healthCheck.timeout)
146
+ : undefined,
147
+ retries: containerConfig.healthCheck.retries,
148
+ startPeriod: containerConfig.healthCheck.startPeriod
149
+ ? Duration.seconds(containerConfig.healthCheck.startPeriod)
150
+ : undefined
151
+ }
152
+ : undefined,
153
+ ...(isServiceEc2(serviceProps) && {
154
+ memoryLimitMiB: serviceProps.ec2Config?.memoryLimitMiB ?? 1024
155
+ })
156
+ });
157
+ if (containerConfig.port) {
158
+ container.addPortMappings({
159
+ containerPort: containerConfig.port
160
+ });
161
+ }
162
+ if (isFirstWithPort) {
163
+ primaryContainer = container;
164
+ }
165
+ containers.push(container);
166
+ }
167
+ return { containers, primaryContainer };
168
+ }