@guardian/cdk 0.0.0-canary-20260805130549

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 (622) hide show
  1. package/README.md +50 -0
  2. package/bin/gu-cdk +5 -0
  3. package/lib/aspects/cfn-include-reporter.d.ts +9 -0
  4. package/lib/aspects/cfn-include-reporter.d.ts.map +1 -0
  5. package/lib/aspects/cfn-include-reporter.js +18 -0
  6. package/lib/aspects/cfn-include-reporter.js.map +1 -0
  7. package/lib/aspects/cfn-parameter-reporter.d.ts +9 -0
  8. package/lib/aspects/cfn-parameter-reporter.d.ts.map +1 -0
  9. package/lib/aspects/cfn-parameter-reporter.js +21 -0
  10. package/lib/aspects/cfn-parameter-reporter.js.map +1 -0
  11. package/lib/aspects/metadata.d.ts +8 -0
  12. package/lib/aspects/metadata.d.ts.map +1 -0
  13. package/lib/aspects/metadata.js +28 -0
  14. package/lib/aspects/metadata.js.map +1 -0
  15. package/lib/bin/aws-credential-provider.d.ts +3 -0
  16. package/lib/bin/aws-credential-provider.d.ts.map +1 -0
  17. package/lib/bin/aws-credential-provider.js +9 -0
  18. package/lib/bin/aws-credential-provider.js.map +1 -0
  19. package/lib/bin/commands/account-readiness/index.d.ts +11 -0
  20. package/lib/bin/commands/account-readiness/index.d.ts.map +1 -0
  21. package/lib/bin/commands/account-readiness/index.js +26 -0
  22. package/lib/bin/commands/account-readiness/index.js.map +1 -0
  23. package/lib/bin/commands/account-readiness/ssm.d.ts +12 -0
  24. package/lib/bin/commands/account-readiness/ssm.d.ts.map +1 -0
  25. package/lib/bin/commands/account-readiness/ssm.js +76 -0
  26. package/lib/bin/commands/account-readiness/ssm.js.map +1 -0
  27. package/lib/bin/commands/aws-cdk-version.d.ts +3 -0
  28. package/lib/bin/commands/aws-cdk-version.d.ts.map +1 -0
  29. package/lib/bin/commands/aws-cdk-version.js +9 -0
  30. package/lib/bin/commands/aws-cdk-version.js.map +1 -0
  31. package/lib/bin/commands/new-project/index.d.ts +14 -0
  32. package/lib/bin/commands/new-project/index.d.ts.map +1 -0
  33. package/lib/bin/commands/new-project/index.js +134 -0
  34. package/lib/bin/commands/new-project/index.js.map +1 -0
  35. package/lib/bin/commands/new-project/template/.gitignore.template +11 -0
  36. package/lib/bin/commands/new-project/template/README.md +5 -0
  37. package/lib/bin/commands/new-project/template/bin/.ignore +2 -0
  38. package/lib/bin/commands/new-project/template/cdk.json +7 -0
  39. package/lib/bin/commands/new-project/template/eslint.config.mjs +6 -0
  40. package/lib/bin/commands/new-project/template/jest.setup.js +2 -0
  41. package/lib/bin/commands/new-project/template/tsconfig.json.template +12 -0
  42. package/lib/bin/commands/new-project/utils/app.d.ts +23 -0
  43. package/lib/bin/commands/new-project/utils/app.d.ts.map +1 -0
  44. package/lib/bin/commands/new-project/utils/app.js +36 -0
  45. package/lib/bin/commands/new-project/utils/app.js.map +1 -0
  46. package/lib/bin/commands/new-project/utils/imports.d.ts +11 -0
  47. package/lib/bin/commands/new-project/utils/imports.d.ts.map +1 -0
  48. package/lib/bin/commands/new-project/utils/imports.js +107 -0
  49. package/lib/bin/commands/new-project/utils/imports.js.map +1 -0
  50. package/lib/bin/commands/new-project/utils/init.d.ts +13 -0
  51. package/lib/bin/commands/new-project/utils/init.d.ts.map +1 -0
  52. package/lib/bin/commands/new-project/utils/init.js +113 -0
  53. package/lib/bin/commands/new-project/utils/init.js.map +1 -0
  54. package/lib/bin/commands/new-project/utils/snapshot.d.ts +21 -0
  55. package/lib/bin/commands/new-project/utils/snapshot.d.ts.map +1 -0
  56. package/lib/bin/commands/new-project/utils/snapshot.js +41 -0
  57. package/lib/bin/commands/new-project/utils/snapshot.js.map +1 -0
  58. package/lib/bin/commands/new-project/utils/stack.d.ts +21 -0
  59. package/lib/bin/commands/new-project/utils/stack.d.ts.map +1 -0
  60. package/lib/bin/commands/new-project/utils/stack.js +40 -0
  61. package/lib/bin/commands/new-project/utils/stack.js.map +1 -0
  62. package/lib/bin/commands/new-project/utils/utils.d.ts +12 -0
  63. package/lib/bin/commands/new-project/utils/utils.d.ts.map +1 -0
  64. package/lib/bin/commands/new-project/utils/utils.js +16 -0
  65. package/lib/bin/commands/new-project/utils/utils.js.map +1 -0
  66. package/lib/bin/index.d.ts +3 -0
  67. package/lib/bin/index.d.ts.map +1 -0
  68. package/lib/bin/index.js +124 -0
  69. package/lib/bin/index.js.map +1 -0
  70. package/lib/constants/__mocks__/library-info.d.ts +6 -0
  71. package/lib/constants/__mocks__/library-info.d.ts.map +1 -0
  72. package/lib/constants/__mocks__/library-info.js +11 -0
  73. package/lib/constants/__mocks__/library-info.js.map +1 -0
  74. package/lib/constants/__mocks__/tracking-tag.d.ts +5 -0
  75. package/lib/constants/__mocks__/tracking-tag.d.ts.map +1 -0
  76. package/lib/constants/__mocks__/tracking-tag.js +9 -0
  77. package/lib/constants/__mocks__/tracking-tag.js.map +1 -0
  78. package/lib/constants/access.d.ts +18 -0
  79. package/lib/constants/access.d.ts.map +1 -0
  80. package/lib/constants/access.js +22 -0
  81. package/lib/constants/access.js.map +1 -0
  82. package/lib/constants/context-keys.d.ts +7 -0
  83. package/lib/constants/context-keys.d.ts.map +1 -0
  84. package/lib/constants/context-keys.js +10 -0
  85. package/lib/constants/context-keys.js.map +1 -0
  86. package/lib/constants/fastly-aws-account-id.d.ts +8 -0
  87. package/lib/constants/fastly-aws-account-id.d.ts.map +1 -0
  88. package/lib/constants/fastly-aws-account-id.js +11 -0
  89. package/lib/constants/fastly-aws-account-id.js.map +1 -0
  90. package/lib/constants/index.d.ts +9 -0
  91. package/lib/constants/index.d.ts.map +1 -0
  92. package/lib/constants/index.js +25 -0
  93. package/lib/constants/index.js.map +1 -0
  94. package/lib/constants/library-info.d.ts +28 -0
  95. package/lib/constants/library-info.d.ts.map +1 -0
  96. package/lib/constants/library-info.js +46 -0
  97. package/lib/constants/library-info.js.map +1 -0
  98. package/lib/constants/metadata-keys.d.ts +9 -0
  99. package/lib/constants/metadata-keys.d.ts.map +1 -0
  100. package/lib/constants/metadata-keys.js +12 -0
  101. package/lib/constants/metadata-keys.js.map +1 -0
  102. package/lib/constants/regex-pattern.d.ts +5 -0
  103. package/lib/constants/regex-pattern.d.ts.map +1 -0
  104. package/lib/constants/regex-pattern.js +11 -0
  105. package/lib/constants/regex-pattern.js.map +1 -0
  106. package/lib/constants/ssm-parameter-paths.d.ts +24 -0
  107. package/lib/constants/ssm-parameter-paths.d.ts.map +1 -0
  108. package/lib/constants/ssm-parameter-paths.js +56 -0
  109. package/lib/constants/ssm-parameter-paths.js.map +1 -0
  110. package/lib/constants/tracking-tag.d.ts +5 -0
  111. package/lib/constants/tracking-tag.d.ts.map +1 -0
  112. package/lib/constants/tracking-tag.js +10 -0
  113. package/lib/constants/tracking-tag.js.map +1 -0
  114. package/lib/constructs/acm/certificate.d.ts +24 -0
  115. package/lib/constructs/acm/certificate.d.ts.map +1 -0
  116. package/lib/constructs/acm/certificate.js +34 -0
  117. package/lib/constructs/acm/certificate.js.map +1 -0
  118. package/lib/constructs/acm/index.d.ts +2 -0
  119. package/lib/constructs/acm/index.d.ts.map +1 -0
  120. package/lib/constructs/acm/index.js +18 -0
  121. package/lib/constructs/acm/index.js.map +1 -0
  122. package/lib/constructs/autoscaling/asg.d.ts +75 -0
  123. package/lib/constructs/autoscaling/asg.d.ts.map +1 -0
  124. package/lib/constructs/autoscaling/asg.js +103 -0
  125. package/lib/constructs/autoscaling/asg.js.map +1 -0
  126. package/lib/constructs/autoscaling/index.d.ts +3 -0
  127. package/lib/constructs/autoscaling/index.d.ts.map +1 -0
  128. package/lib/constructs/autoscaling/index.js +19 -0
  129. package/lib/constructs/autoscaling/index.js.map +1 -0
  130. package/lib/constructs/autoscaling/user-data.d.ts +28 -0
  131. package/lib/constructs/autoscaling/user-data.d.ts.map +1 -0
  132. package/lib/constructs/autoscaling/user-data.js +66 -0
  133. package/lib/constructs/autoscaling/user-data.js.map +1 -0
  134. package/lib/constructs/cloudwatch/alarm.d.ts +35 -0
  135. package/lib/constructs/cloudwatch/alarm.d.ts.map +1 -0
  136. package/lib/constructs/cloudwatch/alarm.js +37 -0
  137. package/lib/constructs/cloudwatch/alarm.js.map +1 -0
  138. package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts +17 -0
  139. package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts.map +1 -0
  140. package/lib/constructs/cloudwatch/api-gateway-alarms.js +39 -0
  141. package/lib/constructs/cloudwatch/api-gateway-alarms.js.map +1 -0
  142. package/lib/constructs/cloudwatch/ec2-alarms.d.ts +36 -0
  143. package/lib/constructs/cloudwatch/ec2-alarms.d.ts.map +1 -0
  144. package/lib/constructs/cloudwatch/ec2-alarms.js +102 -0
  145. package/lib/constructs/cloudwatch/ec2-alarms.js.map +1 -0
  146. package/lib/constructs/cloudwatch/index.d.ts +5 -0
  147. package/lib/constructs/cloudwatch/index.d.ts.map +1 -0
  148. package/lib/constructs/cloudwatch/index.js +21 -0
  149. package/lib/constructs/cloudwatch/index.js.map +1 -0
  150. package/lib/constructs/cloudwatch/lambda-alarms.d.ts +43 -0
  151. package/lib/constructs/cloudwatch/lambda-alarms.d.ts.map +1 -0
  152. package/lib/constructs/cloudwatch/lambda-alarms.js +54 -0
  153. package/lib/constructs/cloudwatch/lambda-alarms.js.map +1 -0
  154. package/lib/constructs/cloudwatch/no-monitoring.d.ts +4 -0
  155. package/lib/constructs/cloudwatch/no-monitoring.d.ts.map +1 -0
  156. package/lib/constructs/cloudwatch/no-monitoring.js +3 -0
  157. package/lib/constructs/cloudwatch/no-monitoring.js.map +1 -0
  158. package/lib/constructs/core/identity.d.ts +16 -0
  159. package/lib/constructs/core/identity.d.ts.map +1 -0
  160. package/lib/constructs/core/identity.js +21 -0
  161. package/lib/constructs/core/identity.js.map +1 -0
  162. package/lib/constructs/core/index.d.ts +5 -0
  163. package/lib/constructs/core/index.d.ts.map +1 -0
  164. package/lib/constructs/core/index.js +21 -0
  165. package/lib/constructs/core/index.js.map +1 -0
  166. package/lib/constructs/core/migrating.d.ts +11 -0
  167. package/lib/constructs/core/migrating.d.ts.map +1 -0
  168. package/lib/constructs/core/migrating.js +3 -0
  169. package/lib/constructs/core/migrating.js.map +1 -0
  170. package/lib/constructs/core/parameters/acm.d.ts +7 -0
  171. package/lib/constructs/core/parameters/acm.d.ts.map +1 -0
  172. package/lib/constructs/core/parameters/acm.js +17 -0
  173. package/lib/constructs/core/parameters/acm.js.map +1 -0
  174. package/lib/constructs/core/parameters/anghammarad.d.ts +20 -0
  175. package/lib/constructs/core/parameters/anghammarad.d.ts.map +1 -0
  176. package/lib/constructs/core/parameters/anghammarad.js +35 -0
  177. package/lib/constructs/core/parameters/anghammarad.js.map +1 -0
  178. package/lib/constructs/core/parameters/base.d.ts +20 -0
  179. package/lib/constructs/core/parameters/base.d.ts.map +1 -0
  180. package/lib/constructs/core/parameters/base.js +33 -0
  181. package/lib/constructs/core/parameters/base.js.map +1 -0
  182. package/lib/constructs/core/parameters/ec2.d.ts +7 -0
  183. package/lib/constructs/core/parameters/ec2.d.ts.map +1 -0
  184. package/lib/constructs/core/parameters/ec2.js +16 -0
  185. package/lib/constructs/core/parameters/ec2.js.map +1 -0
  186. package/lib/constructs/core/parameters/fastly.d.ts +13 -0
  187. package/lib/constructs/core/parameters/fastly.d.ts.map +1 -0
  188. package/lib/constructs/core/parameters/fastly.js +28 -0
  189. package/lib/constructs/core/parameters/fastly.js.map +1 -0
  190. package/lib/constructs/core/parameters/index.d.ts +9 -0
  191. package/lib/constructs/core/parameters/index.d.ts.map +1 -0
  192. package/lib/constructs/core/parameters/index.js +25 -0
  193. package/lib/constructs/core/parameters/index.js.map +1 -0
  194. package/lib/constructs/core/parameters/log-shipping.d.ts +8 -0
  195. package/lib/constructs/core/parameters/log-shipping.d.ts.map +1 -0
  196. package/lib/constructs/core/parameters/log-shipping.js +23 -0
  197. package/lib/constructs/core/parameters/log-shipping.js.map +1 -0
  198. package/lib/constructs/core/parameters/s3.d.ts +25 -0
  199. package/lib/constructs/core/parameters/s3.d.ts.map +1 -0
  200. package/lib/constructs/core/parameters/s3.js +58 -0
  201. package/lib/constructs/core/parameters/s3.js.map +1 -0
  202. package/lib/constructs/core/parameters/vpc.d.ts +17 -0
  203. package/lib/constructs/core/parameters/vpc.d.ts.map +1 -0
  204. package/lib/constructs/core/parameters/vpc.js +35 -0
  205. package/lib/constructs/core/parameters/vpc.js.map +1 -0
  206. package/lib/constructs/core/stack.d.ts +166 -0
  207. package/lib/constructs/core/stack.d.ts.map +1 -0
  208. package/lib/constructs/core/stack.js +183 -0
  209. package/lib/constructs/core/stack.js.map +1 -0
  210. package/lib/constructs/dns/dns-records.d.ts +37 -0
  211. package/lib/constructs/dns/dns-records.d.ts.map +1 -0
  212. package/lib/constructs/dns/dns-records.js +75 -0
  213. package/lib/constructs/dns/dns-records.js.map +1 -0
  214. package/lib/constructs/dns/index.d.ts +2 -0
  215. package/lib/constructs/dns/index.d.ts.map +1 -0
  216. package/lib/constructs/dns/index.js +18 -0
  217. package/lib/constructs/dns/index.js.map +1 -0
  218. package/lib/constructs/dynamodb/dynamodb.d.ts +31 -0
  219. package/lib/constructs/dynamodb/dynamodb.d.ts.map +1 -0
  220. package/lib/constructs/dynamodb/dynamodb.js +18 -0
  221. package/lib/constructs/dynamodb/dynamodb.js.map +1 -0
  222. package/lib/constructs/dynamodb/index.d.ts +2 -0
  223. package/lib/constructs/dynamodb/index.d.ts.map +1 -0
  224. package/lib/constructs/dynamodb/index.js +18 -0
  225. package/lib/constructs/dynamodb/index.js.map +1 -0
  226. package/lib/constructs/ec2/index.d.ts +3 -0
  227. package/lib/constructs/ec2/index.d.ts.map +1 -0
  228. package/lib/constructs/ec2/index.js +19 -0
  229. package/lib/constructs/ec2/index.js.map +1 -0
  230. package/lib/constructs/ec2/security-groups/base.d.ts +60 -0
  231. package/lib/constructs/ec2/security-groups/base.d.ts.map +1 -0
  232. package/lib/constructs/ec2/security-groups/base.js +57 -0
  233. package/lib/constructs/ec2/security-groups/base.js.map +1 -0
  234. package/lib/constructs/ec2/security-groups/index.d.ts +2 -0
  235. package/lib/constructs/ec2/security-groups/index.d.ts.map +1 -0
  236. package/lib/constructs/ec2/security-groups/index.js +18 -0
  237. package/lib/constructs/ec2/security-groups/index.js.map +1 -0
  238. package/lib/constructs/ec2/vpc.d.ts +26 -0
  239. package/lib/constructs/ec2/vpc.d.ts.map +1 -0
  240. package/lib/constructs/ec2/vpc.js +76 -0
  241. package/lib/constructs/ec2/vpc.js.map +1 -0
  242. package/lib/constructs/ecs/ecs-task.d.ts +139 -0
  243. package/lib/constructs/ecs/ecs-task.d.ts.map +1 -0
  244. package/lib/constructs/ecs/ecs-task.js +169 -0
  245. package/lib/constructs/ecs/ecs-task.js.map +1 -0
  246. package/lib/constructs/ecs/index.d.ts +2 -0
  247. package/lib/constructs/ecs/index.d.ts.map +1 -0
  248. package/lib/constructs/ecs/index.js +18 -0
  249. package/lib/constructs/ecs/index.js.map +1 -0
  250. package/lib/constructs/iam/fastly-logs-iam.d.ts +38 -0
  251. package/lib/constructs/iam/fastly-logs-iam.d.ts.map +1 -0
  252. package/lib/constructs/iam/fastly-logs-iam.js +44 -0
  253. package/lib/constructs/iam/fastly-logs-iam.js.map +1 -0
  254. package/lib/constructs/iam/index.d.ts +4 -0
  255. package/lib/constructs/iam/index.d.ts.map +1 -0
  256. package/lib/constructs/iam/index.js +20 -0
  257. package/lib/constructs/iam/index.js.map +1 -0
  258. package/lib/constructs/iam/policies/anghammarad.d.ts +15 -0
  259. package/lib/constructs/iam/policies/anghammarad.d.ts.map +1 -0
  260. package/lib/constructs/iam/policies/anghammarad.js +30 -0
  261. package/lib/constructs/iam/policies/anghammarad.js.map +1 -0
  262. package/lib/constructs/iam/policies/assume-role.d.ts +10 -0
  263. package/lib/constructs/iam/policies/assume-role.d.ts.map +1 -0
  264. package/lib/constructs/iam/policies/assume-role.js +21 -0
  265. package/lib/constructs/iam/policies/assume-role.js.map +1 -0
  266. package/lib/constructs/iam/policies/base-policy.d.ts +20 -0
  267. package/lib/constructs/iam/policies/base-policy.d.ts.map +1 -0
  268. package/lib/constructs/iam/policies/base-policy.js +33 -0
  269. package/lib/constructs/iam/policies/base-policy.js.map +1 -0
  270. package/lib/constructs/iam/policies/cloudwatch.d.ts +14 -0
  271. package/lib/constructs/iam/policies/cloudwatch.d.ts.map +1 -0
  272. package/lib/constructs/iam/policies/cloudwatch.js +28 -0
  273. package/lib/constructs/iam/policies/cloudwatch.js.map +1 -0
  274. package/lib/constructs/iam/policies/describe-ec2.d.ts +8 -0
  275. package/lib/constructs/iam/policies/describe-ec2.d.ts.map +1 -0
  276. package/lib/constructs/iam/policies/describe-ec2.js +33 -0
  277. package/lib/constructs/iam/policies/describe-ec2.js.map +1 -0
  278. package/lib/constructs/iam/policies/dynamodb.d.ts +20 -0
  279. package/lib/constructs/iam/policies/dynamodb.d.ts.map +1 -0
  280. package/lib/constructs/iam/policies/dynamodb.js +32 -0
  281. package/lib/constructs/iam/policies/dynamodb.js.map +1 -0
  282. package/lib/constructs/iam/policies/index.d.ts +13 -0
  283. package/lib/constructs/iam/policies/index.d.ts.map +1 -0
  284. package/lib/constructs/iam/policies/index.js +29 -0
  285. package/lib/constructs/iam/policies/index.js.map +1 -0
  286. package/lib/constructs/iam/policies/kcl.d.ts +17 -0
  287. package/lib/constructs/iam/policies/kcl.d.ts.map +1 -0
  288. package/lib/constructs/iam/policies/kcl.js +60 -0
  289. package/lib/constructs/iam/policies/kcl.js.map +1 -0
  290. package/lib/constructs/iam/policies/log-shipping.d.ts +8 -0
  291. package/lib/constructs/iam/policies/log-shipping.d.ts.map +1 -0
  292. package/lib/constructs/iam/policies/log-shipping.js +24 -0
  293. package/lib/constructs/iam/policies/log-shipping.js.map +1 -0
  294. package/lib/constructs/iam/policies/parameter-store-read.d.ts +39 -0
  295. package/lib/constructs/iam/policies/parameter-store-read.d.ts.map +1 -0
  296. package/lib/constructs/iam/policies/parameter-store-read.js +73 -0
  297. package/lib/constructs/iam/policies/parameter-store-read.js.map +1 -0
  298. package/lib/constructs/iam/policies/s3-get-object.d.ts +57 -0
  299. package/lib/constructs/iam/policies/s3-get-object.d.ts.map +1 -0
  300. package/lib/constructs/iam/policies/s3-get-object.js +73 -0
  301. package/lib/constructs/iam/policies/s3-get-object.js.map +1 -0
  302. package/lib/constructs/iam/policies/s3-put-object.d.ts +11 -0
  303. package/lib/constructs/iam/policies/s3-put-object.d.ts.map +1 -0
  304. package/lib/constructs/iam/policies/s3-put-object.js +13 -0
  305. package/lib/constructs/iam/policies/s3-put-object.js.map +1 -0
  306. package/lib/constructs/iam/policies/ses.d.ts +15 -0
  307. package/lib/constructs/iam/policies/ses.d.ts.map +1 -0
  308. package/lib/constructs/iam/policies/ses.js +14 -0
  309. package/lib/constructs/iam/policies/ses.js.map +1 -0
  310. package/lib/constructs/iam/policies/ssm-ssh.d.ts +19 -0
  311. package/lib/constructs/iam/policies/ssm-ssh.d.ts.map +1 -0
  312. package/lib/constructs/iam/policies/ssm-ssh.js +49 -0
  313. package/lib/constructs/iam/policies/ssm-ssh.js.map +1 -0
  314. package/lib/constructs/iam/roles/github-actions.d.ts +41 -0
  315. package/lib/constructs/iam/roles/github-actions.d.ts.map +1 -0
  316. package/lib/constructs/iam/roles/github-actions.js +77 -0
  317. package/lib/constructs/iam/roles/github-actions.js.map +1 -0
  318. package/lib/constructs/iam/roles/index.d.ts +4 -0
  319. package/lib/constructs/iam/roles/index.d.ts.map +1 -0
  320. package/lib/constructs/iam/roles/index.js +20 -0
  321. package/lib/constructs/iam/roles/index.js.map +1 -0
  322. package/lib/constructs/iam/roles/instance-role.d.ts +38 -0
  323. package/lib/constructs/iam/roles/instance-role.d.ts.map +1 -0
  324. package/lib/constructs/iam/roles/instance-role.js +45 -0
  325. package/lib/constructs/iam/roles/instance-role.js.map +1 -0
  326. package/lib/constructs/iam/roles/roles.d.ts +8 -0
  327. package/lib/constructs/iam/roles/roles.d.ts.map +1 -0
  328. package/lib/constructs/iam/roles/roles.js +11 -0
  329. package/lib/constructs/iam/roles/roles.js.map +1 -0
  330. package/lib/constructs/kinesis/index.d.ts +2 -0
  331. package/lib/constructs/kinesis/index.d.ts.map +1 -0
  332. package/lib/constructs/kinesis/index.js +18 -0
  333. package/lib/constructs/kinesis/index.js.map +1 -0
  334. package/lib/constructs/kinesis/kinesis-stream.d.ts +14 -0
  335. package/lib/constructs/kinesis/kinesis-stream.d.ts.map +1 -0
  336. package/lib/constructs/kinesis/kinesis-stream.js +17 -0
  337. package/lib/constructs/kinesis/kinesis-stream.js.map +1 -0
  338. package/lib/constructs/lambda/index.d.ts +2 -0
  339. package/lib/constructs/lambda/index.d.ts.map +1 -0
  340. package/lib/constructs/lambda/index.js +18 -0
  341. package/lib/constructs/lambda/index.js.map +1 -0
  342. package/lib/constructs/lambda/lambda.d.ts +95 -0
  343. package/lib/constructs/lambda/lambda.d.ts.map +1 -0
  344. package/lib/constructs/lambda/lambda.js +115 -0
  345. package/lib/constructs/lambda/lambda.js.map +1 -0
  346. package/lib/constructs/loadbalancing/alb/application-listener.d.ts +49 -0
  347. package/lib/constructs/loadbalancing/alb/application-listener.d.ts.map +1 -0
  348. package/lib/constructs/loadbalancing/alb/application-listener.js +53 -0
  349. package/lib/constructs/loadbalancing/alb/application-listener.js.map +1 -0
  350. package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts +63 -0
  351. package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts.map +1 -0
  352. package/lib/constructs/loadbalancing/alb/application-load-balancer.js +70 -0
  353. package/lib/constructs/loadbalancing/alb/application-load-balancer.js.map +1 -0
  354. package/lib/constructs/loadbalancing/alb/application-target-group.d.ts +42 -0
  355. package/lib/constructs/loadbalancing/alb/application-target-group.d.ts.map +1 -0
  356. package/lib/constructs/loadbalancing/alb/application-target-group.js +64 -0
  357. package/lib/constructs/loadbalancing/alb/application-target-group.js.map +1 -0
  358. package/lib/constructs/loadbalancing/alb/index.d.ts +4 -0
  359. package/lib/constructs/loadbalancing/alb/index.d.ts.map +1 -0
  360. package/lib/constructs/loadbalancing/alb/index.js +20 -0
  361. package/lib/constructs/loadbalancing/alb/index.js.map +1 -0
  362. package/lib/constructs/loadbalancing/index.d.ts +2 -0
  363. package/lib/constructs/loadbalancing/index.d.ts.map +1 -0
  364. package/lib/constructs/loadbalancing/index.js +18 -0
  365. package/lib/constructs/loadbalancing/index.js.map +1 -0
  366. package/lib/constructs/rds/index.d.ts +2 -0
  367. package/lib/constructs/rds/index.d.ts.map +1 -0
  368. package/lib/constructs/rds/index.js +18 -0
  369. package/lib/constructs/rds/index.js.map +1 -0
  370. package/lib/constructs/rds/instance.d.ts +33 -0
  371. package/lib/constructs/rds/instance.d.ts.map +1 -0
  372. package/lib/constructs/rds/instance.js +27 -0
  373. package/lib/constructs/rds/instance.js.map +1 -0
  374. package/lib/constructs/root.d.ts +32 -0
  375. package/lib/constructs/root.d.ts.map +1 -0
  376. package/lib/constructs/root.js +46 -0
  377. package/lib/constructs/root.js.map +1 -0
  378. package/lib/constructs/s3/index.d.ts +18 -0
  379. package/lib/constructs/s3/index.d.ts.map +1 -0
  380. package/lib/constructs/s3/index.js +21 -0
  381. package/lib/constructs/s3/index.js.map +1 -0
  382. package/lib/constructs/ses/index.d.ts +35 -0
  383. package/lib/constructs/ses/index.d.ts.map +1 -0
  384. package/lib/constructs/ses/index.js +52 -0
  385. package/lib/constructs/ses/index.js.map +1 -0
  386. package/lib/constructs/vpc/index.d.ts +2 -0
  387. package/lib/constructs/vpc/index.d.ts.map +1 -0
  388. package/lib/constructs/vpc/index.js +18 -0
  389. package/lib/constructs/vpc/index.js.map +1 -0
  390. package/lib/constructs/vpc/vpc.d.ts +57 -0
  391. package/lib/constructs/vpc/vpc.d.ts.map +1 -0
  392. package/lib/constructs/vpc/vpc.js +91 -0
  393. package/lib/constructs/vpc/vpc.js.map +1 -0
  394. package/lib/experimental/constructs/iam/index.d.ts +2 -0
  395. package/lib/experimental/constructs/iam/index.d.ts.map +1 -0
  396. package/lib/experimental/constructs/iam/index.js +18 -0
  397. package/lib/experimental/constructs/iam/index.js.map +1 -0
  398. package/lib/experimental/constructs/iam/policies/developer-policy.d.ts +63 -0
  399. package/lib/experimental/constructs/iam/policies/developer-policy.d.ts.map +1 -0
  400. package/lib/experimental/constructs/iam/policies/developer-policy.js +150 -0
  401. package/lib/experimental/constructs/iam/policies/developer-policy.js.map +1 -0
  402. package/lib/experimental/constructs/iam/policies/index.d.ts +2 -0
  403. package/lib/experimental/constructs/iam/policies/index.d.ts.map +1 -0
  404. package/lib/experimental/constructs/iam/policies/index.js +18 -0
  405. package/lib/experimental/constructs/iam/policies/index.js.map +1 -0
  406. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts +30 -0
  407. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts.map +1 -0
  408. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js +34 -0
  409. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js.map +1 -0
  410. package/lib/experimental/constructs/iam/roles/index.d.ts +2 -0
  411. package/lib/experimental/constructs/iam/roles/index.d.ts.map +1 -0
  412. package/lib/experimental/constructs/iam/roles/index.js +18 -0
  413. package/lib/experimental/constructs/iam/roles/index.js.map +1 -0
  414. package/lib/experimental/constructs/policies/index.d.ts +2 -0
  415. package/lib/experimental/constructs/policies/index.d.ts.map +1 -0
  416. package/lib/experimental/constructs/policies/index.js +18 -0
  417. package/lib/experimental/constructs/policies/index.js.map +1 -0
  418. package/lib/experimental/constructs/policies/kinesis-put-records.d.ts +11 -0
  419. package/lib/experimental/constructs/policies/kinesis-put-records.d.ts.map +1 -0
  420. package/lib/experimental/constructs/policies/kinesis-put-records.js +12 -0
  421. package/lib/experimental/constructs/policies/kinesis-put-records.js.map +1 -0
  422. package/lib/experimental/constructs/riff-raff-deployment-id.d.ts +8 -0
  423. package/lib/experimental/constructs/riff-raff-deployment-id.d.ts.map +1 -0
  424. package/lib/experimental/constructs/riff-raff-deployment-id.js +21 -0
  425. package/lib/experimental/constructs/riff-raff-deployment-id.js.map +1 -0
  426. package/lib/experimental/patterns/ec2-app.d.ts +175 -0
  427. package/lib/experimental/patterns/ec2-app.d.ts.map +1 -0
  428. package/lib/experimental/patterns/ec2-app.js +412 -0
  429. package/lib/experimental/patterns/ec2-app.js.map +1 -0
  430. package/lib/experimental/patterns/gu-load-balanced-app.d.ts +360 -0
  431. package/lib/experimental/patterns/gu-load-balanced-app.d.ts.map +1 -0
  432. package/lib/experimental/patterns/gu-load-balanced-app.js +520 -0
  433. package/lib/experimental/patterns/gu-load-balanced-app.js.map +1 -0
  434. package/lib/experimental/patterns/index.d.ts +3 -0
  435. package/lib/experimental/patterns/index.d.ts.map +1 -0
  436. package/lib/experimental/patterns/index.js +19 -0
  437. package/lib/experimental/patterns/index.js.map +1 -0
  438. package/lib/experimental/patterns/kinesis-lambda.d.ts +75 -0
  439. package/lib/experimental/patterns/kinesis-lambda.d.ts.map +1 -0
  440. package/lib/experimental/patterns/kinesis-lambda.js +48 -0
  441. package/lib/experimental/patterns/kinesis-lambda.js.map +1 -0
  442. package/lib/experimental/patterns/sns-lambda.d.ts +62 -0
  443. package/lib/experimental/patterns/sns-lambda.d.ts.map +1 -0
  444. package/lib/experimental/patterns/sns-lambda.js +41 -0
  445. package/lib/experimental/patterns/sns-lambda.js.map +1 -0
  446. package/lib/index.d.ts +2 -0
  447. package/lib/index.d.ts.map +1 -0
  448. package/lib/index.js +18 -0
  449. package/lib/index.js.map +1 -0
  450. package/lib/patterns/api-lambda.d.ts +61 -0
  451. package/lib/patterns/api-lambda.d.ts.map +1 -0
  452. package/lib/patterns/api-lambda.js +62 -0
  453. package/lib/patterns/api-lambda.js.map +1 -0
  454. package/lib/patterns/api-multiple-lambdas.d.ts +122 -0
  455. package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -0
  456. package/lib/patterns/api-multiple-lambdas.js +93 -0
  457. package/lib/patterns/api-multiple-lambdas.js.map +1 -0
  458. package/lib/patterns/ec2-app/base.d.ts +325 -0
  459. package/lib/patterns/ec2-app/base.d.ts.map +1 -0
  460. package/lib/patterns/ec2-app/base.js +273 -0
  461. package/lib/patterns/ec2-app/base.js.map +1 -0
  462. package/lib/patterns/ec2-app/framework.d.ts +32 -0
  463. package/lib/patterns/ec2-app/framework.d.ts.map +1 -0
  464. package/lib/patterns/ec2-app/framework.js +46 -0
  465. package/lib/patterns/ec2-app/framework.js.map +1 -0
  466. package/lib/patterns/ec2-app/index.d.ts +3 -0
  467. package/lib/patterns/ec2-app/index.d.ts.map +1 -0
  468. package/lib/patterns/ec2-app/index.js +19 -0
  469. package/lib/patterns/ec2-app/index.js.map +1 -0
  470. package/lib/patterns/index.d.ts +6 -0
  471. package/lib/patterns/index.d.ts.map +1 -0
  472. package/lib/patterns/index.js +22 -0
  473. package/lib/patterns/index.js.map +1 -0
  474. package/lib/patterns/scheduled-ecs-task.d.ts +36 -0
  475. package/lib/patterns/scheduled-ecs-task.d.ts.map +1 -0
  476. package/lib/patterns/scheduled-ecs-task.js +30 -0
  477. package/lib/patterns/scheduled-ecs-task.js.map +1 -0
  478. package/lib/patterns/scheduled-lambda.d.ts +42 -0
  479. package/lib/patterns/scheduled-lambda.d.ts.map +1 -0
  480. package/lib/patterns/scheduled-lambda.js +33 -0
  481. package/lib/patterns/scheduled-lambda.js.map +1 -0
  482. package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts +5 -0
  483. package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts.map +1 -0
  484. package/lib/riff-raff-yaml-file/deployments/autoscaling.js +44 -0
  485. package/lib/riff-raff-yaml-file/deployments/autoscaling.js.map +1 -0
  486. package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts +7 -0
  487. package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts.map +1 -0
  488. package/lib/riff-raff-yaml-file/deployments/cloudformation.js +64 -0
  489. package/lib/riff-raff-yaml-file/deployments/cloudformation.js.map +1 -0
  490. package/lib/riff-raff-yaml-file/deployments/lambda.d.ts +5 -0
  491. package/lib/riff-raff-yaml-file/deployments/lambda.d.ts.map +1 -0
  492. package/lib/riff-raff-yaml-file/deployments/lambda.js +71 -0
  493. package/lib/riff-raff-yaml-file/deployments/lambda.js.map +1 -0
  494. package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts +3 -0
  495. package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts.map +1 -0
  496. package/lib/riff-raff-yaml-file/deployments/update-parameters.js +17 -0
  497. package/lib/riff-raff-yaml-file/deployments/update-parameters.js.map +1 -0
  498. package/lib/riff-raff-yaml-file/group-by.d.ts +8 -0
  499. package/lib/riff-raff-yaml-file/group-by.d.ts.map +1 -0
  500. package/lib/riff-raff-yaml-file/group-by.js +25 -0
  501. package/lib/riff-raff-yaml-file/group-by.js.map +1 -0
  502. package/lib/riff-raff-yaml-file/index.d.ts +71 -0
  503. package/lib/riff-raff-yaml-file/index.d.ts.map +1 -0
  504. package/lib/riff-raff-yaml-file/index.js +244 -0
  505. package/lib/riff-raff-yaml-file/index.js.map +1 -0
  506. package/lib/riff-raff-yaml-file/types.d.ts +35 -0
  507. package/lib/riff-raff-yaml-file/types.d.ts.map +1 -0
  508. package/lib/riff-raff-yaml-file/types.js +10 -0
  509. package/lib/riff-raff-yaml-file/types.js.map +1 -0
  510. package/lib/types/access.d.ts +66 -0
  511. package/lib/types/access.d.ts.map +1 -0
  512. package/lib/types/access.js +39 -0
  513. package/lib/types/access.js.map +1 -0
  514. package/lib/types/amigo.d.ts +17 -0
  515. package/lib/types/amigo.d.ts.map +1 -0
  516. package/lib/types/amigo.js +3 -0
  517. package/lib/types/amigo.js.map +1 -0
  518. package/lib/types/asg.d.ts +19 -0
  519. package/lib/types/asg.d.ts.map +1 -0
  520. package/lib/types/asg.js +3 -0
  521. package/lib/types/asg.js.map +1 -0
  522. package/lib/types/cli.d.ts +12 -0
  523. package/lib/types/cli.d.ts.map +1 -0
  524. package/lib/types/cli.js +3 -0
  525. package/lib/types/cli.js.map +1 -0
  526. package/lib/types/distributable.d.ts +19 -0
  527. package/lib/types/distributable.d.ts.map +1 -0
  528. package/lib/types/distributable.js +9 -0
  529. package/lib/types/distributable.js.map +1 -0
  530. package/lib/types/domain-names.d.ts +15 -0
  531. package/lib/types/domain-names.d.ts.map +1 -0
  532. package/lib/types/domain-names.js +3 -0
  533. package/lib/types/domain-names.js.map +1 -0
  534. package/lib/types/index.d.ts +5 -0
  535. package/lib/types/index.d.ts.map +1 -0
  536. package/lib/types/index.js +21 -0
  537. package/lib/types/index.js.map +1 -0
  538. package/lib/utils/array.d.ts +7 -0
  539. package/lib/utils/array.d.ts.map +1 -0
  540. package/lib/utils/array.js +19 -0
  541. package/lib/utils/array.js.map +1 -0
  542. package/lib/utils/cli/vpc.d.ts +8 -0
  543. package/lib/utils/cli/vpc.d.ts.map +1 -0
  544. package/lib/utils/cli/vpc.js +74 -0
  545. package/lib/utils/cli/vpc.js.map +1 -0
  546. package/lib/utils/cognito/cognito.d.ts +2 -0
  547. package/lib/utils/cognito/cognito.d.ts.map +1 -0
  548. package/lib/utils/cognito/cognito.js +19 -0
  549. package/lib/utils/cognito/cognito.js.map +1 -0
  550. package/lib/utils/ec2/index.d.ts +2 -0
  551. package/lib/utils/ec2/index.d.ts.map +1 -0
  552. package/lib/utils/ec2/index.js +18 -0
  553. package/lib/utils/ec2/index.js.map +1 -0
  554. package/lib/utils/ec2/private-config.d.ts +11 -0
  555. package/lib/utils/ec2/private-config.d.ts.map +1 -0
  556. package/lib/utils/ec2/private-config.js +3 -0
  557. package/lib/utils/ec2/private-config.js.map +1 -0
  558. package/lib/utils/exec.d.ts +7 -0
  559. package/lib/utils/exec.d.ts.map +1 -0
  560. package/lib/utils/exec.js +46 -0
  561. package/lib/utils/exec.js.map +1 -0
  562. package/lib/utils/git.d.ts +3 -0
  563. package/lib/utils/git.d.ts.map +1 -0
  564. package/lib/utils/git.js +23 -0
  565. package/lib/utils/git.js.map +1 -0
  566. package/lib/utils/lambda/event-source.d.ts +52 -0
  567. package/lib/utils/lambda/event-source.d.ts.map +1 -0
  568. package/lib/utils/lambda/event-source.js +41 -0
  569. package/lib/utils/lambda/event-source.js.map +1 -0
  570. package/lib/utils/lambda/index.d.ts +2 -0
  571. package/lib/utils/lambda/index.d.ts.map +1 -0
  572. package/lib/utils/lambda/index.js +18 -0
  573. package/lib/utils/lambda/index.js.map +1 -0
  574. package/lib/utils/math.d.ts +2 -0
  575. package/lib/utils/math.d.ts.map +1 -0
  576. package/lib/utils/math.js +6 -0
  577. package/lib/utils/math.js.map +1 -0
  578. package/lib/utils/mixin/app-aware-construct.d.ts +11 -0
  579. package/lib/utils/mixin/app-aware-construct.d.ts.map +1 -0
  580. package/lib/utils/mixin/app-aware-construct.js +35 -0
  581. package/lib/utils/mixin/app-aware-construct.js.map +1 -0
  582. package/lib/utils/mixin/types.d.ts +2 -0
  583. package/lib/utils/mixin/types.d.ts.map +1 -0
  584. package/lib/utils/mixin/types.js +3 -0
  585. package/lib/utils/mixin/types.js.map +1 -0
  586. package/lib/utils/security-groups/helpers.d.ts +4 -0
  587. package/lib/utils/security-groups/helpers.d.ts.map +1 -0
  588. package/lib/utils/security-groups/helpers.js +15 -0
  589. package/lib/utils/security-groups/helpers.js.map +1 -0
  590. package/lib/utils/security-groups/index.d.ts +2 -0
  591. package/lib/utils/security-groups/index.d.ts.map +1 -0
  592. package/lib/utils/security-groups/index.js +18 -0
  593. package/lib/utils/security-groups/index.js.map +1 -0
  594. package/lib/utils/singleton.d.ts +40 -0
  595. package/lib/utils/singleton.d.ts.map +1 -0
  596. package/lib/utils/singleton.js +43 -0
  597. package/lib/utils/singleton.js.map +1 -0
  598. package/lib/utils/string.d.ts +3 -0
  599. package/lib/utils/string.d.ts.map +1 -0
  600. package/lib/utils/string.js +19 -0
  601. package/lib/utils/string.js.map +1 -0
  602. package/lib/utils/test/assertions.d.ts +24 -0
  603. package/lib/utils/test/assertions.d.ts.map +1 -0
  604. package/lib/utils/test/assertions.js +88 -0
  605. package/lib/utils/test/assertions.js.map +1 -0
  606. package/lib/utils/test/attach-policy-to-test-role.d.ts +4 -0
  607. package/lib/utils/test/attach-policy-to-test-role.d.ts.map +1 -0
  608. package/lib/utils/test/attach-policy-to-test-role.js +15 -0
  609. package/lib/utils/test/attach-policy-to-test-role.js.map +1 -0
  610. package/lib/utils/test/index.d.ts +5 -0
  611. package/lib/utils/test/index.d.ts.map +1 -0
  612. package/lib/utils/test/index.js +21 -0
  613. package/lib/utils/test/index.js.map +1 -0
  614. package/lib/utils/test/simple-gu-stack.d.ts +4 -0
  615. package/lib/utils/test/simple-gu-stack.d.ts.map +1 -0
  616. package/lib/utils/test/simple-gu-stack.js +13 -0
  617. package/lib/utils/test/simple-gu-stack.js.map +1 -0
  618. package/lib/utils/test/template.d.ts +12 -0
  619. package/lib/utils/test/template.d.ts.map +1 -0
  620. package/lib/utils/test/template.js +28 -0
  621. package/lib/utils/test/template.js.map +1 -0
  622. package/package.json +72 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracking-tag.js","sourceRoot":"","sources":["../../src/constants/tracking-tag.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAC7C,mDAA+C;AAElC,QAAA,WAAW,GAAG;IACzB,GAAG,EAAE,4BAAY,CAAC,OAAO;IACzB,KAAK,EAAE,0BAAW,CAAC,OAAO;CAC3B,CAAC","sourcesContent":["import { LibraryInfo } from \"./library-info\";\nimport { MetadataKeys } from \"./metadata-keys\";\n\nexport const TrackingTag = {\n Key: MetadataKeys.VERSION,\n Value: LibraryInfo.VERSION,\n};\n"]}
@@ -0,0 +1,24 @@
1
+ import { Certificate } from "aws-cdk-lib/aws-certificatemanager";
2
+ import type { GuDomainName } from "../../types";
3
+ import { AppIdentity } from "../core";
4
+ import type { GuStack } from "../core";
5
+ export type GuCertificatePropsWithApp = GuDomainName & AppIdentity;
6
+ declare const GuCertificate_base: {
7
+ new (...args: any[]): {
8
+ readonly idWithApp: string;
9
+ };
10
+ } & typeof Certificate;
11
+ /**
12
+ * Construct which creates a DNS-validated ACM Certificate.
13
+ *
14
+ * If your DNS is managed via Route 53, then supplying `hostedZoneId` props will allow AWS to automatically
15
+ * validate your certificate.
16
+ *
17
+ * If your DNS is not managed via Route 53, or you omit the `hostedZoneId` props, then the CloudFormation
18
+ * operation which adds this construct will pause until the relevant DNS record has been added manually.
19
+ */
20
+ export declare class GuCertificate extends GuCertificate_base {
21
+ constructor(scope: GuStack, props: GuCertificatePropsWithApp);
22
+ }
23
+ export {};
24
+ //# sourceMappingURL=certificate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certificate.d.ts","sourceRoot":"","sources":["../../../src/constructs/acm/certificate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,oCAAoC,CAAC;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,WAAW,CAAC;;;;;;AAEnE;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,kBAAgC;gBACrD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB;CAe7D"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuCertificate = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const aws_certificatemanager_1 = require("aws-cdk-lib/aws-certificatemanager");
6
+ const aws_route53_1 = require("aws-cdk-lib/aws-route53");
7
+ const app_aware_construct_1 = require("../../utils/mixin/app-aware-construct");
8
+ const core_1 = require("../core");
9
+ /**
10
+ * Construct which creates a DNS-validated ACM Certificate.
11
+ *
12
+ * If your DNS is managed via Route 53, then supplying `hostedZoneId` props will allow AWS to automatically
13
+ * validate your certificate.
14
+ *
15
+ * If your DNS is not managed via Route 53, or you omit the `hostedZoneId` props, then the CloudFormation
16
+ * operation which adds this construct will pause until the relevant DNS record has been added manually.
17
+ */
18
+ class GuCertificate extends (0, app_aware_construct_1.GuAppAwareConstruct)(aws_certificatemanager_1.Certificate) {
19
+ constructor(scope, props) {
20
+ const { app, domainName, hostedZoneId } = props;
21
+ const maybeHostedZone = hostedZoneId
22
+ ? aws_route53_1.HostedZone.fromHostedZoneId(scope, core_1.AppIdentity.suffixText({ app }, "HostedZone"), hostedZoneId)
23
+ : undefined;
24
+ const awsCertificateProps = {
25
+ domainName,
26
+ validation: aws_certificatemanager_1.CertificateValidation.fromDns(maybeHostedZone),
27
+ app,
28
+ };
29
+ super(scope, "Certificate", awsCertificateProps);
30
+ this.applyRemovalPolicy(aws_cdk_lib_1.RemovalPolicy.RETAIN);
31
+ }
32
+ }
33
+ exports.GuCertificate = GuCertificate;
34
+ //# sourceMappingURL=certificate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certificate.js","sourceRoot":"","sources":["../../../src/constructs/acm/certificate.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,+EAAwF;AAExF,yDAAqD;AAErD,+EAA4E;AAC5E,kCAAsC;AAKtC;;;;;;;;GAQG;AACH,MAAa,aAAc,SAAQ,IAAA,yCAAmB,EAAC,oCAAW,CAAC;IACjE,YAAY,KAAc,EAAE,KAAgC;QAC1D,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;QAEhD,MAAM,eAAe,GAAG,YAAY;YAClC,CAAC,CAAC,wBAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,kBAAW,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC;YACjG,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,mBAAmB,GAAmC;YAC1D,UAAU;YACV,UAAU,EAAE,8CAAqB,CAAC,OAAO,CAAC,eAAe,CAAC;YAC1D,GAAG;SACJ,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QACjD,IAAI,CAAC,kBAAkB,CAAC,2BAAa,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AAhBD,sCAgBC","sourcesContent":["import { RemovalPolicy } from \"aws-cdk-lib\";\nimport { Certificate, CertificateValidation } from \"aws-cdk-lib/aws-certificatemanager\";\nimport type { CertificateProps } from \"aws-cdk-lib/aws-certificatemanager/lib/certificate\";\nimport { HostedZone } from \"aws-cdk-lib/aws-route53\";\nimport type { GuDomainName } from \"../../types\";\nimport { GuAppAwareConstruct } from \"../../utils/mixin/app-aware-construct\";\nimport { AppIdentity } from \"../core\";\nimport type { GuStack } from \"../core\";\n\nexport type GuCertificatePropsWithApp = GuDomainName & AppIdentity;\n\n/**\n * Construct which creates a DNS-validated ACM Certificate.\n *\n * If your DNS is managed via Route 53, then supplying `hostedZoneId` props will allow AWS to automatically\n * validate your certificate.\n *\n * If your DNS is not managed via Route 53, or you omit the `hostedZoneId` props, then the CloudFormation\n * operation which adds this construct will pause until the relevant DNS record has been added manually.\n */\nexport class GuCertificate extends GuAppAwareConstruct(Certificate) {\n constructor(scope: GuStack, props: GuCertificatePropsWithApp) {\n const { app, domainName, hostedZoneId } = props;\n\n const maybeHostedZone = hostedZoneId\n ? HostedZone.fromHostedZoneId(scope, AppIdentity.suffixText({ app }, \"HostedZone\"), hostedZoneId)\n : undefined;\n\n const awsCertificateProps: CertificateProps & AppIdentity = {\n domainName,\n validation: CertificateValidation.fromDns(maybeHostedZone),\n app,\n };\n super(scope, \"Certificate\", awsCertificateProps);\n this.applyRemovalPolicy(RemovalPolicy.RETAIN);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./certificate";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constructs/acm/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./certificate"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constructs/acm/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B","sourcesContent":["export * from \"./certificate\";\n"]}
@@ -0,0 +1,75 @@
1
+ import type { Duration } from "aws-cdk-lib";
2
+ import { AutoScalingGroup } from "aws-cdk-lib/aws-autoscaling";
3
+ import type { AutoScalingGroupProps } from "aws-cdk-lib/aws-autoscaling";
4
+ import { LaunchTemplate } from "aws-cdk-lib/aws-ec2";
5
+ import type { InstanceType, ISecurityGroup, UserData } from "aws-cdk-lib/aws-ec2";
6
+ import type { ApplicationTargetGroup } from "aws-cdk-lib/aws-elasticloadbalancingv2";
7
+ import type { GuAsgCapacity } from "../../types";
8
+ import type { AmigoProps } from "../../types/amigo";
9
+ import { GuAmiParameter } from "../core";
10
+ import type { AppIdentity, GuStack } from "../core";
11
+ export type InstanceMetricGranularity = "1Minute" | "5Minute";
12
+ export interface GuAutoScalingGroupProps extends Omit<AutoScalingGroupProps, "imageId" | "osType" | "machineImage" | "userData" | "minCapacity" | "maxCapacity" | "desiredCapacity" | "requireImdsv2" | "securityGroup">, AppIdentity, GuAsgCapacity {
13
+ /**
14
+ * @deprecated
15
+ * It shouldn't be necessary to specify a value here.
16
+ * GuCDK will create an AMI parameter by default. Riff-Raff can use this parameter to inject the latest AMI ID for
17
+ * your AMIgo recipe.
18
+ */
19
+ imageId?: GuAmiParameter;
20
+ /**
21
+ * If you are using GuCDK to generate your riff-raff.yaml file, specify AMIgo props here.
22
+ * If you are using a hardcoded riff-raff.yaml file (usually found in project root) then providing a value here has no
23
+ * effect.
24
+ */
25
+ imageRecipe?: string | AmigoProps;
26
+ instanceType: InstanceType;
27
+ userData: UserData;
28
+ /**
29
+ * How often to send EC2 metrics, such as CPU usage.
30
+ * By default, AWS will produce `5Minute` granular metrics.
31
+ *
32
+ * It is recommended to produce `1Minute` granular metrics in production,
33
+ * especially when using ASG metrics to trigger horizontal scaling as it allows for earlier scaling.
34
+ *
35
+ * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html
36
+ */
37
+ instanceMetricGranularity: InstanceMetricGranularity;
38
+ additionalSecurityGroups?: ISecurityGroup[];
39
+ targetGroup?: ApplicationTargetGroup;
40
+ httpPutResponseHopLimit?: number;
41
+ defaultInstanceWarmup?: Duration;
42
+ }
43
+ declare const GuAutoScalingGroup_base: {
44
+ new (...args: any[]): {
45
+ readonly idWithApp: string;
46
+ };
47
+ } & typeof AutoScalingGroup;
48
+ /**
49
+ * Construct which creates an Auto Scaling group.
50
+ *
51
+ * By default, all EC2 instances in this group will use [[`GuInstanceRole`]],
52
+ * which provides common permissions (e.g. the ability to download an artifact and write logs to the account's logging Kinesis stream).
53
+ *
54
+ * If additional IAM permissions are required, a custom role can be provided via the `role` prop.
55
+ * You may wish to instantiate [[`GuInstanceRole`]] yourself as a basis for this custom role, as it allows custom permissions
56
+ * to be passed in.
57
+ *
58
+ * All EC2 instances in this group will be automatically associated with the [[`GuHttpsEgressSecurityGroup`]] security groups,
59
+ * which allows outbound traffic over HTTPS.
60
+ *
61
+ * If additional ingress or egress rules are required, define custom security groups and pass them in via the
62
+ * `additionalSecurityGroups` prop.
63
+ *
64
+ * All EC2 instances provisioned via this construct will use
65
+ * [IMDSv2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html).
66
+ */
67
+ export declare class GuAutoScalingGroup extends GuAutoScalingGroup_base {
68
+ readonly app: string;
69
+ readonly amiParameter: GuAmiParameter;
70
+ readonly imageRecipe?: string | AmigoProps;
71
+ readonly instanceLaunchTemplate: LaunchTemplate;
72
+ constructor(scope: GuStack, id: string, props: GuAutoScalingGroupProps);
73
+ }
74
+ export {};
75
+ //# sourceMappingURL=asg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asg.d.ts","sourceRoot":"","sources":["../../../src/constructs/autoscaling/asg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAgB,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAsB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIpD,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,SAAS,CAAC;AAM9D,MAAM,WAAW,uBACf,SACE,IAAI,CACF,qBAAqB,EACnB,SAAS,GACT,QAAQ,GACR,cAAc,GACd,UAAU,GACV,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,eAAe,GACf,eAAe,CAClB,EACD,WAAW,EACX,aAAa;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;;;;;;OAQG;IACH,yBAAyB,EAAE,yBAAyB,CAAC;IAErD,wBAAwB,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5C,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,qBAAqB,CAAC,EAAE,QAAQ,CAAC;CAClC;;;;;;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,kBAAmB,SAAQ,uBAAqC;IAC3E,SAAgB,GAAG,EAAE,MAAM,CAAC;IAC5B,SAAgB,YAAY,EAAE,cAAc,CAAC;IAC7C,SAAgB,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAGlD,SAAgB,sBAAsB,EAAE,cAAc,CAAC;gBAE3C,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB;CAwGvE"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuAutoScalingGroup = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const aws_autoscaling_1 = require("aws-cdk-lib/aws-autoscaling");
6
+ const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
7
+ const app_aware_construct_1 = require("../../utils/mixin/app-aware-construct");
8
+ const core_1 = require("../core");
9
+ const ec2_1 = require("../ec2");
10
+ const iam_1 = require("../iam");
11
+ /**
12
+ * Construct which creates an Auto Scaling group.
13
+ *
14
+ * By default, all EC2 instances in this group will use [[`GuInstanceRole`]],
15
+ * which provides common permissions (e.g. the ability to download an artifact and write logs to the account's logging Kinesis stream).
16
+ *
17
+ * If additional IAM permissions are required, a custom role can be provided via the `role` prop.
18
+ * You may wish to instantiate [[`GuInstanceRole`]] yourself as a basis for this custom role, as it allows custom permissions
19
+ * to be passed in.
20
+ *
21
+ * All EC2 instances in this group will be automatically associated with the [[`GuHttpsEgressSecurityGroup`]] security groups,
22
+ * which allows outbound traffic over HTTPS.
23
+ *
24
+ * If additional ingress or egress rules are required, define custom security groups and pass them in via the
25
+ * `additionalSecurityGroups` prop.
26
+ *
27
+ * All EC2 instances provisioned via this construct will use
28
+ * [IMDSv2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html).
29
+ */
30
+ class GuAutoScalingGroup extends (0, app_aware_construct_1.GuAppAwareConstruct)(aws_autoscaling_1.AutoScalingGroup) {
31
+ constructor(scope, id, props) {
32
+ const { app, additionalSecurityGroups = [], blockDevices, imageId = new core_1.GuAmiParameter(scope, { app }), imageRecipe, instanceType, groupMetrics = [aws_autoscaling_1.GroupMetrics.all()], minimumInstances, maximumInstances, role = new iam_1.GuInstanceRole(scope, { app }), targetGroup, userData, vpc, httpPutResponseHopLimit, updatePolicy, defaultInstanceWarmup, instanceMetricGranularity, } = props;
33
+ // Ensure min and max are defined in the same way. Throwing an `Error` when necessary. For example when min is defined via a Mapping, but max is not.
34
+ if (aws_cdk_lib_1.Token.isUnresolved(minimumInstances) && !aws_cdk_lib_1.Token.isUnresolved(maximumInstances)) {
35
+ throw new Error("minimumInstances is defined via a Mapping, but maximumInstances is not. Create maximumInstances via a Mapping too.");
36
+ }
37
+ const detailedMonitoring = instanceMetricGranularity === "1Minute";
38
+ // Generate an ID unique to this app
39
+ const launchTemplateId = `${scope.stack}-${scope.stage}-${app}`;
40
+ const launchTemplate = new aws_ec2_1.LaunchTemplate(scope, launchTemplateId, {
41
+ blockDevices,
42
+ detailedMonitoring,
43
+ instanceType,
44
+ machineImage: {
45
+ getImage: () => {
46
+ return {
47
+ osType: aws_ec2_1.OperatingSystemType.LINUX,
48
+ userData,
49
+ imageId: imageId.valueAsString,
50
+ };
51
+ },
52
+ },
53
+ // Do not use the default AWS security group which allows egress on any port.
54
+ // Favour HTTPS only egress rules by default.
55
+ securityGroup: ec2_1.GuHttpsEgressSecurityGroup.forVpc(scope, { app, vpc }),
56
+ /*
57
+ Ensure we satisfy FSBP EC2.8 control. If needed, an escape hatch can override this.
58
+ See https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-8.
59
+ */
60
+ requireImdsv2: true,
61
+ instanceMetadataTags: true,
62
+ userData,
63
+ role,
64
+ httpPutResponseHopLimit,
65
+ });
66
+ // Add additional consumer specified Security Groups
67
+ // Note: Launch templates via CDK allow specifying only one SG, so use connections
68
+ // https://github.com/aws/aws-cdk/issues/18712
69
+ additionalSecurityGroups.forEach((sg) => launchTemplate.connections.addSecurityGroup(sg));
70
+ const asgProps = {
71
+ ...props,
72
+ launchTemplate,
73
+ maxCapacity: maximumInstances ?? minimumInstances * 2,
74
+ minCapacity: minimumInstances,
75
+ groupMetrics: groupMetrics,
76
+ // Omit userData, instanceType, blockDevices & role from asgProps
77
+ // As this are specified by the LaunchTemplate and must not be duplicated
78
+ blockDevices: undefined,
79
+ instanceType: undefined,
80
+ role: undefined,
81
+ userData: undefined,
82
+ defaultInstanceWarmup,
83
+ };
84
+ super(scope, id, asgProps);
85
+ this.app = app;
86
+ this.amiParameter = imageId;
87
+ this.imageRecipe = imageRecipe;
88
+ this.instanceLaunchTemplate = launchTemplate;
89
+ if (targetGroup) {
90
+ this.attachToApplicationTargetGroup(targetGroup);
91
+ }
92
+ const cfnAsg = this.node.defaultChild;
93
+ // A CDK AutoScalingGroup comes with this update policy, whereas the CFN autscaling group
94
+ // leaves it to the default value, which is actually false.
95
+ // { UpdatePolicy: { autoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: true }}
96
+ if (!updatePolicy) {
97
+ cfnAsg.addDeletionOverride("UpdatePolicy");
98
+ }
99
+ aws_cdk_lib_1.Tags.of(launchTemplate).add("App", app);
100
+ }
101
+ }
102
+ exports.GuAutoScalingGroup = GuAutoScalingGroup;
103
+ //# sourceMappingURL=asg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asg.js","sourceRoot":"","sources":["../../../src/constructs/autoscaling/asg.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,iEAA6E;AAE7E,iDAA0E;AAK1E,+EAA4E;AAC5E,kCAAyC;AAEzC,gCAAoD;AACpD,gCAAwC;AAyDxC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,kBAAmB,SAAQ,IAAA,yCAAmB,EAAC,kCAAgB,CAAC;IAQ3E,YAAY,KAAc,EAAE,EAAU,EAAE,KAA8B;QACpE,MAAM,EACJ,GAAG,EACH,wBAAwB,GAAG,EAAE,EAC7B,YAAY,EACZ,OAAO,GAAG,IAAI,qBAAc,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,EAC5C,WAAW,EACX,YAAY,EACZ,YAAY,GAAG,CAAC,8BAAY,CAAC,GAAG,EAAE,CAAC,EACnC,gBAAgB,EAChB,gBAAgB,EAChB,IAAI,GAAG,IAAI,oBAAc,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,GAAG,EACH,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,GAC1B,GAAG,KAAK,CAAC;QAEV,qJAAqJ;QACrJ,IAAI,mBAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,mBAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAClF,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;QACJ,CAAC;QAED,MAAM,kBAAkB,GAAG,yBAAyB,KAAK,SAAS,CAAC;QAEnE,oCAAoC;QACpC,MAAM,gBAAgB,GAAG,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;QAChE,MAAM,cAAc,GAAG,IAAI,wBAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE;YACjE,YAAY;YACZ,kBAAkB;YAClB,YAAY;YACZ,YAAY,EAAE;gBACZ,QAAQ,EAAE,GAAuB,EAAE;oBACjC,OAAO;wBACL,MAAM,EAAE,6BAAmB,CAAC,KAAK;wBACjC,QAAQ;wBACR,OAAO,EAAE,OAAO,CAAC,aAAa;qBAC/B,CAAC;gBACJ,CAAC;aACF;YACD,6EAA6E;YAC7E,6CAA6C;YAC7C,aAAa,EAAE,gCAA0B,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;YAErE;;;eAGG;YACH,aAAa,EAAE,IAAI;YAEnB,oBAAoB,EAAE,IAAI;YAC1B,QAAQ;YACR,IAAI;YACJ,uBAAuB;SACxB,CAAC,CAAC;QAEH,oDAAoD;QACpD,kFAAkF;QAClF,8CAA8C;QAC9C,wBAAwB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC;QAE1F,MAAM,QAAQ,GAA0B;YACtC,GAAG,KAAK;YACR,cAAc;YACd,WAAW,EAAE,gBAAgB,IAAI,gBAAgB,GAAG,CAAC;YACrD,WAAW,EAAE,gBAAgB;YAC7B,YAAY,EAAE,YAAY;YAE1B,iEAAiE;YACjE,yEAAyE;YACzE,YAAY,EAAE,SAAS;YACvB,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,SAAS;YACnB,qBAAqB;SACtB,CAAC;QAEF,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QAE3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,sBAAsB,GAAG,cAAc,CAAC;QAE7C,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,YAAmC,CAAC;QAE7D,yFAAyF;QACzF,2DAA2D;QAC3D,+FAA+F;QAC/F,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAC7C,CAAC;QAED,kBAAI,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;CACF;AAhHD,gDAgHC","sourcesContent":["import type { Duration } from \"aws-cdk-lib\";\nimport { Tags, Token } from \"aws-cdk-lib\";\nimport { AutoScalingGroup, GroupMetrics } from \"aws-cdk-lib/aws-autoscaling\";\nimport type { AutoScalingGroupProps, CfnAutoScalingGroup } from \"aws-cdk-lib/aws-autoscaling\";\nimport { LaunchTemplate, OperatingSystemType } from \"aws-cdk-lib/aws-ec2\";\nimport type { InstanceType, ISecurityGroup, MachineImageConfig, UserData } from \"aws-cdk-lib/aws-ec2\";\nimport type { ApplicationTargetGroup } from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport type { GuAsgCapacity } from \"../../types\";\nimport type { AmigoProps } from \"../../types/amigo\";\nimport { GuAppAwareConstruct } from \"../../utils/mixin/app-aware-construct\";\nimport { GuAmiParameter } from \"../core\";\nimport type { AppIdentity, GuStack } from \"../core\";\nimport { GuHttpsEgressSecurityGroup } from \"../ec2\";\nimport { GuInstanceRole } from \"../iam\";\n\nexport type InstanceMetricGranularity = \"1Minute\" | \"5Minute\";\n\n// Since we want to override the types of what gets passed in for the below props,\n// we need to use Omit<T, U> to remove them from the interface this extends\n// https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys\n// TODO avoid prop nesting to improve discoverability. See https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md#flat.\nexport interface GuAutoScalingGroupProps\n extends\n Omit<\n AutoScalingGroupProps,\n | \"imageId\"\n | \"osType\"\n | \"machineImage\"\n | \"userData\"\n | \"minCapacity\"\n | \"maxCapacity\"\n | \"desiredCapacity\"\n | \"requireImdsv2\"\n | \"securityGroup\"\n >,\n AppIdentity,\n GuAsgCapacity {\n /**\n * @deprecated\n * It shouldn't be necessary to specify a value here.\n * GuCDK will create an AMI parameter by default. Riff-Raff can use this parameter to inject the latest AMI ID for\n * your AMIgo recipe.\n */\n imageId?: GuAmiParameter;\n /**\n * If you are using GuCDK to generate your riff-raff.yaml file, specify AMIgo props here.\n * If you are using a hardcoded riff-raff.yaml file (usually found in project root) then providing a value here has no\n * effect.\n */\n imageRecipe?: string | AmigoProps;\n instanceType: InstanceType;\n userData: UserData;\n\n /**\n * How often to send EC2 metrics, such as CPU usage.\n * By default, AWS will produce `5Minute` granular metrics.\n *\n * It is recommended to produce `1Minute` granular metrics in production,\n * especially when using ASG metrics to trigger horizontal scaling as it allows for earlier scaling.\n *\n * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html\n */\n instanceMetricGranularity: InstanceMetricGranularity;\n\n additionalSecurityGroups?: ISecurityGroup[];\n targetGroup?: ApplicationTargetGroup;\n httpPutResponseHopLimit?: number;\n defaultInstanceWarmup?: Duration;\n}\n\n/**\n * Construct which creates an Auto Scaling group.\n *\n * By default, all EC2 instances in this group will use [[`GuInstanceRole`]],\n * which provides common permissions (e.g. the ability to download an artifact and write logs to the account's logging Kinesis stream).\n *\n * If additional IAM permissions are required, a custom role can be provided via the `role` prop.\n * You may wish to instantiate [[`GuInstanceRole`]] yourself as a basis for this custom role, as it allows custom permissions\n * to be passed in.\n *\n * All EC2 instances in this group will be automatically associated with the [[`GuHttpsEgressSecurityGroup`]] security groups,\n * which allows outbound traffic over HTTPS.\n *\n * If additional ingress or egress rules are required, define custom security groups and pass them in via the\n * `additionalSecurityGroups` prop.\n *\n * All EC2 instances provisioned via this construct will use\n * [IMDSv2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html).\n */\nexport class GuAutoScalingGroup extends GuAppAwareConstruct(AutoScalingGroup) {\n public readonly app: string;\n public readonly amiParameter: GuAmiParameter;\n public readonly imageRecipe?: string | AmigoProps;\n\n // Sadly this cannot be named `launchTemplate` as it would clash with a private property on the `AutoScalingGroup` class\n public readonly instanceLaunchTemplate: LaunchTemplate;\n\n constructor(scope: GuStack, id: string, props: GuAutoScalingGroupProps) {\n const {\n app,\n additionalSecurityGroups = [],\n blockDevices,\n imageId = new GuAmiParameter(scope, { app }),\n imageRecipe,\n instanceType,\n groupMetrics = [GroupMetrics.all()],\n minimumInstances,\n maximumInstances,\n role = new GuInstanceRole(scope, { app }),\n targetGroup,\n userData,\n vpc,\n httpPutResponseHopLimit,\n updatePolicy,\n defaultInstanceWarmup,\n instanceMetricGranularity,\n } = props;\n\n // Ensure min and max are defined in the same way. Throwing an `Error` when necessary. For example when min is defined via a Mapping, but max is not.\n if (Token.isUnresolved(minimumInstances) && !Token.isUnresolved(maximumInstances)) {\n throw new Error(\n \"minimumInstances is defined via a Mapping, but maximumInstances is not. Create maximumInstances via a Mapping too.\",\n );\n }\n\n const detailedMonitoring = instanceMetricGranularity === \"1Minute\";\n\n // Generate an ID unique to this app\n const launchTemplateId = `${scope.stack}-${scope.stage}-${app}`;\n const launchTemplate = new LaunchTemplate(scope, launchTemplateId, {\n blockDevices,\n detailedMonitoring,\n instanceType,\n machineImage: {\n getImage: (): MachineImageConfig => {\n return {\n osType: OperatingSystemType.LINUX,\n userData,\n imageId: imageId.valueAsString,\n };\n },\n },\n // Do not use the default AWS security group which allows egress on any port.\n // Favour HTTPS only egress rules by default.\n securityGroup: GuHttpsEgressSecurityGroup.forVpc(scope, { app, vpc }),\n\n /*\n Ensure we satisfy FSBP EC2.8 control. If needed, an escape hatch can override this.\n See https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-8.\n */\n requireImdsv2: true,\n\n instanceMetadataTags: true,\n userData,\n role,\n httpPutResponseHopLimit,\n });\n\n // Add additional consumer specified Security Groups\n // Note: Launch templates via CDK allow specifying only one SG, so use connections\n // https://github.com/aws/aws-cdk/issues/18712\n additionalSecurityGroups.forEach((sg) => launchTemplate.connections.addSecurityGroup(sg));\n\n const asgProps: AutoScalingGroupProps = {\n ...props,\n launchTemplate,\n maxCapacity: maximumInstances ?? minimumInstances * 2,\n minCapacity: minimumInstances,\n groupMetrics: groupMetrics,\n\n // Omit userData, instanceType, blockDevices & role from asgProps\n // As this are specified by the LaunchTemplate and must not be duplicated\n blockDevices: undefined,\n instanceType: undefined,\n role: undefined,\n userData: undefined,\n defaultInstanceWarmup,\n };\n\n super(scope, id, asgProps);\n\n this.app = app;\n this.amiParameter = imageId;\n this.imageRecipe = imageRecipe;\n this.instanceLaunchTemplate = launchTemplate;\n\n if (targetGroup) {\n this.attachToApplicationTargetGroup(targetGroup);\n }\n\n const cfnAsg = this.node.defaultChild as CfnAutoScalingGroup;\n\n // A CDK AutoScalingGroup comes with this update policy, whereas the CFN autscaling group\n // leaves it to the default value, which is actually false.\n // { UpdatePolicy: { autoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: true }}\n if (!updatePolicy) {\n cfnAsg.addDeletionOverride(\"UpdatePolicy\");\n }\n\n Tags.of(launchTemplate).add(\"App\", app);\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./asg";
2
+ export * from "./user-data";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constructs/autoscaling/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./asg"), exports);
18
+ __exportStar(require("./user-data"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constructs/autoscaling/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,8CAA4B","sourcesContent":["export * from \"./asg\";\nexport * from \"./user-data\";\n"]}
@@ -0,0 +1,28 @@
1
+ import { UserData } from "aws-cdk-lib/aws-ec2";
2
+ import type { S3DownloadOptions } from "aws-cdk-lib/aws-ec2";
3
+ import type { GuDistributableForEc2 } from "../../types";
4
+ import type { GuPrivateS3ConfigurationProps } from "../../utils/ec2";
5
+ import type { AppIdentity, GuStack } from "../core";
6
+ export type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;
7
+ export interface GuUserDataProps {
8
+ distributable: GuDistributableForEc2;
9
+ configuration?: GuPrivateS3ConfigurationProps;
10
+ }
11
+ /**
12
+ * An abstraction over UserData to simplify its creation.
13
+ * Especially useful for simple user data where we:
14
+ * - (optional) download config
15
+ * - download distributable
16
+ * - execute distributable
17
+ */
18
+ export declare class GuUserData {
19
+ private readonly _userData;
20
+ readonly configuration?: GuPrivateS3ConfigurationProps;
21
+ get userData(): UserData;
22
+ private downloadDistributable;
23
+ private downloadConfiguration;
24
+ constructor(scope: GuStack, props: GuUserDataPropsWithApp);
25
+ addCommands(...commands: string[]): GuUserData;
26
+ addS3DownloadCommand(params: S3DownloadOptions): GuUserData;
27
+ }
28
+ //# sourceMappingURL=user-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-data.d.ts","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,WAAW,CAAC;AACnE,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,qBAAqB,CAAC;IACrC,aAAa,CAAC,EAAE,6BAA6B,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,6BAA6B,CAAC;IAEvD,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,qBAAqB;gBAqBjB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,sBAAsB;IAYzD,WAAW,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,UAAU;IAK9C,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;CAI5D"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuUserData = void 0;
4
+ const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
5
+ const aws_s3_1 = require("aws-cdk-lib/aws-s3");
6
+ const types_1 = require("../../types");
7
+ const core_1 = require("../core");
8
+ /**
9
+ * An abstraction over UserData to simplify its creation.
10
+ * Especially useful for simple user data where we:
11
+ * - (optional) download config
12
+ * - download distributable
13
+ * - execute distributable
14
+ */
15
+ class GuUserData {
16
+ get userData() {
17
+ return this._userData;
18
+ }
19
+ downloadDistributable(scope, app, props) {
20
+ const bucketKey = types_1.GuDistributable.getObjectKey(scope, app, props);
21
+ const bucket = aws_s3_1.Bucket.fromBucketAttributes(scope, `DistributionBucket-${app.app}`, {
22
+ bucketName: core_1.GuDistributionBucketParameter.getInstance(scope).valueAsString,
23
+ });
24
+ this.addS3DownloadCommand({
25
+ bucket,
26
+ bucketKey,
27
+ localFile: `/${app.app}/${props.fileName}`,
28
+ });
29
+ }
30
+ downloadConfiguration(scope, app, props) {
31
+ const bucket = aws_s3_1.Bucket.fromBucketAttributes(scope, `${app}ConfigurationBucket`, {
32
+ bucketName: props.bucket.valueAsString,
33
+ });
34
+ props.files.forEach((bucketKey) => {
35
+ const fileName = bucketKey.split("/").slice(-1)[0];
36
+ // `fileName` is typed as `string | undefined`. Throw if `fileName` is falsy.
37
+ if (!fileName) {
38
+ throw new Error("Failed to create configuration section in UserData");
39
+ }
40
+ this.addS3DownloadCommand({
41
+ bucket,
42
+ bucketKey,
43
+ localFile: `/etc/${app}/${fileName}`,
44
+ });
45
+ });
46
+ }
47
+ constructor(scope, props) {
48
+ this._userData = aws_ec2_1.UserData.forLinux();
49
+ this.configuration = props.configuration;
50
+ if (props.configuration) {
51
+ this.downloadConfiguration(scope, props.app, props.configuration);
52
+ }
53
+ this.downloadDistributable(scope, props, props.distributable);
54
+ this.addCommands(props.distributable.executionStatement);
55
+ }
56
+ addCommands(...commands) {
57
+ this._userData.addCommands(...commands);
58
+ return this;
59
+ }
60
+ addS3DownloadCommand(params) {
61
+ this._userData.addS3DownloadCommand(params);
62
+ return this;
63
+ }
64
+ }
65
+ exports.GuUserData = GuUserData;
66
+ //# sourceMappingURL=user-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-data.js","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAE/C,+CAA4C;AAC5C,uCAA8C;AAG9C,kCAAwD;AASxD;;;;;;GAMG;AACH,MAAa,UAAU;IAIrB,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEO,qBAAqB,CAAC,KAAc,EAAE,GAAgB,EAAE,KAA4B;QAC1F,MAAM,SAAS,GAAG,uBAAe,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAElE,MAAM,MAAM,GAAG,eAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,GAAG,EAAE,EAAE;YACjF,UAAU,EAAE,oCAA6B,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,aAAa;SAC3E,CAAC,CAAC;QAEH,IAAI,CAAC,oBAAoB,CAAC;YACxB,MAAM;YACN,SAAS;YACT,SAAS,EAAE,IAAI,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,QAAQ,EAAE;SAC3C,CAAC,CAAC;IACL,CAAC;IAEO,qBAAqB,CAAC,KAAc,EAAE,GAAW,EAAE,KAAoC;QAC7F,MAAM,MAAM,GAAG,eAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,qBAAqB,EAAE;YAC7E,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,aAAa;SACvC,CAAC,CAAC;QAEH,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAChC,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEnD,6EAA6E;YAC7E,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;YACxE,CAAC;YAED,IAAI,CAAC,oBAAoB,CAAC;gBACxB,MAAM;gBACN,SAAS;gBACT,SAAS,EAAE,QAAQ,GAAG,IAAI,QAAQ,EAAE;aACrC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,KAAc,EAAE,KAA6B;QACvD,IAAI,CAAC,SAAS,GAAG,kBAAQ,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QAEzC,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC3D,CAAC;IAED,WAAW,CAAC,GAAG,QAAkB;QAC/B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,MAAyB;QAC5C,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhED,gCAgEC","sourcesContent":["import { UserData } from \"aws-cdk-lib/aws-ec2\";\nimport type { S3DownloadOptions } from \"aws-cdk-lib/aws-ec2\";\nimport { Bucket } from \"aws-cdk-lib/aws-s3\";\nimport { GuDistributable } from \"../../types\";\nimport type { GuDistributableForEc2 } from \"../../types\";\nimport type { GuPrivateS3ConfigurationProps } from \"../../utils/ec2\";\nimport { GuDistributionBucketParameter } from \"../core\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;\nexport interface GuUserDataProps {\n distributable: GuDistributableForEc2;\n configuration?: GuPrivateS3ConfigurationProps;\n}\n\n/**\n * An abstraction over UserData to simplify its creation.\n * Especially useful for simple user data where we:\n * - (optional) download config\n * - download distributable\n * - execute distributable\n */\nexport class GuUserData {\n private readonly _userData: UserData;\n readonly configuration?: GuPrivateS3ConfigurationProps;\n\n get userData(): UserData {\n return this._userData;\n }\n\n private downloadDistributable(scope: GuStack, app: AppIdentity, props: GuDistributableForEc2) {\n const bucketKey = GuDistributable.getObjectKey(scope, app, props);\n\n const bucket = Bucket.fromBucketAttributes(scope, `DistributionBucket-${app.app}`, {\n bucketName: GuDistributionBucketParameter.getInstance(scope).valueAsString,\n });\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/${app.app}/${props.fileName}`,\n });\n }\n\n private downloadConfiguration(scope: GuStack, app: string, props: GuPrivateS3ConfigurationProps) {\n const bucket = Bucket.fromBucketAttributes(scope, `${app}ConfigurationBucket`, {\n bucketName: props.bucket.valueAsString,\n });\n\n props.files.forEach((bucketKey) => {\n const fileName = bucketKey.split(\"/\").slice(-1)[0];\n\n // `fileName` is typed as `string | undefined`. Throw if `fileName` is falsy.\n if (!fileName) {\n throw new Error(\"Failed to create configuration section in UserData\");\n }\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/etc/${app}/${fileName}`,\n });\n });\n }\n\n constructor(scope: GuStack, props: GuUserDataPropsWithApp) {\n this._userData = UserData.forLinux();\n this.configuration = props.configuration;\n\n if (props.configuration) {\n this.downloadConfiguration(scope, props.app, props.configuration);\n }\n\n this.downloadDistributable(scope, props, props.distributable);\n this.addCommands(props.distributable.executionStatement);\n }\n\n addCommands(...commands: string[]): GuUserData {\n this._userData.addCommands(...commands);\n return this;\n }\n\n addS3DownloadCommand(params: S3DownloadOptions): GuUserData {\n this._userData.addS3DownloadCommand(params);\n return this;\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import { Alarm } from "aws-cdk-lib/aws-cloudwatch";
2
+ import type { AlarmProps } from "aws-cdk-lib/aws-cloudwatch";
3
+ import type { AppIdentity, GuStack } from "../core";
4
+ export interface GuAlarmProps extends AlarmProps, AppIdentity {
5
+ snsTopicName: string;
6
+ okAction?: boolean;
7
+ }
8
+ export interface Http4xxAlarmProps extends Omit<GuAlarmProps, "snsTopicName" | "evaluationPeriods" | "metric" | "period" | "threshold" | "treatMissingData" | "app"> {
9
+ tolerated4xxPercentage: number;
10
+ numberOfMinutesAboveThresholdBeforeAlarm?: number;
11
+ }
12
+ export interface Http5xxAlarmProps extends Omit<GuAlarmProps, "snsTopicName" | "evaluationPeriods" | "metric" | "period" | "threshold" | "treatMissingData" | "app"> {
13
+ tolerated5xxPercentage: number;
14
+ numberOfMinutesAboveThresholdBeforeAlarm?: number;
15
+ }
16
+ /**
17
+ * Creates a CloudWatch alarm which sends notifications to the specified SNS topic.
18
+ *
19
+ * Alarm actions are enabled by default.
20
+ *
21
+ * To enable the alarm only in PROD, use the value of `Stage`:
22
+ * ```typescript
23
+ * new GuAlarm(stack, "alarm", {
24
+ * // other required props
25
+ * actionsEnabled: this.stage === "PROD",
26
+ * });
27
+ * ```
28
+ *
29
+ * This library provides an implementation of some commonly used alarms, which require less boilerplate than this construct,
30
+ * for example the [[`GuAlb5xxPercentageAlarm`]]. Prefer using these more specific implementations where possible.
31
+ */
32
+ export declare class GuAlarm extends Alarm {
33
+ constructor(scope: GuStack, id: string, props: GuAlarmProps);
34
+ }
35
+ //# sourceMappingURL=alarm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alarm.d.ts","sourceRoot":"","sources":["../../../src/constructs/cloudwatch/alarm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,WAAW,YAAa,SAAQ,UAAU,EAAE,WAAW;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,YAAY,EACZ,cAAc,GAAG,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,kBAAkB,GAAG,KAAK,CACtG;IACC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wCAAwC,CAAC,EAAE,MAAM,CAAC;CACnD;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,YAAY,EACZ,cAAc,GAAG,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,kBAAkB,GAAG,KAAK,CACtG;IACC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wCAAwC,CAAC,EAAE,MAAM,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,OAAQ,SAAQ,KAAK;gBACpB,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;CAa5D"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuAlarm = void 0;
4
+ const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch");
5
+ const aws_cloudwatch_actions_1 = require("aws-cdk-lib/aws-cloudwatch-actions");
6
+ const aws_sns_1 = require("aws-cdk-lib/aws-sns");
7
+ /**
8
+ * Creates a CloudWatch alarm which sends notifications to the specified SNS topic.
9
+ *
10
+ * Alarm actions are enabled by default.
11
+ *
12
+ * To enable the alarm only in PROD, use the value of `Stage`:
13
+ * ```typescript
14
+ * new GuAlarm(stack, "alarm", {
15
+ * // other required props
16
+ * actionsEnabled: this.stage === "PROD",
17
+ * });
18
+ * ```
19
+ *
20
+ * This library provides an implementation of some commonly used alarms, which require less boilerplate than this construct,
21
+ * for example the [[`GuAlb5xxPercentageAlarm`]]. Prefer using these more specific implementations where possible.
22
+ */
23
+ class GuAlarm extends aws_cloudwatch_1.Alarm {
24
+ constructor(scope, id, props) {
25
+ const { region, account } = scope;
26
+ const { snsTopicName, actionsEnabled = true, okAction } = props;
27
+ super(scope, id, { ...props, actionsEnabled });
28
+ const topicArn = `arn:aws:sns:${region}:${account}:${snsTopicName}`;
29
+ const snsTopic = aws_sns_1.Topic.fromTopicArn(scope, `SnsTopicFor${id}`, topicArn);
30
+ this.addAlarmAction(new aws_cloudwatch_actions_1.SnsAction(snsTopic));
31
+ if (okAction) {
32
+ this.addOkAction(new aws_cloudwatch_actions_1.SnsAction(snsTopic));
33
+ }
34
+ }
35
+ }
36
+ exports.GuAlarm = GuAlarm;
37
+ //# sourceMappingURL=alarm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alarm.js","sourceRoot":"","sources":["../../../src/constructs/cloudwatch/alarm.ts"],"names":[],"mappings":";;;AAAA,+DAAmD;AAEnD,+EAA+D;AAC/D,iDAA4C;AAyB5C;;;;;;;;;;;;;;;GAeG;AACH,MAAa,OAAQ,SAAQ,sBAAK;IAChC,YAAY,KAAc,EAAE,EAAU,EAAE,KAAmB;QACzD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;QAClC,MAAM,EAAE,YAAY,EAAE,cAAc,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAEhE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAW,eAAe,MAAM,IAAI,OAAO,IAAI,YAAY,EAAE,CAAC;QAC5E,MAAM,QAAQ,GAAW,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QACjF,IAAI,CAAC,cAAc,CAAC,IAAI,kCAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,IAAI,kCAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF;AAdD,0BAcC","sourcesContent":["import { Alarm } from \"aws-cdk-lib/aws-cloudwatch\";\nimport type { AlarmProps } from \"aws-cdk-lib/aws-cloudwatch\";\nimport { SnsAction } from \"aws-cdk-lib/aws-cloudwatch-actions\";\nimport { Topic } from \"aws-cdk-lib/aws-sns\";\nimport type { ITopic } from \"aws-cdk-lib/aws-sns\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport interface GuAlarmProps extends AlarmProps, AppIdentity {\n snsTopicName: string;\n okAction?: boolean;\n}\n\nexport interface Http4xxAlarmProps extends Omit<\n GuAlarmProps,\n \"snsTopicName\" | \"evaluationPeriods\" | \"metric\" | \"period\" | \"threshold\" | \"treatMissingData\" | \"app\"\n> {\n tolerated4xxPercentage: number;\n numberOfMinutesAboveThresholdBeforeAlarm?: number;\n}\n\nexport interface Http5xxAlarmProps extends Omit<\n GuAlarmProps,\n \"snsTopicName\" | \"evaluationPeriods\" | \"metric\" | \"period\" | \"threshold\" | \"treatMissingData\" | \"app\"\n> {\n tolerated5xxPercentage: number;\n numberOfMinutesAboveThresholdBeforeAlarm?: number;\n}\n\n/**\n * Creates a CloudWatch alarm which sends notifications to the specified SNS topic.\n *\n * Alarm actions are enabled by default.\n *\n * To enable the alarm only in PROD, use the value of `Stage`:\n * ```typescript\n * new GuAlarm(stack, \"alarm\", {\n * // other required props\n * actionsEnabled: this.stage === \"PROD\",\n * });\n * ```\n *\n * This library provides an implementation of some commonly used alarms, which require less boilerplate than this construct,\n * for example the [[`GuAlb5xxPercentageAlarm`]]. Prefer using these more specific implementations where possible.\n */\nexport class GuAlarm extends Alarm {\n constructor(scope: GuStack, id: string, props: GuAlarmProps) {\n const { region, account } = scope;\n const { snsTopicName, actionsEnabled = true, okAction } = props;\n\n super(scope, id, { ...props, actionsEnabled });\n\n const topicArn: string = `arn:aws:sns:${region}:${account}:${snsTopicName}`;\n const snsTopic: ITopic = Topic.fromTopicArn(scope, `SnsTopicFor${id}`, topicArn);\n this.addAlarmAction(new SnsAction(snsTopic));\n if (okAction) {\n this.addOkAction(new SnsAction(snsTopic));\n }\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { RestApi } from "aws-cdk-lib/aws-apigateway";
2
+ import type { GuStack } from "../core";
3
+ import { AppIdentity } from "../core";
4
+ import type { GuAlarmProps, Http5xxAlarmProps } from "./alarm";
5
+ import { GuAlarm } from "./alarm";
6
+ interface GuApiGateway5xxPercentageAlarmProps extends Pick<GuAlarmProps, "snsTopicName">, Http5xxAlarmProps, AppIdentity {
7
+ apiGatewayInstance: RestApi;
8
+ }
9
+ /**
10
+ * Creates an alarm which is triggered whenever the percentage of requests with a 5xx response code exceeds
11
+ * the specified threshold.
12
+ */
13
+ export declare class GuApiGateway5xxPercentageAlarm extends GuAlarm {
14
+ constructor(scope: GuStack, props: GuApiGateway5xxPercentageAlarmProps);
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=api-gateway-alarms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-gateway-alarms.d.ts","sourceRoot":"","sources":["../../../src/constructs/cloudwatch/api-gateway-alarms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,UAAU,mCACR,SAAQ,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,EAAE,iBAAiB,EAAE,WAAW;IAC1E,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,qBAAa,8BAA+B,SAAQ,OAAO;gBAC7C,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,mCAAmC;CAwBvE"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuApiGateway5xxPercentageAlarm = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch");
6
+ const core_1 = require("../core");
7
+ const alarm_1 = require("./alarm");
8
+ /**
9
+ * Creates an alarm which is triggered whenever the percentage of requests with a 5xx response code exceeds
10
+ * the specified threshold.
11
+ */
12
+ class GuApiGateway5xxPercentageAlarm extends alarm_1.GuAlarm {
13
+ constructor(scope, props) {
14
+ const mathExpression = new aws_cloudwatch_1.MathExpression({
15
+ expression: "100*m1/m2",
16
+ usingMetrics: {
17
+ m1: props.apiGatewayInstance.metricServerError(),
18
+ m2: props.apiGatewayInstance.metricCount(),
19
+ },
20
+ label: `% of 5XX responses served for ${props.app}`,
21
+ period: aws_cdk_lib_1.Duration.minutes(1),
22
+ });
23
+ const defaultAlarmName = `High 5XX error percentage from ${props.app} (ApiGateway) in ${scope.stage}`;
24
+ const defaultDescription = `${props.app} exceeded ${props.tolerated5xxPercentage}% error rate`;
25
+ const alarmProps = {
26
+ ...props,
27
+ metric: mathExpression,
28
+ treatMissingData: aws_cloudwatch_1.TreatMissingData.NOT_BREACHING,
29
+ threshold: props.tolerated5xxPercentage,
30
+ comparisonOperator: aws_cloudwatch_1.ComparisonOperator.GREATER_THAN_THRESHOLD,
31
+ alarmName: props.alarmName ?? defaultAlarmName,
32
+ alarmDescription: props.alarmDescription ?? defaultDescription,
33
+ evaluationPeriods: props.numberOfMinutesAboveThresholdBeforeAlarm ?? 1,
34
+ };
35
+ super(scope, core_1.AppIdentity.suffixText(props, "ApiGatewayHigh5xxPercentageAlarm"), alarmProps);
36
+ }
37
+ }
38
+ exports.GuApiGateway5xxPercentageAlarm = GuApiGateway5xxPercentageAlarm;
39
+ //# sourceMappingURL=api-gateway-alarms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-gateway-alarms.js","sourceRoot":"","sources":["../../../src/constructs/cloudwatch/api-gateway-alarms.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AAEvC,+DAAkG;AAElG,kCAAsC;AAEtC,mCAAkC;AAOlC;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,eAAO;IACzD,YAAY,KAAc,EAAE,KAA0C;QACpE,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC;YACxC,UAAU,EAAE,WAAW;YACvB,YAAY,EAAE;gBACZ,EAAE,EAAE,KAAK,CAAC,kBAAkB,CAAC,iBAAiB,EAAE;gBAChD,EAAE,EAAE,KAAK,CAAC,kBAAkB,CAAC,WAAW,EAAE;aAC3C;YACD,KAAK,EAAE,iCAAiC,KAAK,CAAC,GAAG,EAAE;YACnD,MAAM,EAAE,sBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SAC5B,CAAC,CAAC;QACH,MAAM,gBAAgB,GAAG,kCAAkC,KAAK,CAAC,GAAG,oBAAoB,KAAK,CAAC,KAAK,EAAE,CAAC;QACtG,MAAM,kBAAkB,GAAG,GAAG,KAAK,CAAC,GAAG,aAAa,KAAK,CAAC,sBAAsB,cAAc,CAAC;QAC/F,MAAM,UAAU,GAAG;YACjB,GAAG,KAAK;YACR,MAAM,EAAE,cAAc;YACtB,gBAAgB,EAAE,iCAAgB,CAAC,aAAa;YAChD,SAAS,EAAE,KAAK,CAAC,sBAAsB;YACvC,kBAAkB,EAAE,mCAAkB,CAAC,sBAAsB;YAC7D,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,gBAAgB;YAC9C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,IAAI,kBAAkB;YAC9D,iBAAiB,EAAE,KAAK,CAAC,wCAAwC,IAAI,CAAC;SACvE,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,kBAAW,CAAC,UAAU,CAAC,KAAK,EAAE,kCAAkC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC9F,CAAC;CACF;AAzBD,wEAyBC","sourcesContent":["import { Duration } from \"aws-cdk-lib\";\nimport type { RestApi } from \"aws-cdk-lib/aws-apigateway\";\nimport { ComparisonOperator, MathExpression, TreatMissingData } from \"aws-cdk-lib/aws-cloudwatch\";\nimport type { GuStack } from \"../core\";\nimport { AppIdentity } from \"../core\";\nimport type { GuAlarmProps, Http5xxAlarmProps } from \"./alarm\";\nimport { GuAlarm } from \"./alarm\";\n\ninterface GuApiGateway5xxPercentageAlarmProps\n extends Pick<GuAlarmProps, \"snsTopicName\">, Http5xxAlarmProps, AppIdentity {\n apiGatewayInstance: RestApi;\n}\n\n/**\n * Creates an alarm which is triggered whenever the percentage of requests with a 5xx response code exceeds\n * the specified threshold.\n */\nexport class GuApiGateway5xxPercentageAlarm extends GuAlarm {\n constructor(scope: GuStack, props: GuApiGateway5xxPercentageAlarmProps) {\n const mathExpression = new MathExpression({\n expression: \"100*m1/m2\",\n usingMetrics: {\n m1: props.apiGatewayInstance.metricServerError(),\n m2: props.apiGatewayInstance.metricCount(),\n },\n label: `% of 5XX responses served for ${props.app}`,\n period: Duration.minutes(1),\n });\n const defaultAlarmName = `High 5XX error percentage from ${props.app} (ApiGateway) in ${scope.stage}`;\n const defaultDescription = `${props.app} exceeded ${props.tolerated5xxPercentage}% error rate`;\n const alarmProps = {\n ...props,\n metric: mathExpression,\n treatMissingData: TreatMissingData.NOT_BREACHING,\n threshold: props.tolerated5xxPercentage,\n comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,\n alarmName: props.alarmName ?? defaultAlarmName,\n alarmDescription: props.alarmDescription ?? defaultDescription,\n evaluationPeriods: props.numberOfMinutesAboveThresholdBeforeAlarm ?? 1,\n };\n super(scope, AppIdentity.suffixText(props, \"ApiGatewayHigh5xxPercentageAlarm\"), alarmProps);\n }\n}\n"]}