@sst-community/sst 4.20.0 → 5.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (832) hide show
  1. package/README.md +92 -52
  2. package/package.json +35 -11
  3. package/platform/js/chunks/chunk-HIZZCEDS.js +328 -0
  4. package/platform/js/chunks/chunk-HIZZCEDS.js.map +6 -0
  5. package/platform/js/chunks/chunk-KOKHGKJ2.js +639 -0
  6. package/platform/js/chunks/chunk-KOKHGKJ2.js.map +6 -0
  7. package/platform/js/chunks/chunk-ONNI4XNK.js +367 -0
  8. package/platform/js/chunks/chunk-ONNI4XNK.js.map +6 -0
  9. package/platform/js/chunks/chunk-VIFHC73J.js +108 -0
  10. package/platform/js/chunks/chunk-VIFHC73J.js.map +6 -0
  11. package/platform/js/chunks/chunk-WJ6BVA46.js +10 -0
  12. package/platform/js/chunks/chunk-WJ6BVA46.js.map +6 -0
  13. package/platform/js/chunks/chunk-ZOXXXME5.js +472 -0
  14. package/platform/js/chunks/chunk-ZOXXXME5.js.map +6 -0
  15. package/platform/js/chunks/component-32FCLIRK.js +26 -0
  16. package/platform/js/chunks/component-32FCLIRK.js.map +6 -0
  17. package/platform/js/chunks/config-DMGMTLNB.js +10 -0
  18. package/platform/js/chunks/config-DMGMTLNB.js.map +6 -0
  19. package/platform/js/chunks/link-OJ3RNGQ3.js +9 -0
  20. package/platform/js/chunks/link-OJ3RNGQ3.js.map +6 -0
  21. package/platform/js/components/aws/index.js +35362 -0
  22. package/platform/js/components/aws/index.js.map +6 -0
  23. package/platform/js/components/cloudflare/index.js +3246 -0
  24. package/platform/js/components/cloudflare/index.js.map +6 -0
  25. package/platform/js/components/core.js +114 -0
  26. package/platform/js/components/core.js.map +6 -0
  27. package/platform/js/components/vercel/index.js +120 -0
  28. package/platform/js/components/vercel/index.js.map +6 -0
  29. package/platform/js/testing/index.js +569 -0
  30. package/platform/js/testing/index.js.map +6 -0
  31. package/platform/package.json +25 -0
  32. package/platform/src/ast/add.mjs +190 -0
  33. package/platform/src/auto/run.ts +109 -0
  34. package/platform/src/components/README.md +652 -0
  35. package/platform/src/components/args.ts +133 -0
  36. package/platform/src/components/aws/alb.ts +577 -0
  37. package/platform/src/components/aws/analog.ts +462 -0
  38. package/platform/src/components/aws/apigateway-websocket-route.ts +206 -0
  39. package/platform/src/components/aws/apigateway-websocket.ts +894 -0
  40. package/platform/src/components/aws/apigatewayv1-api-key.ts +90 -0
  41. package/platform/src/components/aws/apigatewayv1-authorizer.ts +178 -0
  42. package/platform/src/components/aws/apigatewayv1-base-route.ts +78 -0
  43. package/platform/src/components/aws/apigatewayv1-integration-route.ts +92 -0
  44. package/platform/src/components/aws/apigatewayv1-lambda-route.ts +152 -0
  45. package/platform/src/components/aws/apigatewayv1-usage-plan.ts +109 -0
  46. package/platform/src/components/aws/apigatewayv1.ts +1691 -0
  47. package/platform/src/components/aws/apigatewayv2-authorizer.ts +199 -0
  48. package/platform/src/components/aws/apigatewayv2-base-route.ts +69 -0
  49. package/platform/src/components/aws/apigatewayv2-lambda-route.ts +141 -0
  50. package/platform/src/components/aws/apigatewayv2-private-route.ts +101 -0
  51. package/platform/src/components/aws/apigatewayv2-url-route.ts +90 -0
  52. package/platform/src/components/aws/apigatewayv2.ts +1439 -0
  53. package/platform/src/components/aws/app-sync-data-source.ts +264 -0
  54. package/platform/src/components/aws/app-sync-function.ts +79 -0
  55. package/platform/src/components/aws/app-sync-resolver.ts +110 -0
  56. package/platform/src/components/aws/app-sync.ts +849 -0
  57. package/platform/src/components/aws/astro.ts +580 -0
  58. package/platform/src/components/aws/aurora.ts +1356 -0
  59. package/platform/src/components/aws/auth-v1.ts +69 -0
  60. package/platform/src/components/aws/auth.ts +417 -0
  61. package/platform/src/components/aws/bucket-lambda-subscriber.ts +162 -0
  62. package/platform/src/components/aws/bucket-notification.ts +254 -0
  63. package/platform/src/components/aws/bucket-queue-subscriber.ts +122 -0
  64. package/platform/src/components/aws/bucket-topic-subscriber.ts +144 -0
  65. package/platform/src/components/aws/bucket.ts +2046 -0
  66. package/platform/src/components/aws/bus-base-subscriber.ts +52 -0
  67. package/platform/src/components/aws/bus-lambda-subscriber.ts +125 -0
  68. package/platform/src/components/aws/bus-queue-subscriber.ts +88 -0
  69. package/platform/src/components/aws/bus.ts +630 -0
  70. package/platform/src/components/aws/cdn.ts +561 -0
  71. package/platform/src/components/aws/cluster-v1.ts +932 -0
  72. package/platform/src/components/aws/cluster.ts +584 -0
  73. package/platform/src/components/aws/cognito-identity-pool.ts +433 -0
  74. package/platform/src/components/aws/cognito-identity-provider.ts +96 -0
  75. package/platform/src/components/aws/cognito-user-pool-client.ts +114 -0
  76. package/platform/src/components/aws/cognito-user-pool.ts +1089 -0
  77. package/platform/src/components/aws/cron-v2.ts +555 -0
  78. package/platform/src/components/aws/cron.ts +435 -0
  79. package/platform/src/components/aws/dns-validated-certificate.ts +108 -0
  80. package/platform/src/components/aws/dns.ts +221 -0
  81. package/platform/src/components/aws/dsql.ts +741 -0
  82. package/platform/src/components/aws/dynamo-lambda-subscriber.ts +124 -0
  83. package/platform/src/components/aws/dynamo.ts +929 -0
  84. package/platform/src/components/aws/efs.ts +410 -0
  85. package/platform/src/components/aws/email.ts +673 -0
  86. package/platform/src/components/aws/fargate.ts +1279 -0
  87. package/platform/src/components/aws/function.ts +3227 -0
  88. package/platform/src/components/aws/helpers/apigateway-account.ts +78 -0
  89. package/platform/src/components/aws/helpers/apigatewayv2-domain.ts +144 -0
  90. package/platform/src/components/aws/helpers/arn.ts +182 -0
  91. package/platform/src/components/aws/helpers/bootstrap.ts +16 -0
  92. package/platform/src/components/aws/helpers/client.ts +76 -0
  93. package/platform/src/components/aws/helpers/container-builder.ts +33 -0
  94. package/platform/src/components/aws/helpers/custom-domain.ts +128 -0
  95. package/platform/src/components/aws/helpers/event-source.ts +41 -0
  96. package/platform/src/components/aws/helpers/fargate.ts +727 -0
  97. package/platform/src/components/aws/helpers/function-builder.ts +133 -0
  98. package/platform/src/components/aws/helpers/function-code.ts +224 -0
  99. package/platform/src/components/aws/helpers/function-part.ts +202 -0
  100. package/platform/src/components/aws/helpers/function-permission.ts +29 -0
  101. package/platform/src/components/aws/helpers/load-balancer-args.ts +88 -0
  102. package/platform/src/components/aws/helpers/load-balancer.ts +17 -0
  103. package/platform/src/components/aws/helpers/provider.ts +36 -0
  104. package/platform/src/components/aws/helpers/queue-policy.ts +33 -0
  105. package/platform/src/components/aws/helpers/rds.ts +212 -0
  106. package/platform/src/components/aws/helpers/site-builder.ts +41 -0
  107. package/platform/src/components/aws/helpers/subscriber.ts +23 -0
  108. package/platform/src/components/aws/helpers/vpc.ts +27 -0
  109. package/platform/src/components/aws/https-redirect.ts +216 -0
  110. package/platform/src/components/aws/iam-edit.ts +50 -0
  111. package/platform/src/components/aws/index.ts +61 -0
  112. package/platform/src/components/aws/kinesis-stream-lambda-subscriber.ts +122 -0
  113. package/platform/src/components/aws/kinesis-stream.ts +416 -0
  114. package/platform/src/components/aws/linkable.ts +32 -0
  115. package/platform/src/components/aws/logging.ts +25 -0
  116. package/platform/src/components/aws/microvm.ts +988 -0
  117. package/platform/src/components/aws/mysql.ts +1047 -0
  118. package/platform/src/components/aws/nextjs.ts +1052 -0
  119. package/platform/src/components/aws/nuxt.ts +527 -0
  120. package/platform/src/components/aws/open-search.ts +603 -0
  121. package/platform/src/components/aws/opencontrol.ts +235 -0
  122. package/platform/src/components/aws/permission.ts +80 -0
  123. package/platform/src/components/aws/postgres-v1.ts +537 -0
  124. package/platform/src/components/aws/postgres.ts +1074 -0
  125. package/platform/src/components/aws/providers/bucket-files.ts +32 -0
  126. package/platform/src/components/aws/providers/distribution-deployment-waiter.ts +27 -0
  127. package/platform/src/components/aws/providers/distribution-invalidation.ts +24 -0
  128. package/platform/src/components/aws/providers/function-environment-update.ts +46 -0
  129. package/platform/src/components/aws/providers/hosted-zone-lookup.ts +25 -0
  130. package/platform/src/components/aws/providers/kv-keys.ts +15 -0
  131. package/platform/src/components/aws/providers/kv-routes-update.ts +24 -0
  132. package/platform/src/components/aws/providers/microvm-image-prune.ts +48 -0
  133. package/platform/src/components/aws/providers/origin-access-control.ts +21 -0
  134. package/platform/src/components/aws/providers/rds-role-lookup.ts +21 -0
  135. package/platform/src/components/aws/providers/vector-table.ts +25 -0
  136. package/platform/src/components/aws/queue-lambda-subscriber.ts +135 -0
  137. package/platform/src/components/aws/queue.ts +712 -0
  138. package/platform/src/components/aws/react.ts +510 -0
  139. package/platform/src/components/aws/realtime-lambda-subscriber.ts +129 -0
  140. package/platform/src/components/aws/realtime.ts +345 -0
  141. package/platform/src/components/aws/redis-v1.ts +595 -0
  142. package/platform/src/components/aws/redis.ts +1078 -0
  143. package/platform/src/components/aws/remix.ts +576 -0
  144. package/platform/src/components/aws/router-base-route.ts +83 -0
  145. package/platform/src/components/aws/router-bucket-route.ts +63 -0
  146. package/platform/src/components/aws/router-url-route.ts +75 -0
  147. package/platform/src/components/aws/router.ts +3281 -0
  148. package/platform/src/components/aws/service-v1.ts +876 -0
  149. package/platform/src/components/aws/service.ts +2994 -0
  150. package/platform/src/components/aws/sns-topic-lambda-subscriber.ts +127 -0
  151. package/platform/src/components/aws/sns-topic-queue-subscriber.ts +105 -0
  152. package/platform/src/components/aws/sns-topic.ts +700 -0
  153. package/platform/src/components/aws/solid-start.ts +467 -0
  154. package/platform/src/components/aws/ssr-site.ts +2204 -0
  155. package/platform/src/components/aws/static-site.ts +1389 -0
  156. package/platform/src/components/aws/step-functions/choice.ts +123 -0
  157. package/platform/src/components/aws/step-functions/fail.ts +69 -0
  158. package/platform/src/components/aws/step-functions/map.ts +264 -0
  159. package/platform/src/components/aws/step-functions/parallel.ts +170 -0
  160. package/platform/src/components/aws/step-functions/pass.ts +48 -0
  161. package/platform/src/components/aws/step-functions/state.ts +376 -0
  162. package/platform/src/components/aws/step-functions/succeed.ts +31 -0
  163. package/platform/src/components/aws/step-functions/task.ts +538 -0
  164. package/platform/src/components/aws/step-functions/wait.ts +105 -0
  165. package/platform/src/components/aws/step-functions.ts +804 -0
  166. package/platform/src/components/aws/svelte-kit.ts +563 -0
  167. package/platform/src/components/aws/takeover/alb.ts +9 -0
  168. package/platform/src/components/aws/takeover/apigatewayv2.ts +43 -0
  169. package/platform/src/components/aws/takeover/app-sync.ts +45 -0
  170. package/platform/src/components/aws/takeover/aurora.ts +19 -0
  171. package/platform/src/components/aws/takeover/bucket.ts +94 -0
  172. package/platform/src/components/aws/takeover/bus.ts +43 -0
  173. package/platform/src/components/aws/takeover/cognito-user-pool.ts +21 -0
  174. package/platform/src/components/aws/takeover/cron-v2.ts +9 -0
  175. package/platform/src/components/aws/takeover/dsql.ts +12 -0
  176. package/platform/src/components/aws/takeover/dynamo.ts +31 -0
  177. package/platform/src/components/aws/takeover/efs.ts +9 -0
  178. package/platform/src/components/aws/takeover/function.ts +21 -0
  179. package/platform/src/components/aws/takeover/helpers.ts +26 -0
  180. package/platform/src/components/aws/takeover/index.ts +27 -0
  181. package/platform/src/components/aws/takeover/mysql.ts +17 -0
  182. package/platform/src/components/aws/takeover/postgres.ts +17 -0
  183. package/platform/src/components/aws/takeover/queue.ts +21 -0
  184. package/platform/src/components/aws/takeover/redis.ts +10 -0
  185. package/platform/src/components/aws/takeover/service.ts +22 -0
  186. package/platform/src/components/aws/takeover/sns-topic.ts +27 -0
  187. package/platform/src/components/aws/takeover/task.ts +13 -0
  188. package/platform/src/components/aws/tan-stack-start.ts +479 -0
  189. package/platform/src/components/aws/task.ts +571 -0
  190. package/platform/src/components/aws/v5/alb.ts +310 -0
  191. package/platform/src/components/aws/v5/apigatewayv2.ts +845 -0
  192. package/platform/src/components/aws/v5/app-sync.ts +673 -0
  193. package/platform/src/components/aws/v5/aurora.ts +855 -0
  194. package/platform/src/components/aws/v5/bucket.ts +1001 -0
  195. package/platform/src/components/aws/v5/bus.ts +321 -0
  196. package/platform/src/components/aws/v5/cluster.ts +230 -0
  197. package/platform/src/components/aws/v5/cognito-user-pool-client.ts +100 -0
  198. package/platform/src/components/aws/v5/cognito-user-pool.ts +693 -0
  199. package/platform/src/components/aws/v5/cron-v2.ts +316 -0
  200. package/platform/src/components/aws/v5/dsql.ts +665 -0
  201. package/platform/src/components/aws/v5/dynamo.ts +477 -0
  202. package/platform/src/components/aws/v5/efs.ts +311 -0
  203. package/platform/src/components/aws/v5/function.ts +1527 -0
  204. package/platform/src/components/aws/v5/index.ts +26 -0
  205. package/platform/src/components/aws/v5/mysql.ts +604 -0
  206. package/platform/src/components/aws/v5/postgres.ts +612 -0
  207. package/platform/src/components/aws/v5/queue.ts +271 -0
  208. package/platform/src/components/aws/v5/redis.ts +550 -0
  209. package/platform/src/components/aws/v5/service.ts +2209 -0
  210. package/platform/src/components/aws/v5/sns-topic.ts +284 -0
  211. package/platform/src/components/aws/v5/task.ts +549 -0
  212. package/platform/src/components/aws/vector.ts +316 -0
  213. package/platform/src/components/aws/vpc-v1.ts +580 -0
  214. package/platform/src/components/aws/vpc.ts +1641 -0
  215. package/platform/src/components/aws/workflow.ts +421 -0
  216. package/platform/src/components/base/base-site.ts +101 -0
  217. package/platform/src/components/base/base-ssr-site.ts +120 -0
  218. package/platform/src/components/base/base-static-site.ts +314 -0
  219. package/platform/src/components/cloudflare/account-id.ts +1 -0
  220. package/platform/src/components/cloudflare/ai.ts +77 -0
  221. package/platform/src/components/cloudflare/astro.ts +355 -0
  222. package/platform/src/components/cloudflare/auth.ts +69 -0
  223. package/platform/src/components/cloudflare/binding.ts +132 -0
  224. package/platform/src/components/cloudflare/bucket.ts +142 -0
  225. package/platform/src/components/cloudflare/cron.ts +207 -0
  226. package/platform/src/components/cloudflare/d1.ts +230 -0
  227. package/platform/src/components/cloudflare/dns.ts +253 -0
  228. package/platform/src/components/cloudflare/durable-object.ts +144 -0
  229. package/platform/src/components/cloudflare/experimental/index.ts +3 -0
  230. package/platform/src/components/cloudflare/experimental/solid-start.ts +288 -0
  231. package/platform/src/components/cloudflare/experimental/static-site.ts +4 -0
  232. package/platform/src/components/cloudflare/helpers/compatibility.ts +44 -0
  233. package/platform/src/components/cloudflare/helpers/fetch.ts +81 -0
  234. package/platform/src/components/cloudflare/helpers/validation.ts +74 -0
  235. package/platform/src/components/cloudflare/helpers/worker-builder.ts +57 -0
  236. package/platform/src/components/cloudflare/helpers/wrangler.ts +222 -0
  237. package/platform/src/components/cloudflare/hyperdrive.ts +402 -0
  238. package/platform/src/components/cloudflare/index.ts +25 -0
  239. package/platform/src/components/cloudflare/kv.ts +218 -0
  240. package/platform/src/components/cloudflare/providers/dns-record.ts +43 -0
  241. package/platform/src/components/cloudflare/providers/kv-data.ts +107 -0
  242. package/platform/src/components/cloudflare/providers/worker-assets.ts +41 -0
  243. package/platform/src/components/cloudflare/providers/worker-placement.ts +93 -0
  244. package/platform/src/components/cloudflare/providers/worker-script.ts +47 -0
  245. package/platform/src/components/cloudflare/providers/worker-url.ts +109 -0
  246. package/platform/src/components/cloudflare/providers/zone-lookup.ts +85 -0
  247. package/platform/src/components/cloudflare/queue-worker-subscriber.ts +192 -0
  248. package/platform/src/components/cloudflare/queue.ts +310 -0
  249. package/platform/src/components/cloudflare/rate-limit.ts +178 -0
  250. package/platform/src/components/cloudflare/react-router.ts +322 -0
  251. package/platform/src/components/cloudflare/ssr-site.ts +293 -0
  252. package/platform/src/components/cloudflare/static-site-v2.ts +428 -0
  253. package/platform/src/components/cloudflare/static-site.ts +470 -0
  254. package/platform/src/components/cloudflare/tan-stack-start.ts +408 -0
  255. package/platform/src/components/cloudflare/worker.ts +1080 -0
  256. package/platform/src/components/cloudflare/workflow.ts +319 -0
  257. package/platform/src/components/component.ts +242 -0
  258. package/platform/src/components/core.ts +43 -0
  259. package/platform/src/components/cpu.ts +10 -0
  260. package/platform/src/components/dns.ts +82 -0
  261. package/platform/src/components/duration.ts +67 -0
  262. package/platform/src/components/error.ts +5 -0
  263. package/platform/src/components/esbuild.ts +15 -0
  264. package/platform/src/components/experimental/dev-command.ts +127 -0
  265. package/platform/src/components/experimental/index.ts +1 -0
  266. package/platform/src/components/groups.ts +9 -0
  267. package/platform/src/components/index.ts +9 -0
  268. package/platform/src/components/input.ts +2 -0
  269. package/platform/src/components/link.ts +201 -0
  270. package/platform/src/components/linkable.ts +360 -0
  271. package/platform/src/components/naming-rules.ts +299 -0
  272. package/platform/src/components/naming.ts +189 -0
  273. package/platform/src/components/parts-component.ts +662 -0
  274. package/platform/src/components/parts.ts +299 -0
  275. package/platform/src/components/path.ts +5 -0
  276. package/platform/src/components/rpc/rpc.ts +110 -0
  277. package/platform/src/components/secret.ts +159 -0
  278. package/platform/src/components/size.ts +28 -0
  279. package/platform/src/components/takeover.ts +131 -0
  280. package/platform/src/components/transform.ts +107 -0
  281. package/platform/src/components/vercel/account-id.ts +1 -0
  282. package/platform/src/components/vercel/dns.ts +171 -0
  283. package/platform/src/components/vercel/index.ts +2 -0
  284. package/platform/src/components/vercel/providers/dns-record.ts +34 -0
  285. package/platform/src/config.ts +1460 -0
  286. package/platform/src/global-aliases.d.ts +37 -0
  287. package/platform/src/global.d.ts +374 -0
  288. package/platform/src/internal.d.ts +18 -0
  289. package/platform/src/runtime/worker/unenv.d.ts +14 -0
  290. package/platform/src/runtime/worker/unenv.mjs +26 -0
  291. package/platform/src/shim/run.js +25 -0
  292. package/platform/src/testing/global.ts +83 -0
  293. package/platform/src/testing/index.ts +103 -0
  294. package/platform/src/testing/mock.ts +646 -0
  295. package/platform/src/testing/vitest.ts +36 -0
  296. package/platform/src/util/compare-semver.ts +23 -0
  297. package/platform/src/util/fs.ts +49 -0
  298. package/platform/src/util/lazy.ts +12 -0
  299. package/platform/src/util/minify.ts +10 -0
  300. package/platform/src/util/package.ts +29 -0
  301. package/platform/src/util/semaphore.ts +29 -0
  302. package/platform/src/util/warn.ts +7 -0
  303. package/platform/types/auto/run.d.ts +9 -0
  304. package/platform/types/auto/run.d.ts.map +1 -0
  305. package/platform/types/components/args.d.ts +77 -0
  306. package/platform/types/components/args.d.ts.map +1 -0
  307. package/platform/types/components/aws/alb.d.ts +283 -0
  308. package/platform/types/components/aws/alb.d.ts.map +1 -0
  309. package/platform/types/components/aws/analog.d.ts +408 -0
  310. package/platform/types/components/aws/analog.d.ts.map +1 -0
  311. package/platform/types/components/aws/apigateway-websocket-route.d.ts +74 -0
  312. package/platform/types/components/aws/apigateway-websocket-route.d.ts.map +1 -0
  313. package/platform/types/components/aws/apigateway-websocket.d.ts +560 -0
  314. package/platform/types/components/aws/apigateway-websocket.d.ts.map +1 -0
  315. package/platform/types/components/aws/apigatewayv1-api-key.d.ts +48 -0
  316. package/platform/types/components/aws/apigatewayv1-api-key.d.ts.map +1 -0
  317. package/platform/types/components/aws/apigatewayv1-authorizer.d.ts +55 -0
  318. package/platform/types/components/aws/apigatewayv1-authorizer.d.ts.map +1 -0
  319. package/platform/types/components/aws/apigatewayv1-base-route.d.ts +36 -0
  320. package/platform/types/components/aws/apigatewayv1-base-route.d.ts.map +1 -0
  321. package/platform/types/components/aws/apigatewayv1-integration-route.d.ts +39 -0
  322. package/platform/types/components/aws/apigatewayv1-integration-route.d.ts.map +1 -0
  323. package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts +53 -0
  324. package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts.map +1 -0
  325. package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts +53 -0
  326. package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts.map +1 -0
  327. package/platform/types/components/aws/apigatewayv1.d.ts +1028 -0
  328. package/platform/types/components/aws/apigatewayv1.d.ts.map +1 -0
  329. package/platform/types/components/aws/apigatewayv2-authorizer.d.ts +54 -0
  330. package/platform/types/components/aws/apigatewayv2-authorizer.d.ts.map +1 -0
  331. package/platform/types/components/aws/apigatewayv2-base-route.d.ts +28 -0
  332. package/platform/types/components/aws/apigatewayv2-base-route.d.ts.map +1 -0
  333. package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts +59 -0
  334. package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts.map +1 -0
  335. package/platform/types/components/aws/apigatewayv2-private-route.d.ts +54 -0
  336. package/platform/types/components/aws/apigatewayv2-private-route.d.ts.map +1 -0
  337. package/platform/types/components/aws/apigatewayv2-url-route.d.ts +44 -0
  338. package/platform/types/components/aws/apigatewayv2-url-route.d.ts.map +1 -0
  339. package/platform/types/components/aws/apigatewayv2.d.ts +955 -0
  340. package/platform/types/components/aws/apigatewayv2.d.ts.map +1 -0
  341. package/platform/types/components/aws/app-sync-data-source.d.ts +52 -0
  342. package/platform/types/components/aws/app-sync-data-source.d.ts.map +1 -0
  343. package/platform/types/components/aws/app-sync-function.d.ts +33 -0
  344. package/platform/types/components/aws/app-sync-function.d.ts.map +1 -0
  345. package/platform/types/components/aws/app-sync-resolver.d.ts +41 -0
  346. package/platform/types/components/aws/app-sync-resolver.d.ts.map +1 -0
  347. package/platform/types/components/aws/app-sync.d.ts +638 -0
  348. package/platform/types/components/aws/app-sync.d.ts.map +1 -0
  349. package/platform/types/components/aws/astro.d.ts +409 -0
  350. package/platform/types/components/aws/astro.d.ts.map +1 -0
  351. package/platform/types/components/aws/aurora.d.ts +720 -0
  352. package/platform/types/components/aws/aurora.d.ts.map +1 -0
  353. package/platform/types/components/aws/auth-v1.d.ts +26 -0
  354. package/platform/types/components/aws/auth-v1.d.ts.map +1 -0
  355. package/platform/types/components/aws/auth.d.ts +295 -0
  356. package/platform/types/components/aws/auth.d.ts.map +1 -0
  357. package/platform/types/components/aws/bucket-lambda-subscriber.d.ts +61 -0
  358. package/platform/types/components/aws/bucket-lambda-subscriber.d.ts.map +1 -0
  359. package/platform/types/components/aws/bucket-notification.d.ts +47 -0
  360. package/platform/types/components/aws/bucket-notification.d.ts.map +1 -0
  361. package/platform/types/components/aws/bucket-queue-subscriber.d.ts +55 -0
  362. package/platform/types/components/aws/bucket-queue-subscriber.d.ts.map +1 -0
  363. package/platform/types/components/aws/bucket-topic-subscriber.d.ts +55 -0
  364. package/platform/types/components/aws/bucket-topic-subscriber.d.ts.map +1 -0
  365. package/platform/types/components/aws/bucket.d.ts +1356 -0
  366. package/platform/types/components/aws/bucket.d.ts.map +1 -0
  367. package/platform/types/components/aws/bus-base-subscriber.d.ts +20 -0
  368. package/platform/types/components/aws/bus-base-subscriber.d.ts.map +1 -0
  369. package/platform/types/components/aws/bus-lambda-subscriber.d.ts +50 -0
  370. package/platform/types/components/aws/bus-lambda-subscriber.d.ts.map +1 -0
  371. package/platform/types/components/aws/bus-queue-subscriber.d.ts +44 -0
  372. package/platform/types/components/aws/bus-queue-subscriber.d.ts.map +1 -0
  373. package/platform/types/components/aws/bus.d.ts +447 -0
  374. package/platform/types/components/aws/bus.d.ts.map +1 -0
  375. package/platform/types/components/aws/cdn.d.ts +310 -0
  376. package/platform/types/components/aws/cdn.d.ts.map +1 -0
  377. package/platform/types/components/aws/cluster-v1.d.ts +885 -0
  378. package/platform/types/components/aws/cluster-v1.d.ts.map +1 -0
  379. package/platform/types/components/aws/cluster.d.ts +364 -0
  380. package/platform/types/components/aws/cluster.d.ts.map +1 -0
  381. package/platform/types/components/aws/cognito-identity-pool.d.ts +199 -0
  382. package/platform/types/components/aws/cognito-identity-pool.d.ts.map +1 -0
  383. package/platform/types/components/aws/cognito-identity-provider.d.ts +38 -0
  384. package/platform/types/components/aws/cognito-identity-provider.d.ts.map +1 -0
  385. package/platform/types/components/aws/cognito-user-pool-client.d.ts +50 -0
  386. package/platform/types/components/aws/cognito-user-pool-client.d.ts.map +1 -0
  387. package/platform/types/components/aws/cognito-user-pool.d.ts +703 -0
  388. package/platform/types/components/aws/cognito-user-pool.d.ts.map +1 -0
  389. package/platform/types/components/aws/cron-v2.d.ts +325 -0
  390. package/platform/types/components/aws/cron-v2.d.ts.map +1 -0
  391. package/platform/types/components/aws/cron.d.ts +259 -0
  392. package/platform/types/components/aws/cron.d.ts.map +1 -0
  393. package/platform/types/components/aws/dns-validated-certificate.d.ts +27 -0
  394. package/platform/types/components/aws/dns-validated-certificate.d.ts.map +1 -0
  395. package/platform/types/components/aws/dns.d.ts +94 -0
  396. package/platform/types/components/aws/dns.d.ts.map +1 -0
  397. package/platform/types/components/aws/dsql.d.ts +369 -0
  398. package/platform/types/components/aws/dsql.d.ts.map +1 -0
  399. package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts +55 -0
  400. package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts.map +1 -0
  401. package/platform/types/components/aws/dynamo.d.ts +628 -0
  402. package/platform/types/components/aws/dynamo.d.ts.map +1 -0
  403. package/platform/types/components/aws/efs.d.ts +217 -0
  404. package/platform/types/components/aws/efs.d.ts.map +1 -0
  405. package/platform/types/components/aws/email.d.ts +370 -0
  406. package/platform/types/components/aws/email.d.ts.map +1 -0
  407. package/platform/types/components/aws/fargate.d.ts +894 -0
  408. package/platform/types/components/aws/fargate.d.ts.map +1 -0
  409. package/platform/types/components/aws/function.d.ts +1755 -0
  410. package/platform/types/components/aws/function.d.ts.map +1 -0
  411. package/platform/types/components/aws/helpers/apigateway-account.d.ts +3 -0
  412. package/platform/types/components/aws/helpers/apigateway-account.d.ts.map +1 -0
  413. package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts +144 -0
  414. package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts.map +1 -0
  415. package/platform/types/components/aws/helpers/arn.d.ts +51 -0
  416. package/platform/types/components/aws/helpers/arn.d.ts.map +1 -0
  417. package/platform/types/components/aws/helpers/bootstrap.d.ts +13 -0
  418. package/platform/types/components/aws/helpers/bootstrap.d.ts.map +1 -0
  419. package/platform/types/components/aws/helpers/client.d.ts +7 -0
  420. package/platform/types/components/aws/helpers/client.d.ts.map +1 -0
  421. package/platform/types/components/aws/helpers/container-builder.d.ts +4 -0
  422. package/platform/types/components/aws/helpers/container-builder.d.ts.map +1 -0
  423. package/platform/types/components/aws/helpers/custom-domain.d.ts +111 -0
  424. package/platform/types/components/aws/helpers/custom-domain.d.ts.map +1 -0
  425. package/platform/types/components/aws/helpers/event-source.d.ts +26 -0
  426. package/platform/types/components/aws/helpers/event-source.d.ts.map +1 -0
  427. package/platform/types/components/aws/helpers/fargate.d.ts +225 -0
  428. package/platform/types/components/aws/helpers/fargate.d.ts.map +1 -0
  429. package/platform/types/components/aws/helpers/function-builder.d.ts +14 -0
  430. package/platform/types/components/aws/helpers/function-builder.d.ts.map +1 -0
  431. package/platform/types/components/aws/helpers/function-code.d.ts +80 -0
  432. package/platform/types/components/aws/helpers/function-code.d.ts.map +1 -0
  433. package/platform/types/components/aws/helpers/function-part.d.ts +61 -0
  434. package/platform/types/components/aws/helpers/function-part.d.ts.map +1 -0
  435. package/platform/types/components/aws/helpers/function-permission.d.ts +17 -0
  436. package/platform/types/components/aws/helpers/function-permission.d.ts.map +1 -0
  437. package/platform/types/components/aws/helpers/load-balancer-args.d.ts +40 -0
  438. package/platform/types/components/aws/helpers/load-balancer-args.d.ts.map +1 -0
  439. package/platform/types/components/aws/helpers/load-balancer.d.ts +9 -0
  440. package/platform/types/components/aws/helpers/load-balancer.d.ts.map +1 -0
  441. package/platform/types/components/aws/helpers/provider.d.ts +3 -0
  442. package/platform/types/components/aws/helpers/provider.d.ts.map +1 -0
  443. package/platform/types/components/aws/helpers/queue-policy.d.ts +11 -0
  444. package/platform/types/components/aws/helpers/queue-policy.d.ts.map +1 -0
  445. package/platform/types/components/aws/helpers/rds.d.ts +98 -0
  446. package/platform/types/components/aws/helpers/rds.d.ts.map +1 -0
  447. package/platform/types/components/aws/helpers/site-builder.d.ts +4 -0
  448. package/platform/types/components/aws/helpers/site-builder.d.ts.map +1 -0
  449. package/platform/types/components/aws/helpers/subscriber.d.ts +6 -0
  450. package/platform/types/components/aws/helpers/subscriber.d.ts.map +1 -0
  451. package/platform/types/components/aws/helpers/vpc.d.ts +14 -0
  452. package/platform/types/components/aws/helpers/vpc.d.ts.map +1 -0
  453. package/platform/types/components/aws/https-redirect.d.ts +38 -0
  454. package/platform/types/components/aws/https-redirect.d.ts.map +1 -0
  455. package/platform/types/components/aws/iam-edit.d.ts +39 -0
  456. package/platform/types/components/aws/iam-edit.d.ts.map +1 -0
  457. package/platform/types/components/aws/index.d.ts +56 -0
  458. package/platform/types/components/aws/index.d.ts.map +1 -0
  459. package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts +49 -0
  460. package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts.map +1 -0
  461. package/platform/types/components/aws/kinesis-stream.d.ts +254 -0
  462. package/platform/types/components/aws/kinesis-stream.d.ts.map +1 -0
  463. package/platform/types/components/aws/linkable.d.ts +17 -0
  464. package/platform/types/components/aws/linkable.d.ts.map +1 -0
  465. package/platform/types/components/aws/logging.d.ts +26 -0
  466. package/platform/types/components/aws/logging.d.ts.map +1 -0
  467. package/platform/types/components/aws/microvm.d.ts +439 -0
  468. package/platform/types/components/aws/microvm.d.ts.map +1 -0
  469. package/platform/types/components/aws/mysql.d.ts +525 -0
  470. package/platform/types/components/aws/mysql.d.ts.map +1 -0
  471. package/platform/types/components/aws/nextjs.d.ts +534 -0
  472. package/platform/types/components/aws/nextjs.d.ts.map +1 -0
  473. package/platform/types/components/aws/nuxt.d.ts +480 -0
  474. package/platform/types/components/aws/nuxt.d.ts.map +1 -0
  475. package/platform/types/components/aws/open-search.d.ts +306 -0
  476. package/platform/types/components/aws/open-search.d.ts.map +1 -0
  477. package/platform/types/components/aws/opencontrol.d.ts +169 -0
  478. package/platform/types/components/aws/opencontrol.d.ts.map +1 -0
  479. package/platform/types/components/aws/permission.d.ts +80 -0
  480. package/platform/types/components/aws/permission.d.ts.map +1 -0
  481. package/platform/types/components/aws/postgres-v1.d.ts +328 -0
  482. package/platform/types/components/aws/postgres-v1.d.ts.map +1 -0
  483. package/platform/types/components/aws/postgres.d.ts +529 -0
  484. package/platform/types/components/aws/postgres.d.ts.map +1 -0
  485. package/platform/types/components/aws/providers/bucket-files.d.ts +18 -0
  486. package/platform/types/components/aws/providers/bucket-files.d.ts.map +1 -0
  487. package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts +13 -0
  488. package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts.map +1 -0
  489. package/platform/types/components/aws/providers/distribution-invalidation.d.ts +11 -0
  490. package/platform/types/components/aws/providers/distribution-invalidation.d.ts.map +1 -0
  491. package/platform/types/components/aws/providers/function-environment-update.d.ts +33 -0
  492. package/platform/types/components/aws/providers/function-environment-update.d.ts.map +1 -0
  493. package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts +11 -0
  494. package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts.map +1 -0
  495. package/platform/types/components/aws/providers/kv-keys.d.ts +11 -0
  496. package/platform/types/components/aws/providers/kv-keys.d.ts.map +1 -0
  497. package/platform/types/components/aws/providers/kv-routes-update.d.ts +11 -0
  498. package/platform/types/components/aws/providers/kv-routes-update.d.ts.map +1 -0
  499. package/platform/types/components/aws/providers/microvm-image-prune.d.ts +35 -0
  500. package/platform/types/components/aws/providers/microvm-image-prune.d.ts.map +1 -0
  501. package/platform/types/components/aws/providers/origin-access-control.d.ts +8 -0
  502. package/platform/types/components/aws/providers/origin-access-control.d.ts.map +1 -0
  503. package/platform/types/components/aws/providers/rds-role-lookup.d.ts +8 -0
  504. package/platform/types/components/aws/providers/rds-role-lookup.d.ts.map +1 -0
  505. package/platform/types/components/aws/providers/vector-table.d.ts +12 -0
  506. package/platform/types/components/aws/providers/vector-table.d.ts.map +1 -0
  507. package/platform/types/components/aws/queue-lambda-subscriber.d.ts +53 -0
  508. package/platform/types/components/aws/queue-lambda-subscriber.d.ts.map +1 -0
  509. package/platform/types/components/aws/queue.d.ts +494 -0
  510. package/platform/types/components/aws/queue.d.ts.map +1 -0
  511. package/platform/types/components/aws/react.d.ts +407 -0
  512. package/platform/types/components/aws/react.d.ts.map +1 -0
  513. package/platform/types/components/aws/realtime-lambda-subscriber.d.ts +53 -0
  514. package/platform/types/components/aws/realtime-lambda-subscriber.d.ts.map +1 -0
  515. package/platform/types/components/aws/realtime.d.ts +237 -0
  516. package/platform/types/components/aws/realtime.d.ts.map +1 -0
  517. package/platform/types/components/aws/redis-v1.d.ts +348 -0
  518. package/platform/types/components/aws/redis-v1.d.ts.map +1 -0
  519. package/platform/types/components/aws/redis.d.ts +545 -0
  520. package/platform/types/components/aws/redis.d.ts.map +1 -0
  521. package/platform/types/components/aws/remix.d.ts +408 -0
  522. package/platform/types/components/aws/remix.d.ts.map +1 -0
  523. package/platform/types/components/aws/router-base-route.d.ts +28 -0
  524. package/platform/types/components/aws/router-base-route.d.ts.map +1 -0
  525. package/platform/types/components/aws/router-bucket-route.d.ts +29 -0
  526. package/platform/types/components/aws/router-bucket-route.d.ts.map +1 -0
  527. package/platform/types/components/aws/router-url-route.d.ts +28 -0
  528. package/platform/types/components/aws/router-url-route.d.ts.map +1 -0
  529. package/platform/types/components/aws/router.d.ts +1754 -0
  530. package/platform/types/components/aws/router.d.ts.map +1 -0
  531. package/platform/types/components/aws/service-v1.d.ts +78 -0
  532. package/platform/types/components/aws/service-v1.d.ts.map +1 -0
  533. package/platform/types/components/aws/service.d.ts +1756 -0
  534. package/platform/types/components/aws/service.d.ts.map +1 -0
  535. package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts +53 -0
  536. package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts.map +1 -0
  537. package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts +55 -0
  538. package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts.map +1 -0
  539. package/platform/types/components/aws/sns-topic.d.ts +394 -0
  540. package/platform/types/components/aws/sns-topic.d.ts.map +1 -0
  541. package/platform/types/components/aws/solid-start.d.ts +399 -0
  542. package/platform/types/components/aws/solid-start.d.ts.map +1 -0
  543. package/platform/types/components/aws/ssr-site.d.ts +895 -0
  544. package/platform/types/components/aws/ssr-site.d.ts.map +1 -0
  545. package/platform/types/components/aws/static-site.d.ts +744 -0
  546. package/platform/types/components/aws/static-site.d.ts.map +1 -0
  547. package/platform/types/components/aws/step-functions/choice.d.ts +73 -0
  548. package/platform/types/components/aws/step-functions/choice.d.ts.map +1 -0
  549. package/platform/types/components/aws/step-functions/fail.d.ts +63 -0
  550. package/platform/types/components/aws/step-functions/fail.d.ts.map +1 -0
  551. package/platform/types/components/aws/step-functions/map.d.ts +236 -0
  552. package/platform/types/components/aws/step-functions/map.d.ts.map +1 -0
  553. package/platform/types/components/aws/step-functions/parallel.d.ts +127 -0
  554. package/platform/types/components/aws/step-functions/parallel.d.ts.map +1 -0
  555. package/platform/types/components/aws/step-functions/pass.d.ts +39 -0
  556. package/platform/types/components/aws/step-functions/pass.d.ts.map +1 -0
  557. package/platform/types/components/aws/step-functions/state.d.ts +231 -0
  558. package/platform/types/components/aws/step-functions/state.d.ts.map +1 -0
  559. package/platform/types/components/aws/step-functions/succeed.d.ts +26 -0
  560. package/platform/types/components/aws/step-functions/succeed.d.ts.map +1 -0
  561. package/platform/types/components/aws/step-functions/task.d.ts +485 -0
  562. package/platform/types/components/aws/step-functions/task.d.ts.map +1 -0
  563. package/platform/types/components/aws/step-functions/wait.d.ts +91 -0
  564. package/platform/types/components/aws/step-functions/wait.d.ts.map +1 -0
  565. package/platform/types/components/aws/step-functions.d.ts +478 -0
  566. package/platform/types/components/aws/step-functions.d.ts.map +1 -0
  567. package/platform/types/components/aws/svelte-kit.d.ts +456 -0
  568. package/platform/types/components/aws/svelte-kit.d.ts.map +1 -0
  569. package/platform/types/components/aws/takeover/alb.d.ts +2 -0
  570. package/platform/types/components/aws/takeover/alb.d.ts.map +1 -0
  571. package/platform/types/components/aws/takeover/apigatewayv2.d.ts +2 -0
  572. package/platform/types/components/aws/takeover/apigatewayv2.d.ts.map +1 -0
  573. package/platform/types/components/aws/takeover/app-sync.d.ts +2 -0
  574. package/platform/types/components/aws/takeover/app-sync.d.ts.map +1 -0
  575. package/platform/types/components/aws/takeover/aurora.d.ts +2 -0
  576. package/platform/types/components/aws/takeover/aurora.d.ts.map +1 -0
  577. package/platform/types/components/aws/takeover/bucket.d.ts +2 -0
  578. package/platform/types/components/aws/takeover/bucket.d.ts.map +1 -0
  579. package/platform/types/components/aws/takeover/bus.d.ts +2 -0
  580. package/platform/types/components/aws/takeover/bus.d.ts.map +1 -0
  581. package/platform/types/components/aws/takeover/cognito-user-pool.d.ts +2 -0
  582. package/platform/types/components/aws/takeover/cognito-user-pool.d.ts.map +1 -0
  583. package/platform/types/components/aws/takeover/cron-v2.d.ts +2 -0
  584. package/platform/types/components/aws/takeover/cron-v2.d.ts.map +1 -0
  585. package/platform/types/components/aws/takeover/dsql.d.ts +2 -0
  586. package/platform/types/components/aws/takeover/dsql.d.ts.map +1 -0
  587. package/platform/types/components/aws/takeover/dynamo.d.ts +2 -0
  588. package/platform/types/components/aws/takeover/dynamo.d.ts.map +1 -0
  589. package/platform/types/components/aws/takeover/efs.d.ts +2 -0
  590. package/platform/types/components/aws/takeover/efs.d.ts.map +1 -0
  591. package/platform/types/components/aws/takeover/function.d.ts +2 -0
  592. package/platform/types/components/aws/takeover/function.d.ts.map +1 -0
  593. package/platform/types/components/aws/takeover/helpers.d.ts +16 -0
  594. package/platform/types/components/aws/takeover/helpers.d.ts.map +1 -0
  595. package/platform/types/components/aws/takeover/index.d.ts +28 -0
  596. package/platform/types/components/aws/takeover/index.d.ts.map +1 -0
  597. package/platform/types/components/aws/takeover/mysql.d.ts +2 -0
  598. package/platform/types/components/aws/takeover/mysql.d.ts.map +1 -0
  599. package/platform/types/components/aws/takeover/postgres.d.ts +2 -0
  600. package/platform/types/components/aws/takeover/postgres.d.ts.map +1 -0
  601. package/platform/types/components/aws/takeover/queue.d.ts +2 -0
  602. package/platform/types/components/aws/takeover/queue.d.ts.map +1 -0
  603. package/platform/types/components/aws/takeover/redis.d.ts +2 -0
  604. package/platform/types/components/aws/takeover/redis.d.ts.map +1 -0
  605. package/platform/types/components/aws/takeover/service.d.ts +2 -0
  606. package/platform/types/components/aws/takeover/service.d.ts.map +1 -0
  607. package/platform/types/components/aws/takeover/sns-topic.d.ts +2 -0
  608. package/platform/types/components/aws/takeover/sns-topic.d.ts.map +1 -0
  609. package/platform/types/components/aws/takeover/task.d.ts +2 -0
  610. package/platform/types/components/aws/takeover/task.d.ts.map +1 -0
  611. package/platform/types/components/aws/tan-stack-start.d.ts +359 -0
  612. package/platform/types/components/aws/tan-stack-start.d.ts.map +1 -0
  613. package/platform/types/components/aws/task.d.ts +342 -0
  614. package/platform/types/components/aws/task.d.ts.map +1 -0
  615. package/platform/types/components/aws/v5/alb.d.ts +177 -0
  616. package/platform/types/components/aws/v5/alb.d.ts.map +1 -0
  617. package/platform/types/components/aws/v5/apigatewayv2.d.ts +482 -0
  618. package/platform/types/components/aws/v5/apigatewayv2.d.ts.map +1 -0
  619. package/platform/types/components/aws/v5/app-sync.d.ts +424 -0
  620. package/platform/types/components/aws/v5/app-sync.d.ts.map +1 -0
  621. package/platform/types/components/aws/v5/aurora.d.ts +459 -0
  622. package/platform/types/components/aws/v5/aurora.d.ts.map +1 -0
  623. package/platform/types/components/aws/v5/bucket.d.ts +578 -0
  624. package/platform/types/components/aws/v5/bucket.d.ts.map +1 -0
  625. package/platform/types/components/aws/v5/bus.d.ts +255 -0
  626. package/platform/types/components/aws/v5/bus.d.ts.map +1 -0
  627. package/platform/types/components/aws/v5/cluster.d.ts +167 -0
  628. package/platform/types/components/aws/v5/cluster.d.ts.map +1 -0
  629. package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts +69 -0
  630. package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts.map +1 -0
  631. package/platform/types/components/aws/v5/cognito-user-pool.d.ts +396 -0
  632. package/platform/types/components/aws/v5/cognito-user-pool.d.ts.map +1 -0
  633. package/platform/types/components/aws/v5/cron-v2.d.ts +206 -0
  634. package/platform/types/components/aws/v5/cron-v2.d.ts.map +1 -0
  635. package/platform/types/components/aws/v5/dsql.d.ts +453 -0
  636. package/platform/types/components/aws/v5/dsql.d.ts.map +1 -0
  637. package/platform/types/components/aws/v5/dynamo.d.ts +328 -0
  638. package/platform/types/components/aws/v5/dynamo.d.ts.map +1 -0
  639. package/platform/types/components/aws/v5/efs.d.ts +178 -0
  640. package/platform/types/components/aws/v5/efs.d.ts.map +1 -0
  641. package/platform/types/components/aws/v5/function.d.ts +582 -0
  642. package/platform/types/components/aws/v5/function.d.ts.map +1 -0
  643. package/platform/types/components/aws/v5/index.d.ts +27 -0
  644. package/platform/types/components/aws/v5/index.d.ts.map +1 -0
  645. package/platform/types/components/aws/v5/mysql.d.ts +347 -0
  646. package/platform/types/components/aws/v5/mysql.d.ts.map +1 -0
  647. package/platform/types/components/aws/v5/postgres.d.ts +348 -0
  648. package/platform/types/components/aws/v5/postgres.d.ts.map +1 -0
  649. package/platform/types/components/aws/v5/queue.d.ts +190 -0
  650. package/platform/types/components/aws/v5/queue.d.ts.map +1 -0
  651. package/platform/types/components/aws/v5/redis.d.ts +214 -0
  652. package/platform/types/components/aws/v5/redis.d.ts.map +1 -0
  653. package/platform/types/components/aws/v5/service.d.ts +1347 -0
  654. package/platform/types/components/aws/v5/service.d.ts.map +1 -0
  655. package/platform/types/components/aws/v5/sns-topic.d.ts +226 -0
  656. package/platform/types/components/aws/v5/sns-topic.d.ts.map +1 -0
  657. package/platform/types/components/aws/v5/task.d.ts +346 -0
  658. package/platform/types/components/aws/v5/task.d.ts.map +1 -0
  659. package/platform/types/components/aws/vector.d.ts +163 -0
  660. package/platform/types/components/aws/vector.d.ts.map +1 -0
  661. package/platform/types/components/aws/vpc-v1.d.ts +208 -0
  662. package/platform/types/components/aws/vpc-v1.d.ts.map +1 -0
  663. package/platform/types/components/aws/vpc.d.ts +491 -0
  664. package/platform/types/components/aws/vpc.d.ts.map +1 -0
  665. package/platform/types/components/aws/workflow.d.ts +331 -0
  666. package/platform/types/components/aws/workflow.d.ts.map +1 -0
  667. package/platform/types/components/base/base-site.d.ts +53 -0
  668. package/platform/types/components/base/base-site.d.ts.map +1 -0
  669. package/platform/types/components/base/base-ssr-site.d.ts +13 -0
  670. package/platform/types/components/base/base-ssr-site.d.ts.map +1 -0
  671. package/platform/types/components/base/base-static-site.d.ts +199 -0
  672. package/platform/types/components/base/base-static-site.d.ts.map +1 -0
  673. package/platform/types/components/cloudflare/account-id.d.ts +2 -0
  674. package/platform/types/components/cloudflare/account-id.d.ts.map +1 -0
  675. package/platform/types/components/cloudflare/ai.d.ts +68 -0
  676. package/platform/types/components/cloudflare/ai.d.ts.map +1 -0
  677. package/platform/types/components/cloudflare/astro.d.ts +249 -0
  678. package/platform/types/components/cloudflare/astro.d.ts.map +1 -0
  679. package/platform/types/components/cloudflare/auth.d.ts +22 -0
  680. package/platform/types/components/cloudflare/auth.d.ts.map +1 -0
  681. package/platform/types/components/cloudflare/binding.d.ts +109 -0
  682. package/platform/types/components/cloudflare/binding.d.ts.map +1 -0
  683. package/platform/types/components/cloudflare/bucket.d.ts +98 -0
  684. package/platform/types/components/cloudflare/bucket.d.ts.map +1 -0
  685. package/platform/types/components/cloudflare/cron.d.ts +151 -0
  686. package/platform/types/components/cloudflare/cron.d.ts.map +1 -0
  687. package/platform/types/components/cloudflare/d1.d.ts +142 -0
  688. package/platform/types/components/cloudflare/d1.d.ts.map +1 -0
  689. package/platform/types/components/cloudflare/dns.d.ts +100 -0
  690. package/platform/types/components/cloudflare/dns.d.ts.map +1 -0
  691. package/platform/types/components/cloudflare/durable-object.d.ts +125 -0
  692. package/platform/types/components/cloudflare/durable-object.d.ts.map +1 -0
  693. package/platform/types/components/cloudflare/experimental/index.d.ts +4 -0
  694. package/platform/types/components/cloudflare/experimental/index.d.ts.map +1 -0
  695. package/platform/types/components/cloudflare/experimental/solid-start.d.ts +219 -0
  696. package/platform/types/components/cloudflare/experimental/solid-start.d.ts.map +1 -0
  697. package/platform/types/components/cloudflare/experimental/static-site.d.ts +3 -0
  698. package/platform/types/components/cloudflare/experimental/static-site.d.ts.map +1 -0
  699. package/platform/types/components/cloudflare/helpers/compatibility.d.ts +21 -0
  700. package/platform/types/components/cloudflare/helpers/compatibility.d.ts.map +1 -0
  701. package/platform/types/components/cloudflare/helpers/fetch.d.ts +19 -0
  702. package/platform/types/components/cloudflare/helpers/fetch.d.ts.map +1 -0
  703. package/platform/types/components/cloudflare/helpers/validation.d.ts +15 -0
  704. package/platform/types/components/cloudflare/helpers/validation.d.ts.map +1 -0
  705. package/platform/types/components/cloudflare/helpers/worker-builder.d.ts +10 -0
  706. package/platform/types/components/cloudflare/helpers/worker-builder.d.ts.map +1 -0
  707. package/platform/types/components/cloudflare/helpers/wrangler.d.ts +31 -0
  708. package/platform/types/components/cloudflare/helpers/wrangler.d.ts.map +1 -0
  709. package/platform/types/components/cloudflare/hyperdrive.d.ts +302 -0
  710. package/platform/types/components/cloudflare/hyperdrive.d.ts.map +1 -0
  711. package/platform/types/components/cloudflare/index.d.ts +25 -0
  712. package/platform/types/components/cloudflare/index.d.ts.map +1 -0
  713. package/platform/types/components/cloudflare/kv.d.ts +140 -0
  714. package/platform/types/components/cloudflare/kv.d.ts.map +1 -0
  715. package/platform/types/components/cloudflare/providers/dns-record.d.ts +21 -0
  716. package/platform/types/components/cloudflare/providers/dns-record.d.ts.map +1 -0
  717. package/platform/types/components/cloudflare/providers/kv-data.d.ts +23 -0
  718. package/platform/types/components/cloudflare/providers/kv-data.d.ts.map +1 -0
  719. package/platform/types/components/cloudflare/providers/worker-assets.d.ts +19 -0
  720. package/platform/types/components/cloudflare/providers/worker-assets.d.ts.map +1 -0
  721. package/platform/types/components/cloudflare/providers/worker-placement.d.ts +27 -0
  722. package/platform/types/components/cloudflare/providers/worker-placement.d.ts.map +1 -0
  723. package/platform/types/components/cloudflare/providers/worker-script.d.ts +23 -0
  724. package/platform/types/components/cloudflare/providers/worker-script.d.ts.map +1 -0
  725. package/platform/types/components/cloudflare/providers/worker-url.d.ts +24 -0
  726. package/platform/types/components/cloudflare/providers/worker-url.d.ts.map +1 -0
  727. package/platform/types/components/cloudflare/providers/zone-lookup.d.ts +22 -0
  728. package/platform/types/components/cloudflare/providers/zone-lookup.d.ts.map +1 -0
  729. package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts +122 -0
  730. package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts.map +1 -0
  731. package/platform/types/components/cloudflare/queue.d.ts +235 -0
  732. package/platform/types/components/cloudflare/queue.d.ts.map +1 -0
  733. package/platform/types/components/cloudflare/rate-limit.d.ts +117 -0
  734. package/platform/types/components/cloudflare/rate-limit.d.ts.map +1 -0
  735. package/platform/types/components/cloudflare/react-router.d.ts +262 -0
  736. package/platform/types/components/cloudflare/react-router.d.ts.map +1 -0
  737. package/platform/types/components/cloudflare/ssr-site.d.ts +60 -0
  738. package/platform/types/components/cloudflare/ssr-site.d.ts.map +1 -0
  739. package/platform/types/components/cloudflare/static-site-v2.d.ts +302 -0
  740. package/platform/types/components/cloudflare/static-site-v2.d.ts.map +1 -0
  741. package/platform/types/components/cloudflare/static-site.d.ts +270 -0
  742. package/platform/types/components/cloudflare/static-site.d.ts.map +1 -0
  743. package/platform/types/components/cloudflare/tan-stack-start.d.ts +259 -0
  744. package/platform/types/components/cloudflare/tan-stack-start.d.ts.map +1 -0
  745. package/platform/types/components/cloudflare/worker.d.ts +483 -0
  746. package/platform/types/components/cloudflare/worker.d.ts.map +1 -0
  747. package/platform/types/components/cloudflare/workflow.d.ts +248 -0
  748. package/platform/types/components/cloudflare/workflow.d.ts.map +1 -0
  749. package/platform/types/components/component.d.ts +67 -0
  750. package/platform/types/components/component.d.ts.map +1 -0
  751. package/platform/types/components/core.d.ts +16 -0
  752. package/platform/types/components/core.d.ts.map +1 -0
  753. package/platform/types/components/cpu.d.ts +3 -0
  754. package/platform/types/components/cpu.d.ts.map +1 -0
  755. package/platform/types/components/dns.d.ts +63 -0
  756. package/platform/types/components/dns.d.ts.map +1 -0
  757. package/platform/types/components/duration.d.ts +9 -0
  758. package/platform/types/components/duration.d.ts.map +1 -0
  759. package/platform/types/components/error.d.ts +4 -0
  760. package/platform/types/components/error.d.ts.map +1 -0
  761. package/platform/types/components/esbuild.d.ts +3 -0
  762. package/platform/types/components/esbuild.d.ts.map +1 -0
  763. package/platform/types/components/experimental/dev-command.d.ts +99 -0
  764. package/platform/types/components/experimental/dev-command.d.ts.map +1 -0
  765. package/platform/types/components/experimental/index.d.ts +2 -0
  766. package/platform/types/components/experimental/index.d.ts.map +1 -0
  767. package/platform/types/components/groups.d.ts +6 -0
  768. package/platform/types/components/groups.d.ts.map +1 -0
  769. package/platform/types/components/index.d.ts +5 -0
  770. package/platform/types/components/index.d.ts.map +1 -0
  771. package/platform/types/components/input.d.ts +3 -0
  772. package/platform/types/components/input.d.ts.map +1 -0
  773. package/platform/types/components/link.d.ts +41 -0
  774. package/platform/types/components/link.d.ts.map +1 -0
  775. package/platform/types/components/linkable.d.ts +301 -0
  776. package/platform/types/components/linkable.d.ts.map +1 -0
  777. package/platform/types/components/naming-rules.d.ts +32 -0
  778. package/platform/types/components/naming-rules.d.ts.map +1 -0
  779. package/platform/types/components/naming.d.ts +21 -0
  780. package/platform/types/components/naming.d.ts.map +1 -0
  781. package/platform/types/components/parts-component.d.ts +241 -0
  782. package/platform/types/components/parts-component.d.ts.map +1 -0
  783. package/platform/types/components/parts.d.ts +194 -0
  784. package/platform/types/components/parts.d.ts.map +1 -0
  785. package/platform/types/components/path.d.ts +2 -0
  786. package/platform/types/components/path.d.ts.map +1 -0
  787. package/platform/types/components/rpc/rpc.d.ts +19 -0
  788. package/platform/types/components/rpc/rpc.d.ts.map +1 -0
  789. package/platform/types/components/secret.d.ts +123 -0
  790. package/platform/types/components/secret.d.ts.map +1 -0
  791. package/platform/types/components/size.d.ts +5 -0
  792. package/platform/types/components/size.d.ts.map +1 -0
  793. package/platform/types/components/takeover.d.ts +88 -0
  794. package/platform/types/components/takeover.d.ts.map +1 -0
  795. package/platform/types/components/transform.d.ts +34 -0
  796. package/platform/types/components/transform.d.ts.map +1 -0
  797. package/platform/types/components/vercel/account-id.d.ts +2 -0
  798. package/platform/types/components/vercel/account-id.d.ts.map +1 -0
  799. package/platform/types/components/vercel/dns.d.ts +73 -0
  800. package/platform/types/components/vercel/dns.d.ts.map +1 -0
  801. package/platform/types/components/vercel/index.d.ts +3 -0
  802. package/platform/types/components/vercel/index.d.ts.map +1 -0
  803. package/platform/types/components/vercel/providers/dns-record.d.ts +15 -0
  804. package/platform/types/components/vercel/providers/dns-record.d.ts.map +1 -0
  805. package/platform/types/config.d.ts +1437 -0
  806. package/platform/types/config.d.ts.map +1 -0
  807. package/platform/types/global-aliases.d.ts +37 -0
  808. package/platform/types/global.d.ts +374 -0
  809. package/platform/types/internal.d.ts +18 -0
  810. package/platform/types/runtime/worker/unenv.d.ts +14 -0
  811. package/platform/types/testing/global.d.ts +11 -0
  812. package/platform/types/testing/global.d.ts.map +1 -0
  813. package/platform/types/testing/index.d.ts +80 -0
  814. package/platform/types/testing/index.d.ts.map +1 -0
  815. package/platform/types/testing/mock.d.ts +136 -0
  816. package/platform/types/testing/mock.d.ts.map +1 -0
  817. package/platform/types/testing/vitest.d.ts +19 -0
  818. package/platform/types/testing/vitest.d.ts.map +1 -0
  819. package/platform/types/util/compare-semver.d.ts +4 -0
  820. package/platform/types/util/compare-semver.d.ts.map +1 -0
  821. package/platform/types/util/fs.d.ts +5 -0
  822. package/platform/types/util/fs.d.ts.map +1 -0
  823. package/platform/types/util/lazy.d.ts +2 -0
  824. package/platform/types/util/lazy.d.ts.map +1 -0
  825. package/platform/types/util/minify.d.ts +2 -0
  826. package/platform/types/util/minify.d.ts.map +1 -0
  827. package/platform/types/util/package.d.ts +10 -0
  828. package/platform/types/util/package.d.ts.map +1 -0
  829. package/platform/types/util/semaphore.d.ts +9 -0
  830. package/platform/types/util/semaphore.d.ts.map +1 -0
  831. package/platform/types/util/warn.d.ts +2 -0
  832. package/platform/types/util/warn.d.ts.map +1 -0
@@ -0,0 +1,2209 @@
1
+ import {
2
+ all,
3
+ ComponentResourceOptions,
4
+ interpolate,
5
+ type Output,
6
+ output,
7
+ type Unwrap,
8
+ } from "@pulumi/pulumi";
9
+ import {
10
+ appautoscaling,
11
+ cloudwatch,
12
+ ec2,
13
+ ecs,
14
+ getRegionOutput,
15
+ iam,
16
+ lb,
17
+ servicediscovery,
18
+ } from "@pulumi/aws";
19
+ import { Image } from "@pulumi/docker-build";
20
+ import {
21
+ V5Args,
22
+ component,
23
+ deferred,
24
+ many,
25
+ optional,
26
+ } from "../../parts-component";
27
+ import { ifSet, notAnOption, plain, plainDeep, withDefault } from "../../args";
28
+ import { type DurationMinutes, toSeconds } from "../../duration";
29
+ import { VisibleError } from "../../error";
30
+ import { DevCommand } from "../../experimental/dev-command";
31
+ import type { Input } from "../../input";
32
+ import { hashStringToPrettyString } from "../../naming";
33
+ import { transformPart } from "../../transform";
34
+ import { Alb as OriginalAlb } from "../alb";
35
+ import { DnsValidatedCertificate } from "../dns-validated-certificate";
36
+ import type { CustomDomainArgs } from "../helpers/custom-domain";
37
+ import {
38
+ type Container,
39
+ type ContainerArgs,
40
+ type FargateArgs,
41
+ containerImage,
42
+ containersOf,
43
+ cpuOf,
44
+ executionRoleArgs,
45
+ logGroupArgs,
46
+ memoryOf,
47
+ type Network,
48
+ networkOf,
49
+ storageOf,
50
+ taskDefinitionArgs,
51
+ taskRoleArgs,
52
+ } from "../helpers/fargate";
53
+ import { listenerKey, targetKey } from "../helpers/load-balancer";
54
+ import {
55
+ domainOf,
56
+ forbidden,
57
+ pointDomainAt,
58
+ securityGroupArgs,
59
+ } from "../helpers/load-balancer-args";
60
+ import { URL_UNAVAILABLE } from "../linkable";
61
+ import type { ServiceArgs as OriginalServiceArgs } from "../service";
62
+ import { Alb } from "./alb";
63
+
64
+ const parts = () => ({
65
+ /**
66
+ * The Amazon ECS Execution Role.
67
+ */
68
+ executionRole: iam.Role,
69
+ /**
70
+ * The Amazon ECS Task Role. In `sst dev` it's the role each container's
71
+ * command runs as on your machine.
72
+ */
73
+ taskRole: iam.Role,
74
+ /**
75
+ * The images built for the service's containers, by the container's name. There's
76
+ * one for each container that's built from a Dockerfile. It's added once the
77
+ * container's image settings are known.
78
+ */
79
+ image: many(Image),
80
+ /**
81
+ * The CloudWatch log groups of the service's containers, by the container's name.
82
+ */
83
+ logGroup: many(cloudwatch.LogGroup),
84
+ /**
85
+ * The Amazon ECS Task Definition.
86
+ */
87
+ taskDefinition: ecs.TaskDefinition,
88
+ /**
89
+ * The AWS Security Group of the load balancer. Only created when the service has a
90
+ * load balancer of its own.
91
+ */
92
+ loadBalancerSecurityGroup: optional(ec2.SecurityGroup),
93
+ /**
94
+ * The AWS Load Balancer. Only created when `loadBalancer` is set, and not when the
95
+ * service is attached to an `Alb`.
96
+ */
97
+ loadBalancer: optional(lb.LoadBalancer),
98
+ /**
99
+ * The certificate for the load balancer's custom domain, created when
100
+ * `loadBalancer.domain` is set without a `cert`.
101
+ */
102
+ certificate: optional(DnsValidatedCertificate),
103
+ /**
104
+ * The AWS Load Balancer target groups, one for each container port traffic is
105
+ * forwarded to. Its id is the container's name, the protocol and the port:
106
+ * `MyServiceHTTP8080`.
107
+ */
108
+ target: many(lb.TargetGroup),
109
+ /**
110
+ * The AWS Load Balancer listeners, one for each port the load balancer listens on.
111
+ * Its id is the protocol and the port: `HTTP80`.
112
+ */
113
+ listener: many(lb.Listener),
114
+ /**
115
+ * The AWS Load Balancer listener rules, one for each rule that has `conditions`.
116
+ *
117
+ * For a rule on an `Alb`, its id is the listener and the priority: `HTTPS443P100`.
118
+ * For a rule on the service's own load balancer, it's the listener and a hash of
119
+ * the conditions, so a function here is better off reading the rule's args.
120
+ */
121
+ listenerRule: many(lb.ListenerRule),
122
+ /**
123
+ * The AWS Cloud Map service. Only created when the cluster's VPC has a Cloud Map
124
+ * namespace, which a VPC you pass in by its ids may not. So it's an output, and
125
+ * reading it fails when there is no namespace.
126
+ */
127
+ cloudmapService: deferred(servicediscovery.Service),
128
+ /**
129
+ * The Amazon ECS Service.
130
+ */
131
+ service: ecs.Service,
132
+ /**
133
+ * The AWS Application Auto Scaling target.
134
+ */
135
+ autoScalingTarget: appautoscaling.Target,
136
+ /**
137
+ * The AWS Application Auto Scaling policy that tracks CPU utilization. Not created
138
+ * when `scaling.cpuUtilization` is `false`.
139
+ */
140
+ autoScalingCpuPolicy: optional(appautoscaling.Policy),
141
+ /**
142
+ * The AWS Application Auto Scaling policy that tracks memory utilization. Not
143
+ * created when `scaling.memoryUtilization` is `false`.
144
+ */
145
+ autoScalingMemoryPolicy: optional(appautoscaling.Policy),
146
+ /**
147
+ * The AWS Application Auto Scaling policy that tracks the requests each target
148
+ * gets. Only created when `scaling.requestCount` is set.
149
+ */
150
+ autoScalingRequestCountPolicy: optional(appautoscaling.Policy),
151
+ /**
152
+ * What `sst dev` runs in place of each container, by the container's name. It's
153
+ * added once the container's `dev` settings are known.
154
+ */
155
+ devCommand: many(DevCommand),
156
+ });
157
+
158
+ type Port = `${number}/${"http" | "https" | "tcp" | "udp" | "tcp_udp" | "tls"}`;
159
+ type AlbPort = `${number}/${"http" | "https"}`;
160
+
161
+ export interface ServiceContainerArgs extends ContainerArgs {
162
+ /**
163
+ * Configure the health check for the container. Same as the top-level
164
+ * [`health`](#health).
165
+ */
166
+ health?: OriginalServiceArgs["health"];
167
+ /**
168
+ * Configure how this container works in `sst dev`. Same as the top-level
169
+ * [`dev`](#dev).
170
+ */
171
+ dev?: {
172
+ /**
173
+ * The command that `sst dev` runs to start this in dev mode. Same as the top-level
174
+ * [`dev.command`](#dev-command).
175
+ */
176
+ command: Input<string>;
177
+ /**
178
+ * Configure if you want to automatically start this when `sst dev` starts. Same as the
179
+ * top-level [`dev.autostart`](#dev-autostart).
180
+ */
181
+ autostart?: Input<boolean>;
182
+ /**
183
+ * Change the directory from where the `command` is run. Same as the top-level
184
+ * [`dev.directory`](#dev-directory).
185
+ */
186
+ directory?: Input<string>;
187
+ };
188
+ }
189
+
190
+ export interface ServiceDomainArgs extends CustomDomainArgs {
191
+ /**
192
+ * The custom domain you want to use.
193
+ *
194
+ * @example
195
+ * ```js
196
+ * {
197
+ * domain: {
198
+ * name: "example.com"
199
+ * }
200
+ * }
201
+ * ```
202
+ *
203
+ * Can also include subdomains based on the current stage.
204
+ *
205
+ * ```js
206
+ * {
207
+ * domain: {
208
+ * name: `${$app.stage}.example.com`
209
+ * }
210
+ * }
211
+ * ```
212
+ *
213
+ * Wildcard domains are supported.
214
+ *
215
+ * ```js
216
+ * {
217
+ * domain: {
218
+ * name: "*.example.com"
219
+ * }
220
+ * }
221
+ * ```
222
+ */
223
+ name: Input<string>;
224
+ /**
225
+ * Alias domains that should be used. A plain list: each alias gets DNS records of
226
+ * its own.
227
+ *
228
+ * @example
229
+ * ```js {4}
230
+ * {
231
+ * domain: {
232
+ * name: "app1.example.com",
233
+ * aliases: ["app2.example.com"]
234
+ * }
235
+ * }
236
+ * ```
237
+ */
238
+ aliases?: string[];
239
+ }
240
+
241
+ export interface ServiceRuleArgs {
242
+ /**
243
+ * The port and protocol the service listens on. Uses the format `{port}/{protocol}`.
244
+ *
245
+ * @example
246
+ * ```js
247
+ * {
248
+ * listen: "80/http"
249
+ * }
250
+ * ```
251
+ */
252
+ listen: Port;
253
+ /**
254
+ * The port and protocol of the container the service forwards the traffic to. Uses the
255
+ * format `{port}/{protocol}`.
256
+ *
257
+ * @example
258
+ * ```js
259
+ * {
260
+ * forward: "80/http"
261
+ * }
262
+ * ```
263
+ * @default The same port and protocol as `listen`.
264
+ */
265
+ forward?: Port;
266
+ /**
267
+ * The name of the container to forward the traffic to. This maps to the `name` defined in
268
+ * `containers`.
269
+ *
270
+ * You only need this if there's more than one container. If there's only one container, the
271
+ * traffic is automatically forwarded there.
272
+ */
273
+ container?: string;
274
+ /**
275
+ * The port and protocol to redirect the traffic to. Uses the format `{port}/{protocol}`.
276
+ *
277
+ * @example
278
+ * ```js
279
+ * {
280
+ * redirect: "80/http"
281
+ * }
282
+ * ```
283
+ */
284
+ redirect?: Port;
285
+ /**
286
+ * The conditions a request has to match for the rule to apply. Only applicable to
287
+ * `http` and `https` protocols.
288
+ *
289
+ * These are plain values all the way down. The listener rule is named after them.
290
+ */
291
+ conditions?: {
292
+ /**
293
+ * Configure path-based routing. Only requests matching the path are forwarded to
294
+ * the container.
295
+ *
296
+ * ```js
297
+ * {
298
+ * path: "/api/*"
299
+ * }
300
+ * ```
301
+ *
302
+ * The path pattern is case-sensitive, supports wildcards, and can be up to 128
303
+ * characters.
304
+ * - `*` matches 0 or more characters. For example, `/api/*` matches `/api/` or
305
+ * `/api/orders`.
306
+ * - `?` matches exactly 1 character. For example, `/api/?.png` matches `/api/a.png`.
307
+ *
308
+ * @default Requests to all paths are forwarded.
309
+ */
310
+ path?: string;
311
+ /**
312
+ * Configure query string based routing. Only requests matching one of the query
313
+ * string conditions are forwarded to the container.
314
+ *
315
+ * Takes a list of `key`, the name of the query string parameter, and `value` pairs.
316
+ * Where `value` is the value of the query string parameter. But it can be a pattern as well.
317
+ *
318
+ * If multiple `key` and `value` pairs are provided, it'll match requests with **any** of the
319
+ * query string parameters.
320
+ *
321
+ * @default Query string is not checked when forwarding requests.
322
+ *
323
+ * @example
324
+ *
325
+ * For example, to match requests with query string `version=v1`.
326
+ *
327
+ * ```js
328
+ * {
329
+ * query: [
330
+ * { key: "version", value: "v1" }
331
+ * ]
332
+ * }
333
+ * ```
334
+ *
335
+ * Or match requests with query string matching `env=test*`.
336
+ *
337
+ * ```js
338
+ * {
339
+ * query: [
340
+ * { key: "env", value: "test*" }
341
+ * ]
342
+ * }
343
+ * ```
344
+ *
345
+ * Match requests with query string `version=v1` **or** `env=test*`.
346
+ *
347
+ * ```js
348
+ * {
349
+ * query: [
350
+ * { key: "version", value: "v1" },
351
+ * { key: "env", value: "test*" }
352
+ * ]
353
+ * }
354
+ * ```
355
+ *
356
+ * Match requests with any query string key with value `example`.
357
+ *
358
+ * ```js
359
+ * {
360
+ * query: [
361
+ * { value: "example" }
362
+ * ]
363
+ * }
364
+ * ```
365
+ */
366
+ query?: {
367
+ /**
368
+ * The name of the query string parameter.
369
+ */
370
+ key?: string;
371
+ /**
372
+ * The value of the query string parameter.
373
+ *
374
+ * If no `key` is provided, it'll match any request where a query string parameter with
375
+ * the given value exists.
376
+ */
377
+ value: string;
378
+ }[];
379
+ /**
380
+ * Configure header based routing. Only requests matching the header
381
+ * name and values are forwarded to the container.
382
+ *
383
+ * Both the header name and values are case insensitive.
384
+ *
385
+ * @default Header is not checked when forwarding requests.
386
+ *
387
+ * @example
388
+ *
389
+ * For example, if you specify `X-Custom-Header` as the name and `Value1`
390
+ * as a value, it will match requests with the header
391
+ * `x-custom-header: value1` as well.
392
+ *
393
+ * ```js
394
+ * {
395
+ * header: {
396
+ * name: "X-Custom-Header",
397
+ * values: ["Value1", "Value2", "Prefix*"]
398
+ * }
399
+ * }
400
+ * ```
401
+ */
402
+ header?: {
403
+ /**
404
+ * The name of the HTTP header field to check. This is case-insensitive.
405
+ */
406
+ name: string;
407
+ /**
408
+ * The values to match against the header value. The rule matches if the
409
+ * request header matches any of these values. Values are case-insensitive
410
+ * and support wildcards (`*` and `?`) for pattern matching.
411
+ */
412
+ values: string[];
413
+ };
414
+ };
415
+ }
416
+
417
+ export interface ServiceHealthCheckArgs {
418
+ /**
419
+ * The URL path to ping on the service for health checks. Only applicable to
420
+ * `http` and `https` protocols.
421
+ * @default `"/"`
422
+ */
423
+ path?: Input<string>;
424
+ /**
425
+ * The time period between each health check request. Must be between `5 seconds`
426
+ * and `300 seconds`.
427
+ * @default `"30 seconds"`
428
+ */
429
+ interval?: Input<DurationMinutes>;
430
+ /**
431
+ * The timeout for each health check request. If no response is received within this
432
+ * time, it is considered failed. Must be between `2 seconds` and `120 seconds`.
433
+ * @default `"5 seconds"`
434
+ */
435
+ timeout?: Input<DurationMinutes>;
436
+ /**
437
+ * The number of consecutive successful health check requests required to consider the
438
+ * target healthy. Must be between 2 and 10.
439
+ * @default `5`
440
+ */
441
+ healthyThreshold?: Input<number>;
442
+ /**
443
+ * The number of consecutive failed health check requests required to consider the
444
+ * target unhealthy. Must be between 2 and 10.
445
+ * @default `2`
446
+ */
447
+ unhealthyThreshold?: Input<number>;
448
+ /**
449
+ * One or more HTTP response codes the health check treats as successful. Only
450
+ * applicable to `http` and `https` protocols.
451
+ *
452
+ * @default `"200"`
453
+ * @example
454
+ * ```js
455
+ * {
456
+ * successCodes: "200-299"
457
+ * }
458
+ * ```
459
+ */
460
+ successCodes?: Input<string>;
461
+ }
462
+
463
+ export interface ServiceLoadBalancerArgs {
464
+ /**
465
+ * Configure if the load balancer should be public or private.
466
+ *
467
+ * When set to `false`, the load balancer endpoint will only be accessible within the
468
+ * VPC.
469
+ *
470
+ * @default `true`
471
+ */
472
+ public?: Input<boolean>;
473
+ /**
474
+ * Set a custom domain for your load balancer endpoint.
475
+ *
476
+ * Automatically manages domains hosted on AWS Route 53, Cloudflare, and Vercel. For other
477
+ * providers, you'll need to pass in a `cert` that validates domain ownership and add the
478
+ * DNS records.
479
+ *
480
+ * :::tip
481
+ * Built-in support for AWS Route 53, Cloudflare, and Vercel. And manual setup for other
482
+ * providers.
483
+ * :::
484
+ *
485
+ * @example
486
+ *
487
+ * By default this assumes the domain is hosted on Route 53.
488
+ *
489
+ * ```js
490
+ * {
491
+ * domain: "example.com"
492
+ * }
493
+ * ```
494
+ *
495
+ * For domains hosted on Cloudflare.
496
+ *
497
+ * ```js
498
+ * {
499
+ * domain: {
500
+ * name: "example.com",
501
+ * dns: sst.cloudflare.dns()
502
+ * }
503
+ * }
504
+ * ```
505
+ */
506
+ domain?: string | ServiceDomainArgs;
507
+ /**
508
+ * Configure the mapping for the ports the load balancer listens to, forwards, or redirects to
509
+ * the service.
510
+ * This supports two types of protocols:
511
+ *
512
+ * 1. Application Layer Protocols: `http` and `https`. This'll create an [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html).
513
+ * 2. Network Layer Protocols: `tcp`, `udp`, `tcp_udp`, and `tls`. This'll create a [Network Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html).
514
+ *
515
+ * :::note
516
+ * If you want to listen on `https` or `tls`, you need to specify a custom
517
+ * `loadBalancer.domain`.
518
+ * :::
519
+ *
520
+ * You **can not configure** both application and network layer protocols for the same
521
+ * service.
522
+ *
523
+ * The list and each rule are plain values. They decide which listeners, target groups
524
+ * and listener rules are created.
525
+ *
526
+ * @example
527
+ * Here we are listening on port `80` and forwarding it to the service on port `8080`.
528
+ * ```js
529
+ * {
530
+ * rules: [
531
+ * { listen: "80/http", forward: "8080/http" }
532
+ * ]
533
+ * }
534
+ * ```
535
+ *
536
+ * The `forward` port and protocol defaults to the `listen` port and protocol. So in this
537
+ * case both are `80/http`.
538
+ *
539
+ * ```js
540
+ * {
541
+ * rules: [
542
+ * { listen: "80/http" }
543
+ * ]
544
+ * }
545
+ * ```
546
+ *
547
+ * If multiple containers are configured via the `containers` argument, you need to
548
+ * specify which container the traffic should be forwarded to.
549
+ *
550
+ * ```js
551
+ * {
552
+ * rules: [
553
+ * { listen: "80/http", container: "app" },
554
+ * { listen: "8000/http", container: "admin" }
555
+ * ]
556
+ * }
557
+ * ```
558
+ *
559
+ * You can also route the same port to multiple containers via path-based routing.
560
+ *
561
+ * ```js
562
+ * {
563
+ * rules: [
564
+ * {
565
+ * listen: "80/http",
566
+ * container: "app",
567
+ * conditions: { path: "/api/*" }
568
+ * },
569
+ * {
570
+ * listen: "80/http",
571
+ * container: "admin",
572
+ * conditions: { path: "/admin/*" }
573
+ * }
574
+ * ]
575
+ * }
576
+ * ```
577
+ *
578
+ * Additionally, you can redirect traffic from one port to another. This is
579
+ * commonly used to redirect http to https.
580
+ *
581
+ * ```js
582
+ * {
583
+ * rules: [
584
+ * { listen: "80/http", redirect: "443/https" },
585
+ * { listen: "443/https", forward: "80/http" }
586
+ * ]
587
+ * }
588
+ * ```
589
+ */
590
+ rules: ServiceRuleArgs[];
591
+ /**
592
+ * Configure the health check that the load balancer runs on your containers.
593
+ *
594
+ * :::tip
595
+ * This health check is different from the [`health`](#health) check.
596
+ * :::
597
+ *
598
+ * This health check is run by the load balancer. While, `health` is run by ECS. This
599
+ * cannot be disabled if you are using a load balancer. While the other is off by default.
600
+ *
601
+ * Since this cannot be disabled, here are some tips on how to debug an unhealthy
602
+ * health check.
603
+ *
604
+ * <details>
605
+ * <summary>How to debug a load balancer health check</summary>
606
+ *
607
+ * If you notice a `Unhealthy: Health checks failed` error, it's because the health
608
+ * check has failed. When it fails, the load balancer will terminate the containers,
609
+ * causing any requests to fail.
610
+ *
611
+ * Here's how to debug it:
612
+ *
613
+ * 1. Verify the health check path.
614
+ *
615
+ * By default, the load balancer checks the `/` path. Ensure it's accessible in your
616
+ * containers. If your application runs on a different path, then update the path in
617
+ * the health check config accordingly.
618
+ *
619
+ * 2. Confirm the containers are operational.
620
+ *
621
+ * Navigate to **ECS console** > select the **cluster** > go to the **Tasks tab** >
622
+ * choose **Any desired status** under the **Filter desired status** dropdown > select
623
+ * a task and check for errors under the **Logs tab**. If it has error that means that
624
+ * the container failed to start.
625
+ *
626
+ * 3. If the container was terminated by the load balancer while still starting up, try
627
+ * increasing the health check interval and timeout.
628
+ * </details>
629
+ *
630
+ * For `http` and `https` the default is:
631
+ *
632
+ * ```js
633
+ * {
634
+ * path: "/",
635
+ * healthyThreshold: 5,
636
+ * successCodes: "200",
637
+ * timeout: "5 seconds",
638
+ * unhealthyThreshold: 2,
639
+ * interval: "30 seconds"
640
+ * }
641
+ * ```
642
+ *
643
+ * For `tcp` and `udp` the default is:
644
+ *
645
+ * ```js
646
+ * {
647
+ * healthyThreshold: 5,
648
+ * timeout: "6 seconds",
649
+ * unhealthyThreshold: 2,
650
+ * interval: "30 seconds"
651
+ * }
652
+ * ```
653
+ *
654
+ * @example
655
+ *
656
+ * To configure the health check, we use the _port/protocol_ format. Here we are
657
+ * configuring a health check that pings the `/health` path on port `8080`
658
+ * every 10 seconds.
659
+ *
660
+ * ```js
661
+ * {
662
+ * rules: [
663
+ * { listen: "80/http", forward: "8080/http" }
664
+ * ],
665
+ * health: {
666
+ * "8080/http": {
667
+ * path: "/health",
668
+ * interval: "10 seconds"
669
+ * }
670
+ * }
671
+ * }
672
+ * ```
673
+ */
674
+ health?: Record<Port, Input<ServiceHealthCheckArgs>>;
675
+ }
676
+
677
+ export interface ServiceAlbRuleArgs {
678
+ /**
679
+ * The port and protocol to listen on, in `{port}/{protocol}` format. Must match a listener on the ALB.
680
+ *
681
+ * @example
682
+ * ```js
683
+ * {
684
+ * listen: "443/https"
685
+ * }
686
+ * ```
687
+ */
688
+ listen: AlbPort;
689
+ /**
690
+ * The container port and protocol to forward traffic to. Uses the format `{port}/{protocol}`.
691
+ *
692
+ * The protocol must match what the container actually speaks. Using `"3000/https"` when
693
+ * the container speaks HTTP will cause health check failures.
694
+ *
695
+ * @example
696
+ * ```js
697
+ * {
698
+ * forward: "8080/http"
699
+ * }
700
+ * ```
701
+ */
702
+ forward: AlbPort;
703
+ /**
704
+ * The name of the container to forward the traffic to. Required when multiple containers
705
+ * are configured.
706
+ */
707
+ container?: string;
708
+ /**
709
+ * The conditions for the listener rule. At least one condition (path, query, or header)
710
+ * must be specified. The ALB owns the default action, and a service only adds conditional
711
+ * rules.
712
+ *
713
+ * @example
714
+ * ```js
715
+ * {
716
+ * conditions: {
717
+ * path: "/api/*"
718
+ * }
719
+ * }
720
+ * ```
721
+ */
722
+ conditions: {
723
+ /**
724
+ * Path pattern to match. Supports wildcards (`*` and `?`).
725
+ */
726
+ path?: Input<string>;
727
+ /**
728
+ * Query string conditions.
729
+ */
730
+ query?: Input<
731
+ Input<{
732
+ key?: Input<string>;
733
+ value: Input<string>;
734
+ }>[]
735
+ >;
736
+ /**
737
+ * HTTP header condition.
738
+ */
739
+ header?: Input<{
740
+ name: Input<string>;
741
+ values: Input<Input<string>>[];
742
+ }>;
743
+ };
744
+ /**
745
+ * Explicit priority for the listener rule (1–50000).
746
+ * Must be unique per listener across ALL services sharing the ALB.
747
+ * Use non-overlapping ranges per service (e.g., Service A: 100-199, Service B: 200-299).
748
+ *
749
+ * @example
750
+ * ```js
751
+ * {
752
+ * priority: 100
753
+ * }
754
+ * ```
755
+ */
756
+ priority: number;
757
+ }
758
+
759
+ export interface ServiceAlbArgs {
760
+ /**
761
+ * The `Alb` instance to attach this service to. When provided, the service creates
762
+ * target groups and listener rules on the shared ALB instead of creating its own
763
+ * load balancer.
764
+ *
765
+ * ECS tasks use the VPC's default security group, which allows all traffic within the
766
+ * VPC CIDR. For tighter security, add an explicit security group ingress rule from the
767
+ * ALB's security group using `transform`.
768
+ *
769
+ * @example
770
+ * ```js
771
+ * {
772
+ * loadBalancer: {
773
+ * instance: alb,
774
+ * rules: [
775
+ * { listen: "443/https", forward: "8080/http", conditions: { path: "/api/*" }, priority: 100 }
776
+ * ]
777
+ * }
778
+ * }
779
+ * ```
780
+ */
781
+ instance: OriginalAlb | Alb;
782
+ /**
783
+ * The rules for routing traffic from the ALB to this service's containers.
784
+ * Each rule must have explicit conditions and priority.
785
+ */
786
+ rules: ServiceAlbRuleArgs[];
787
+ /**
788
+ * Configure health checks for the target groups, keyed by the `{port}/{protocol}` the
789
+ * traffic is forwarded to.
790
+ */
791
+ health?: Record<AlbPort, Input<ServiceHealthCheckArgs>>;
792
+ }
793
+
794
+ export interface ServiceArgs
795
+ extends V5Args<
796
+ Omit<
797
+ OriginalServiceArgs,
798
+ | "cluster"
799
+ | "containers"
800
+ | "volumes"
801
+ | "taskRole"
802
+ | "executionRole"
803
+ | "public"
804
+ | "loadBalancer"
805
+ | "scaling"
806
+ >,
807
+ typeof parts
808
+ >,
809
+ FargateArgs {
810
+ /**
811
+ * Configure a load balancer to route traffic to the containers.
812
+ *
813
+ * While you can expose a service through API Gateway, it's better to use a load balancer
814
+ * for most traditional web applications. It is more expensive to start but at higher
815
+ * levels of traffic it ends up being more cost effective.
816
+ *
817
+ * Also, if you need to listen on network layer protocols like `tcp` or `udp`, you have to
818
+ * expose it through a load balancer.
819
+ *
820
+ * By default, the endpoint is an auto-generated load balancer URL. You can also add a
821
+ * custom domain for the endpoint.
822
+ *
823
+ * This has to be a plain value, and so do its `domain` and `rules`. They decide which
824
+ * resources are created.
825
+ *
826
+ * @default Load balancer is not created
827
+ * @example
828
+ *
829
+ * ```js
830
+ * {
831
+ * loadBalancer: {
832
+ * domain: "example.com",
833
+ * rules: [
834
+ * { listen: "80/http", redirect: "443/https" },
835
+ * { listen: "443/https", forward: "80/http" }
836
+ * ]
837
+ * }
838
+ * }
839
+ * ```
840
+ *
841
+ * To share a load balancer between services, pass in an `Alb`. The service then adds
842
+ * its target groups and listener rules to it.
843
+ *
844
+ * ```js
845
+ * {
846
+ * loadBalancer: {
847
+ * instance: alb,
848
+ * rules: [
849
+ * { listen: "443/https", forward: "8080/http", conditions: { path: "/api/*" }, priority: 100 }
850
+ * ]
851
+ * }
852
+ * }
853
+ * ```
854
+ */
855
+ loadBalancer?: ServiceLoadBalancerArgs | ServiceAlbArgs;
856
+ /**
857
+ * Configure the service to automatically scale up or down based on the CPU or memory
858
+ * utilization of a container. By default, scaling is disabled and the service will run
859
+ * in a single container.
860
+ *
861
+ * This has to be a plain value, and so do `cpuUtilization`, `memoryUtilization` and
862
+ * `requestCount`. They decide which scaling policies are created.
863
+ *
864
+ * @default `{ min: 1, max: 1 }`
865
+ *
866
+ * @example
867
+ * ```js
868
+ * {
869
+ * scaling: {
870
+ * min: 4,
871
+ * max: 16,
872
+ * cpuUtilization: 50,
873
+ * memoryUtilization: 50
874
+ * }
875
+ * }
876
+ * ```
877
+ */
878
+ scaling?: {
879
+ /**
880
+ * The minimum number of containers to scale down to.
881
+ * @default `1`
882
+ * @example
883
+ * ```js
884
+ * {
885
+ * scaling: {
886
+ * min: 4
887
+ * }
888
+ * }
889
+ * ```
890
+ */
891
+ min?: Input<number>;
892
+ /**
893
+ * The maximum number of containers to scale up to.
894
+ * @default `1`
895
+ * @example
896
+ * ```js
897
+ * {
898
+ * scaling: {
899
+ * max: 16
900
+ * }
901
+ * }
902
+ * ```
903
+ */
904
+ max?: Input<number>;
905
+ /**
906
+ * The target CPU utilization percentage to scale up or down. It'll scale up
907
+ * when the CPU utilization is above the target and scale down when it's below the target.
908
+ * @default `70`
909
+ * @example
910
+ * ```js
911
+ * {
912
+ * scaling: {
913
+ * cpuUtilization: 50
914
+ * }
915
+ * }
916
+ * ```
917
+ */
918
+ cpuUtilization?: false | number;
919
+ /**
920
+ * The target memory utilization percentage to scale up or down. It'll scale up
921
+ * when the memory utilization is above the target and scale down when it's below the target.
922
+ * @default `70`
923
+ * @example
924
+ * ```js
925
+ * {
926
+ * scaling: {
927
+ * memoryUtilization: 50
928
+ * }
929
+ * }
930
+ * ```
931
+ */
932
+ memoryUtilization?: false | number;
933
+ /**
934
+ * The target request count to scale up or down. It'll scale up when the request count is
935
+ * above the target and scale down when it's below the target.
936
+ * @default `false`
937
+ * @example
938
+ * ```js
939
+ * {
940
+ * scaling: {
941
+ * requestCount: 1500
942
+ * }
943
+ * }
944
+ * ```
945
+ */
946
+ requestCount?: false | number;
947
+ /**
948
+ * The amount of time, in seconds, after a scale-in activity completes before another scale-in activity can start.
949
+ * This prevents the auto scaler from removing too many tasks too quickly.
950
+ * @example
951
+ * ```js
952
+ * {
953
+ * scaling: {
954
+ * scaleInCooldown: "60 seconds"
955
+ * }
956
+ * }
957
+ * ```
958
+ */
959
+ scaleInCooldown?: Input<DurationMinutes>;
960
+ /**
961
+ * The amount of time, in seconds, after a scale-out activity completes before another scale-out activity can start.
962
+ * This prevents the auto scaler from adding too many tasks too quickly.
963
+ * @example
964
+ * ```js
965
+ * {
966
+ * scaling: {
967
+ * scaleOutCooldown: "60 seconds"
968
+ * }
969
+ * }
970
+ * ```
971
+ */
972
+ scaleOutCooldown?: Input<DurationMinutes>;
973
+ };
974
+ /**
975
+ * The containers to run in the service.
976
+ *
977
+ * :::tip
978
+ * You can optionally run multiple containers in a service.
979
+ * :::
980
+ *
981
+ * By default this starts a single container. To add multiple containers in the service, pass
982
+ * in an array of containers args.
983
+ *
984
+ * ```ts
985
+ * {
986
+ * containers: [
987
+ * {
988
+ * name: "app",
989
+ * image: "nginxdemos/hello:plain-text"
990
+ * },
991
+ * {
992
+ * name: "admin",
993
+ * image: {
994
+ * context: "./admin",
995
+ * dockerfile: "Dockerfile"
996
+ * }
997
+ * }
998
+ * ]
999
+ * }
1000
+ * ```
1001
+ *
1002
+ * If you specify `containers`, you cannot list the above args at the top-level. For example,
1003
+ * you **cannot** pass in `image` at the top level.
1004
+ *
1005
+ * ```diff lang="ts"
1006
+ * {
1007
+ * - image: "nginxdemos/hello:plain-text",
1008
+ * containers: [
1009
+ * {
1010
+ * name: "app",
1011
+ * image: "nginxdemos/hello:plain-text"
1012
+ * },
1013
+ * {
1014
+ * name: "admin",
1015
+ * image: "nginxdemos/hello:plain-text"
1016
+ * }
1017
+ * ]
1018
+ * }
1019
+ * ```
1020
+ *
1021
+ * You will need to pass in `image` as a part of the `containers`.
1022
+ *
1023
+ * The list, each container and its `name` have to be plain values. What's inside a
1024
+ * container can be an output.
1025
+ */
1026
+ containers?: ServiceContainerArgs[];
1027
+ }
1028
+
1029
+ /**
1030
+ * The `Service` component lets you create containers that are always running, like web or
1031
+ * application servers. It uses [Amazon ECS](https://aws.amazon.com/ecs/) on [AWS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html).
1032
+ *
1033
+ * It takes the same args as [`sst.aws.Service`](/docs/component/aws/service) and creates the
1034
+ * same resources. It's built from parts, so every resource it creates can be transformed,
1035
+ * is available in `nodes`, and can be swapped for one you already have.
1036
+ *
1037
+ * @example
1038
+ *
1039
+ * #### Create a Service
1040
+ *
1041
+ * Services are run inside an ECS Cluster. If you haven't already, create one.
1042
+ *
1043
+ * ```ts title="sst.config.ts"
1044
+ * const vpc = new sst.aws.Vpc("MyVpc");
1045
+ * const cluster = new sst.aws.v5.Cluster("MyCluster", { vpc });
1046
+ * ```
1047
+ *
1048
+ * Add the service to it.
1049
+ *
1050
+ * ```ts title="sst.config.ts"
1051
+ * const service = new sst.aws.v5.Service("MyService", { cluster });
1052
+ * ```
1053
+ *
1054
+ * #### Configure the container image
1055
+ *
1056
+ * By default, the service will look for a Dockerfile in the root directory. Optionally
1057
+ * configure the image context and dockerfile.
1058
+ *
1059
+ * ```ts title="sst.config.ts"
1060
+ * new sst.aws.v5.Service("MyService", {
1061
+ * cluster,
1062
+ * image: {
1063
+ * context: "./app",
1064
+ * dockerfile: "Dockerfile"
1065
+ * }
1066
+ * });
1067
+ * ```
1068
+ *
1069
+ * To add multiple containers in the service, pass in an array of containers args.
1070
+ *
1071
+ * ```ts title="sst.config.ts"
1072
+ * new sst.aws.v5.Service("MyService", {
1073
+ * cluster,
1074
+ * containers: [
1075
+ * {
1076
+ * name: "app",
1077
+ * image: "nginxdemos/hello:plain-text"
1078
+ * },
1079
+ * {
1080
+ * name: "admin",
1081
+ * image: {
1082
+ * context: "./admin",
1083
+ * dockerfile: "Dockerfile"
1084
+ * }
1085
+ * }
1086
+ * ]
1087
+ * });
1088
+ * ```
1089
+ *
1090
+ * This is useful for running sidecar containers.
1091
+ *
1092
+ * #### Enable auto-scaling
1093
+ *
1094
+ * ```ts title="sst.config.ts"
1095
+ * new sst.aws.v5.Service("MyService", {
1096
+ * cluster,
1097
+ * scaling: {
1098
+ * min: 4,
1099
+ * max: 16,
1100
+ * cpuUtilization: 50,
1101
+ * memoryUtilization: 50
1102
+ * }
1103
+ * });
1104
+ * ```
1105
+ *
1106
+ * #### Expose through API Gateway
1107
+ *
1108
+ * You can give your service a public URL by exposing it through API Gateway HTTP API. You can
1109
+ * also optionally give it a custom domain.
1110
+ *
1111
+ * ```ts title="sst.config.ts"
1112
+ * const service = new sst.aws.v5.Service("MyService", {
1113
+ * cluster,
1114
+ * serviceRegistry: {
1115
+ * port: 80
1116
+ * }
1117
+ * });
1118
+ *
1119
+ * const api = new sst.aws.v5.ApiGatewayV2("MyApi", {
1120
+ * vpc,
1121
+ * domain: "example.com"
1122
+ * });
1123
+ * api.routePrivate("$default", service.nodes.cloudmapService.arn);
1124
+ * ```
1125
+ *
1126
+ * #### Add a load balancer
1127
+ *
1128
+ * You can also expose your service by adding a load balancer to it and optionally
1129
+ * adding a custom domain.
1130
+ *
1131
+ * ```ts title="sst.config.ts"
1132
+ * new sst.aws.v5.Service("MyService", {
1133
+ * cluster,
1134
+ * loadBalancer: {
1135
+ * domain: "example.com",
1136
+ * rules: [
1137
+ * { listen: "80/http" },
1138
+ * { listen: "443/https", forward: "80/http" }
1139
+ * ]
1140
+ * }
1141
+ * });
1142
+ * ```
1143
+ *
1144
+ * #### Link resources
1145
+ *
1146
+ * [Link resources](/docs/linking/) to your service. This will grant permissions
1147
+ * to the resources and allow you to access it in your app.
1148
+ *
1149
+ * ```ts {5} title="sst.config.ts"
1150
+ * const bucket = new sst.aws.v5.Bucket("MyBucket");
1151
+ *
1152
+ * new sst.aws.v5.Service("MyService", {
1153
+ * cluster,
1154
+ * link: [bucket]
1155
+ * });
1156
+ * ```
1157
+ *
1158
+ * You can use the [SDK](/docs/reference/sdk/) to access the linked resources in your service.
1159
+ *
1160
+ * ```ts title="app.ts"
1161
+ * import { Resource } from "sst";
1162
+ *
1163
+ * console.log(Resource.MyBucket.name);
1164
+ * ```
1165
+ *
1166
+ * #### Service discovery
1167
+ *
1168
+ * This component automatically creates a Cloud Map service host name for the
1169
+ * service. So anything in the same VPC can access it using the service's host name.
1170
+ *
1171
+ * For example, if you link the service to a Lambda function that's in the same VPC.
1172
+ *
1173
+ * ```ts title="sst.config.ts" {2,4}
1174
+ * new sst.aws.v5.Function("MyFunction", {
1175
+ * vpc,
1176
+ * url: true,
1177
+ * link: [service],
1178
+ * handler: "lambda.handler"
1179
+ * });
1180
+ * ```
1181
+ *
1182
+ * You can access the service by its host name using the [SDK](/docs/reference/sdk/).
1183
+ *
1184
+ * ```ts title="lambda.ts"
1185
+ * import { Resource } from "sst";
1186
+ *
1187
+ * await fetch(`http://${Resource.MyService.service}`);
1188
+ * ```
1189
+ *
1190
+ * [Check out an example](/docs/examples/#aws-cluster-service-discovery).
1191
+ *
1192
+ * #### Use roles you already have
1193
+ *
1194
+ * Pass the role, or its name.
1195
+ *
1196
+ * ```ts title="sst.config.ts"
1197
+ * new sst.aws.v5.Service("MyService", {
1198
+ * cluster,
1199
+ * existing: {
1200
+ * taskRole: "my-task-role",
1201
+ * executionRole: "my-execution-role"
1202
+ * }
1203
+ * });
1204
+ * ```
1205
+ *
1206
+ * #### Switch from `sst.aws.Service`
1207
+ *
1208
+ * Change `sst.aws.Service` to `sst.aws.v5.Service` and keep the name. The ECS service, its
1209
+ * task definition, roles, log groups and images, the load balancer with its listeners and
1210
+ * target groups, the Cloud Map service and the scaling policies are kept.
1211
+ *
1212
+ * ```ts title="sst.config.ts" del={1} ins={2}
1213
+ * const service = new sst.aws.Service("MyService", { cluster });
1214
+ * const service = new sst.aws.v5.Service("MyService", { cluster });
1215
+ * ```
1216
+ *
1217
+ * A few things are written differently:
1218
+ *
1219
+ * - `taskRole: "my-task-role"` becomes `existing: { taskRole: "my-task-role" }`, and the
1220
+ * same for `executionRole`.
1221
+ * - `public`, which `sst.aws.Service` deprecated, is `loadBalancer`. Its `ports` are
1222
+ * `rules`, and a rule's `path` is `conditions.path`.
1223
+ * - `loadBalancer`, its `domain`, its `rules` and each rule are plain values, not outputs.
1224
+ * So are `scaling` and its `cpuUtilization`, `memoryUtilization` and `requestCount`, and
1225
+ * the list of `containers`, each container and its `name`. They decide which resources
1226
+ * are created.
1227
+ * - `nodes.service` and `nodes.taskDefinition` are the resources, not outputs of them.
1228
+ * `nodes` also has the log groups, images, listeners, target groups and scaling
1229
+ * policies.
1230
+ * - `nodes.loadBalancer` is the load balancer the service creates. For a service that's
1231
+ * attached to an `Alb`, read it from the `Alb`.
1232
+ * - A `transform` function for `service`, `taskDefinition`, `logGroup`, `target` or
1233
+ * `listener` is given outputs where `sst.aws.Service` gave it plain values. For a part
1234
+ * there are several of, it's also given which one.
1235
+ * - `transform.listenerRule` applies to the rules of the service's own load balancer too,
1236
+ * not only to the rules on an `Alb`.
1237
+ * - If you set part of the ECS service's `networkConfiguration` or
1238
+ * `deploymentCircuitBreaker`, of a target group's `healthCheck`, or of the task
1239
+ * definition's `runtimePlatform`, with an object in `transform`, the rest of it is kept.
1240
+ *
1241
+ * One thing changes on the first deploy, and nothing in AWS: what `sst dev` runs for each
1242
+ * container is kept inside the service now, so it's listed as removed and created again.
1243
+ *
1244
+ * ---
1245
+ *
1246
+ * ### Cost
1247
+ *
1248
+ * By default, this uses a _Linux/X86_ _Fargate_ container with 0.25 vCPUs at $0.04048 per
1249
+ * vCPU per hour and 0.5 GB of memory at $0.004445 per GB per hour. It includes 20GB of
1250
+ * _Ephemeral Storage_ for free with additional storage at $0.000111 per GB per hour. Each
1251
+ * container also gets a public IPv4 address at $0.005 per hour.
1252
+ *
1253
+ * It works out to $0.04048 x 0.25 x 24 x 30 + $0.004445 x 0.5 x 24 x 30 + $0.005
1254
+ * x 24 x 30 or **$12 per month**.
1255
+ *
1256
+ * If you are using all Fargate Spot instances with `capacity: "spot"`, it's $0.01218784 x 0.25
1257
+ * x 24 x 30 + $0.00133831 x 0.5 x 24 x 30 + $0.005 x 24 x 30 or **$6 per month**
1258
+ *
1259
+ * Adjust this for the `cpu`, `memory` and `storage` you are using. And
1260
+ * check the prices for _Linux/ARM_ if you are using `arm64` as your `architecture`.
1261
+ *
1262
+ * The above are rough estimates for _us-east-1_, check out the
1263
+ * [Fargate pricing](https://aws.amazon.com/fargate/pricing/) and the
1264
+ * [Public IPv4 Address pricing](https://aws.amazon.com/vpc/pricing/) for more details.
1265
+ *
1266
+ * #### Scaling
1267
+ *
1268
+ * By default, `scaling` is disabled. If enabled, adjust the above for the number of containers.
1269
+ *
1270
+ * #### API Gateway
1271
+ *
1272
+ * If you expose your service through API Gateway, you'll need to add the cost of
1273
+ * [API Gateway HTTP API](https://aws.amazon.com/api-gateway/pricing/#HTTP_APIs) as well.
1274
+ * For services that don't get a lot of traffic, this ends up being a lot cheaper since API
1275
+ * Gateway is pay per request.
1276
+ *
1277
+ * Learn more about using
1278
+ * [Cluster with API Gateway](/docs/examples/#aws-cluster-with-api-gateway).
1279
+ *
1280
+ * #### Application Load Balancer
1281
+ *
1282
+ * If you add `loadBalancer` _HTTP_ or _HTTPS_ `rules`, an ALB is created at $0.0225 per hour,
1283
+ * $0.008 per LCU-hour, and $0.005 per hour if HTTPS with a custom domain is used. Where LCU
1284
+ * is a measure of how much traffic is processed.
1285
+ *
1286
+ * That works out to $0.0225 x 24 x 30 or **$16 per month**. Add $0.005 x 24 x 30 or **$4 per
1287
+ * month** for HTTPS. Also add the LCU-hour used.
1288
+ *
1289
+ * The above are rough estimates for _us-east-1_, check out the
1290
+ * [Application Load Balancer pricing](https://aws.amazon.com/elasticloadbalancing/pricing/)
1291
+ * for more details.
1292
+ *
1293
+ * #### Network Load Balancer
1294
+ *
1295
+ * If you add `loadBalancer` _TCP_, _UDP_, or _TLS_ `rules`, an NLB is created at $0.0225 per hour and
1296
+ * $0.006 per NLCU-hour. Where NCLU is a measure of how much traffic is processed.
1297
+ *
1298
+ * That works out to $0.0225 x 24 x 30 or **$16 per month**. Also add the NLCU-hour used.
1299
+ *
1300
+ * The above are rough estimates for _us-east-1_, check out the
1301
+ * [Network Load Balancer pricing](https://aws.amazon.com/elasticloadbalancing/pricing/)
1302
+ * for more details.
1303
+ */
1304
+ export class Service extends component("sst:aws:Service", parts) {
1305
+ // How the service is reached: what the getters and the link read
1306
+ private readonly reach: {
1307
+ url?: Output<string>;
1308
+ // Its host name in the cluster's Cloud Map namespace, when there is one
1309
+ host: Output<string | undefined>;
1310
+ };
1311
+
1312
+ constructor(
1313
+ name: string,
1314
+ args: ServiceArgs,
1315
+ opts: ComponentResourceOptions = {},
1316
+ ) {
1317
+ super(name, args, opts);
1318
+
1319
+ for (const role of ["taskRole", "executionRole"])
1320
+ notAnOption(
1321
+ args,
1322
+ role,
1323
+ `Pass the role, or its name, as "existing: { ${role} }" in the "${name}" service.`,
1324
+ );
1325
+ // An image that's built is a part. One that exists already is just the
1326
+ // image a container is given.
1327
+ notAnOption(
1328
+ args.existing ?? {},
1329
+ "image",
1330
+ `Set the "image" of the container to the image's reference in the "${name}" service.`,
1331
+ );
1332
+ notAnOption(
1333
+ args,
1334
+ "public",
1335
+ `It's "loadBalancer" now, with the same settings, in the "${name}" service.`,
1336
+ );
1337
+
1338
+ const cluster = args.cluster;
1339
+ // In `sst dev` the service isn't deployed. Each container's command runs
1340
+ // on the user's machine, as the task role.
1341
+ const dev =
1342
+ plain(args.dev, `The "dev" of the "${name}" service`) !== false && $dev;
1343
+ const region = getRegionOutput({}, opts).region;
1344
+ const architecture = withDefault(args.architecture, "x86_64" as const);
1345
+ const cpu = cpuOf(args);
1346
+ const memory = memoryOf(cpu, args);
1347
+ const storage = storageOf(args);
1348
+ const containers = containersOf("service", args, name);
1349
+ const balancer = loadBalancerOf(name, args.loadBalancer, containers);
1350
+ const scaling = scalingOf(name, args.scaling, balancer);
1351
+ const vpc = networkOf(cluster);
1352
+
1353
+ const taskRole = this.part("taskRole", taskRoleArgs(args, opts, dev));
1354
+
1355
+ // What `sst dev` runs in place of each container, in a tab of its own.
1356
+ // The settings are read first: `sst dev` is told them as they are.
1357
+ for (const container of containers)
1358
+ all([container.dev, container.image]).apply(([dev, image]) =>
1359
+ this.part("devCommand", container.name, {
1360
+ link: args.link,
1361
+ dev: {
1362
+ title: containers.length === 1 ? name : `${name}${container.name}`,
1363
+ autostart: true,
1364
+ directory: typeof image === "string" ? "" : image?.context ?? ".",
1365
+ ...dev,
1366
+ },
1367
+ environment: output(container.environment).apply((environment) => ({
1368
+ ...environment,
1369
+ AWS_REGION: region,
1370
+ })),
1371
+ aws: { role: taskRole.arn },
1372
+ }),
1373
+ );
1374
+
1375
+ if (dev) {
1376
+ this.runsLocally();
1377
+ this.reach = {
1378
+ url: balancer
1379
+ ? output((args.dev || undefined)?.url ?? URL_UNAVAILABLE)
1380
+ : undefined,
1381
+ host: vpc.cloudmapNamespaceName.apply((namespace) =>
1382
+ namespace ? `dev.${namespace}` : undefined,
1383
+ ),
1384
+ };
1385
+ return;
1386
+ }
1387
+
1388
+ const executionRole = this.part(
1389
+ "executionRole",
1390
+ executionRoleArgs(args, opts),
1391
+ );
1392
+ const taskDefinition = this.part(
1393
+ "taskDefinition",
1394
+ taskDefinitionArgs({
1395
+ name,
1396
+ cluster,
1397
+ region,
1398
+ link: args.link,
1399
+ // Each container, with the image it runs and the log group it writes to
1400
+ containers: containers.map((container) => ({
1401
+ container,
1402
+ image: containerImage(this, "image", container, {
1403
+ architecture,
1404
+ link: args.link,
1405
+ region,
1406
+ }),
1407
+ logGroup: this.part(
1408
+ "logGroup",
1409
+ container.name,
1410
+ logGroupArgs(container, cluster, name),
1411
+ { ignoreChanges: ["name"] },
1412
+ ),
1413
+ })),
1414
+ architecture,
1415
+ cpu,
1416
+ memory,
1417
+ storage,
1418
+ taskRole,
1419
+ executionRole,
1420
+ }),
1421
+ );
1422
+
1423
+ const routing = !balancer
1424
+ ? undefined
1425
+ : "alb" in balancer
1426
+ ? this.attachToAlb(balancer, vpc)
1427
+ : this.createLoadBalancer(balancer, vpc);
1428
+ const cloudmapService = this.createCloudmapService(
1429
+ vpc,
1430
+ args.serviceRegistry,
1431
+ );
1432
+
1433
+ const service = this.part(
1434
+ "service",
1435
+ {
1436
+ name,
1437
+ cluster: cluster.nodes.cluster.arn,
1438
+ taskDefinition: taskDefinition.arn,
1439
+ desiredCount: scaling.min,
1440
+ ...(args.capacity
1441
+ ? {
1442
+ // setting `forceNewDeployment` ensures that the service is not recreated
1443
+ // when the capacity provider config changes.
1444
+ forceNewDeployment: true,
1445
+ capacityProviderStrategies: output(args.capacity).apply(
1446
+ capacityStrategies,
1447
+ ),
1448
+ }
1449
+ : // @deprecated do not use `launchType`, set `capacityProviderStrategies`
1450
+ // to `[{ capacityProvider: "FARGATE", weight: 1 }]` instead
1451
+ { launchType: "FARGATE" }),
1452
+ networkConfiguration: {
1453
+ // If the vpc is an SST vpc, services are automatically deployed to the public
1454
+ // subnets. So we need to assign a public IP for the service to be accessible.
1455
+ assignPublicIp: vpc.isSstVpc,
1456
+ subnets: vpc.containerSubnets,
1457
+ securityGroups: vpc.securityGroups,
1458
+ },
1459
+ deploymentCircuitBreaker: {
1460
+ enable: true,
1461
+ rollback: true,
1462
+ },
1463
+ loadBalancers: (routing?.targets ?? []).map((target) => ({
1464
+ targetGroupArn: target.group.arn,
1465
+ containerName: target.container,
1466
+ containerPort: target.port,
1467
+ })),
1468
+ enableExecuteCommand: true,
1469
+ serviceRegistries: cloudmapService.apply((registry) =>
1470
+ registry
1471
+ ? {
1472
+ registryArn: registry.arn,
1473
+ port: args.serviceRegistry
1474
+ ? output(args.serviceRegistry).port
1475
+ : undefined,
1476
+ }
1477
+ : undefined,
1478
+ ) as ecs.ServiceArgs["serviceRegistries"],
1479
+ waitForSteadyState: withDefault(args.wait, false),
1480
+ },
1481
+ // A target group has to be on a load balancer before a service can use
1482
+ // it, and it's a listener or a listener rule that puts it there
1483
+ { dependsOn: routing?.routes },
1484
+ );
1485
+
1486
+ const autoScalingTarget = this.part("autoScalingTarget", {
1487
+ serviceNamespace: "ecs",
1488
+ scalableDimension: "ecs:service:DesiredCount",
1489
+ resourceId: interpolate`service/${cluster.nodes.cluster.name}/${service.name}`,
1490
+ maxCapacity: scaling.max,
1491
+ minCapacity: scaling.min,
1492
+ });
1493
+ // A policy that keeps a metric at a target value
1494
+ const tracking = (
1495
+ metric: {
1496
+ predefinedMetricType: string;
1497
+ resourceLabel?: Input<string>;
1498
+ },
1499
+ targetValue: number,
1500
+ ): appautoscaling.PolicyArgs => ({
1501
+ serviceNamespace: autoScalingTarget.serviceNamespace,
1502
+ scalableDimension: autoScalingTarget.scalableDimension,
1503
+ resourceId: autoScalingTarget.resourceId,
1504
+ policyType: "TargetTrackingScaling",
1505
+ targetTrackingScalingPolicyConfiguration: {
1506
+ predefinedMetricSpecification: metric,
1507
+ targetValue,
1508
+ scaleInCooldown: scaling.scaleInCooldown,
1509
+ scaleOutCooldown: scaling.scaleOutCooldown,
1510
+ },
1511
+ });
1512
+ if (scaling.cpuUtilization !== false)
1513
+ this.part(
1514
+ "autoScalingCpuPolicy",
1515
+ tracking(
1516
+ { predefinedMetricType: "ECSServiceAverageCPUUtilization" },
1517
+ scaling.cpuUtilization,
1518
+ ),
1519
+ );
1520
+ if (scaling.memoryUtilization !== false)
1521
+ this.part(
1522
+ "autoScalingMemoryPolicy",
1523
+ tracking(
1524
+ { predefinedMetricType: "ECSServiceAverageMemoryUtilization" },
1525
+ scaling.memoryUtilization,
1526
+ ),
1527
+ );
1528
+ if (scaling.requestCount !== false && routing) {
1529
+ const [target] = routing.targets;
1530
+ if (!target)
1531
+ throw new VisibleError(
1532
+ `"scaling.requestCount" needs a rule that forwards to a container in the "${name}" service. All of its rules redirect.`,
1533
+ );
1534
+ this.part(
1535
+ "autoScalingRequestCountPolicy",
1536
+ tracking(
1537
+ {
1538
+ predefinedMetricType: "ALBRequestCountPerTarget",
1539
+ resourceLabel: all([routing.arn, target.group.arn]).apply(
1540
+ ([lbArn, targetGroupArn]) => {
1541
+ // arn:...:loadbalancer/app/frank-MyServiceLoadBalan/005af2ad12da1e52
1542
+ // => app/frank-MyServiceLoadBalan/005af2ad12da1e52
1543
+ const lbPart = lbArn
1544
+ .split(":")
1545
+ .pop()
1546
+ ?.split("/")
1547
+ .slice(1)
1548
+ .join("/");
1549
+ // arn:...:targetgroup/HTTP20250103004618450100000001/e0811b8cf3a60762
1550
+ // => targetgroup/HTTP20250103004618450100000001
1551
+ const tgPart = targetGroupArn.split(":").pop();
1552
+ return `${lbPart}/${tgPart}`;
1553
+ },
1554
+ ),
1555
+ },
1556
+ scaling.requestCount,
1557
+ ),
1558
+ );
1559
+ }
1560
+
1561
+ this.reach = {
1562
+ url: routing?.url,
1563
+ host: all([vpc.cloudmapNamespaceName, cloudmapService]).apply(
1564
+ ([namespace, registry]) =>
1565
+ namespace && registry
1566
+ ? registry.name.apply(
1567
+ (service): string => `${service}.${namespace}`,
1568
+ )
1569
+ : output(undefined),
1570
+ ),
1571
+ };
1572
+
1573
+ this.registerOutputs({ _hint: this.reach.url });
1574
+ }
1575
+
1576
+ // The service's own load balancer. Each port it listens on has a listener,
1577
+ // which sends a request to the target group of a container port, or
1578
+ // redirects it. A rule with conditions is a listener rule.
1579
+ private createLoadBalancer(balancer: OwnBalancer, vpc: Network): Routing {
1580
+ const name = this.componentName;
1581
+ const { domain } = balancer;
1582
+
1583
+ const securityGroup = this.part(
1584
+ "loadBalancerSecurityGroup",
1585
+ securityGroupArgs(vpc.id),
1586
+ );
1587
+ const certificate =
1588
+ domain && !domain.cert
1589
+ ? this.part("certificate", {
1590
+ domainName: domain.name,
1591
+ alternativeNames: domain.aliases,
1592
+ dns: domain.dns!,
1593
+ })
1594
+ : undefined;
1595
+ const certificateArn = domain && (domain.cert ?? certificate!.arn);
1596
+ const loadBalancer = this.part(
1597
+ "loadBalancer",
1598
+ {
1599
+ internal: output(balancer.public).apply((v) => !v),
1600
+ loadBalancerType: balancer.type,
1601
+ subnets: vpc.loadBalancerSubnets(balancer.public),
1602
+ securityGroups: [securityGroup.id],
1603
+ enableCrossZoneLoadBalancing: true,
1604
+ },
1605
+ // The load balancer is what holds on to the certificate, so it's
1606
+ // removed first. Its listeners are given the certificate, but it isn't.
1607
+ { dependsOn: certificate },
1608
+ );
1609
+
1610
+ const targets = new Map<string, Target>();
1611
+ for (const rule of balancer.rules) {
1612
+ if (rule.type !== "forward") continue;
1613
+ const id = targetKey(
1614
+ rule.container,
1615
+ rule.forwardProtocol,
1616
+ rule.forwardPort,
1617
+ );
1618
+ if (targets.has(id)) continue;
1619
+ const protocol = rule.forwardProtocol.toUpperCase();
1620
+ targets.set(id, {
1621
+ container: rule.container,
1622
+ port: rule.forwardPort,
1623
+ group: this.part("target", id, {
1624
+ // AWS enforces a 6-char limit on namePrefix for target groups.
1625
+ // "TCP_UDP" is 7 chars, so strip the underscore to fit.
1626
+ namePrefix: protocol.replace("_", ""),
1627
+ port: rule.forwardPort,
1628
+ protocol,
1629
+ targetType: "ip",
1630
+ vpcId: vpc.id,
1631
+ healthCheck:
1632
+ balancer.health[`${rule.forwardPort}/${rule.forwardProtocol}`],
1633
+ }),
1634
+ });
1635
+ }
1636
+
1637
+ // Rules that listen on the same port are rules of one listener
1638
+ const routes: Routing["routes"] = [];
1639
+ const listeners = new Map<string, InlineRule[]>();
1640
+ for (const rule of balancer.rules) {
1641
+ const id = listenerKey(rule.listenProtocol, rule.listenPort);
1642
+ listeners.set(id, [...(listeners.get(id) ?? []), rule]);
1643
+ }
1644
+ const actions = (rule?: InlineRule) => {
1645
+ if (!rule) return forbidden();
1646
+ if (rule.type === "redirect")
1647
+ return [
1648
+ {
1649
+ type: "redirect",
1650
+ redirect: {
1651
+ port: rule.redirectPort.toString(),
1652
+ protocol: rule.redirectProtocol.toUpperCase(),
1653
+ statusCode: "HTTP_301",
1654
+ },
1655
+ },
1656
+ ];
1657
+ return [
1658
+ {
1659
+ type: "forward",
1660
+ targetGroupArn: targets.get(
1661
+ targetKey(rule.container, rule.forwardProtocol, rule.forwardPort),
1662
+ )!.group.arn,
1663
+ },
1664
+ ];
1665
+ };
1666
+ for (const [id, rules] of listeners) {
1667
+ const protocol = rules[0].listenProtocol.toUpperCase();
1668
+ const listener = this.part("listener", id, {
1669
+ loadBalancerArn: loadBalancer.arn,
1670
+ port: rules[0].listenPort,
1671
+ protocol,
1672
+ certificateArn: ["HTTPS", "TLS"].includes(protocol)
1673
+ ? certificateArn
1674
+ : undefined,
1675
+ // What a request that matches no conditions gets
1676
+ defaultActions: actions(rules.find((rule) => !rule.conditions)),
1677
+ });
1678
+ routes.push(listener);
1679
+
1680
+ for (const rule of rules) {
1681
+ const conditions = rule.conditions;
1682
+ if (!conditions) continue;
1683
+ routes.push(
1684
+ this.part(
1685
+ "listenerRule",
1686
+ `${id}Rule${hashStringToPrettyString(
1687
+ JSON.stringify(conditions),
1688
+ 4,
1689
+ )}`,
1690
+ {
1691
+ listenerArn: listener.arn,
1692
+ actions: actions(rule),
1693
+ conditions: [
1694
+ {
1695
+ pathPattern: conditions.path
1696
+ ? { values: [conditions.path] }
1697
+ : undefined,
1698
+ queryStrings: conditions.query,
1699
+ httpHeader: conditions.header
1700
+ ? {
1701
+ httpHeaderName: conditions.header.name,
1702
+ values: conditions.header.values,
1703
+ }
1704
+ : undefined,
1705
+ },
1706
+ ],
1707
+ },
1708
+ ),
1709
+ );
1710
+ }
1711
+ }
1712
+
1713
+ if (domain) pointDomainAt(name, domain, loadBalancer, this.delegateOpts());
1714
+
1715
+ return {
1716
+ arn: loadBalancer.arn,
1717
+ url: domain
1718
+ ? interpolate`https://${domain.name}/`
1719
+ : interpolate`http://${loadBalancer.dnsName}`,
1720
+ targets: [...targets.values()],
1721
+ routes,
1722
+ };
1723
+ }
1724
+
1725
+ // A load balancer the service shares with others: an `Alb`. The service
1726
+ // adds a target group for each container port, and a listener rule for
1727
+ // each of its rules.
1728
+ private attachToAlb(balancer: SharedBalancer, vpc: Network): Routing {
1729
+ const name = this.componentName;
1730
+ const { alb } = balancer;
1731
+ // The load balancer has to be in the cluster's VPC. The target groups
1732
+ // are what's given the VPC, so they're what the check holds back.
1733
+ const vpcId = all([alb._vpc, vpc.id]).apply(([albVpcId, clusterVpcId]) => {
1734
+ if (albVpcId !== clusterVpcId)
1735
+ throw new VisibleError(
1736
+ `The ALB VPC "${albVpcId}" does not match the cluster VPC "${clusterVpcId}" in Service "${name}". The ALB and cluster must be in the same VPC.`,
1737
+ );
1738
+ return albVpcId;
1739
+ });
1740
+
1741
+ const targets = new Map<string, Target>();
1742
+ const routes: Routing["routes"] = [];
1743
+ for (const rule of balancer.rules) {
1744
+ const [listenPort, listenProtocol] = portOf(rule.listen);
1745
+ const [forwardPort, forwardProtocol] = portOf(rule.forward);
1746
+ const protocol = forwardProtocol.toUpperCase();
1747
+ const id = targetKey(rule.key, protocol, forwardPort);
1748
+ const target = targets.get(id) ?? {
1749
+ container: rule.container,
1750
+ port: forwardPort,
1751
+ group: this.part("target", id, {
1752
+ namePrefix: protocol,
1753
+ port: forwardPort,
1754
+ protocol,
1755
+ targetType: "ip",
1756
+ vpcId,
1757
+ healthCheck: output(
1758
+ balancer.health[`${forwardPort}/${forwardProtocol}`],
1759
+ ).apply((health) => ({
1760
+ path: health?.path ?? "/",
1761
+ interval: health?.interval ? toSeconds(health.interval) : 30,
1762
+ timeout: health?.timeout ? toSeconds(health.timeout) : 5,
1763
+ healthyThreshold: health?.healthyThreshold ?? 5,
1764
+ unhealthyThreshold: health?.unhealthyThreshold ?? 2,
1765
+ matcher: health?.successCodes ?? "200",
1766
+ })),
1767
+ }),
1768
+ };
1769
+ targets.set(id, target);
1770
+
1771
+ routes.push(
1772
+ this.part(
1773
+ "listenerRule",
1774
+ `${listenerKey(listenProtocol, listenPort)}P${rule.priority}`,
1775
+ {
1776
+ listenerArn: alb.getListener(listenProtocol, listenPort).arn,
1777
+ priority: rule.priority,
1778
+ actions: [{ type: "forward", targetGroupArn: target.group.arn }],
1779
+ conditions: [
1780
+ {
1781
+ pathPattern: rule.conditions.path
1782
+ ? { values: [rule.conditions.path] }
1783
+ : undefined,
1784
+ queryStrings: rule.conditions.query,
1785
+ httpHeader: rule.conditions.header
1786
+ ? output(rule.conditions.header).apply((h) => ({
1787
+ httpHeaderName: h.name,
1788
+ values: h.values,
1789
+ }))
1790
+ : undefined,
1791
+ },
1792
+ ],
1793
+ },
1794
+ ),
1795
+ );
1796
+ }
1797
+
1798
+ return {
1799
+ arn: alb.arn,
1800
+ url: interpolate`http://${alb.dnsName}`,
1801
+ targets: [...targets.values()],
1802
+ routes,
1803
+ };
1804
+ }
1805
+
1806
+ // Registers the service's tasks in the cluster's Cloud Map namespace, which
1807
+ // gives the service its host name. An SST VPC always has a namespace. For
1808
+ // a VPC passed in by its ids, whether it has one is known once they are.
1809
+ private createCloudmapService(
1810
+ vpc: Network,
1811
+ registry: ServiceArgs["serviceRegistry"],
1812
+ ) {
1813
+ const name = this.componentName;
1814
+ const part = this.partHandle("cloudmapService");
1815
+ const create = (namespaceId: Input<string>) =>
1816
+ new servicediscovery.Service(
1817
+ ...transformPart<servicediscovery.ServiceArgs>(
1818
+ part.transform,
1819
+ part.name,
1820
+ {
1821
+ name: `${name}.${$app.stage}.${$app.name}`,
1822
+ namespaceId,
1823
+ forceDestroy: true,
1824
+ dnsConfig: {
1825
+ namespaceId,
1826
+ dnsRecords: [
1827
+ ...(registry ? [{ ttl: 60, type: "SRV" }] : []),
1828
+ { ttl: 60, type: "A" },
1829
+ ],
1830
+ },
1831
+ },
1832
+ part.opts,
1833
+ ),
1834
+ );
1835
+
1836
+ const existing = part.existing as
1837
+ | servicediscovery.Service
1838
+ | Input<string>
1839
+ | undefined;
1840
+ const service: Output<servicediscovery.Service | undefined> =
1841
+ existing !== undefined
1842
+ ? output(
1843
+ existing instanceof servicediscovery.Service
1844
+ ? existing
1845
+ : servicediscovery.Service.get(part.name, existing, undefined, {
1846
+ parent: this,
1847
+ }),
1848
+ )
1849
+ : vpc.isSstVpc
1850
+ ? output(create(vpc.cloudmapNamespaceId.apply((id) => id!)))
1851
+ : // Given the output, not the id it holds: the output is what says
1852
+ // the namespace has to be there, and is removed after
1853
+ vpc.cloudmapNamespaceId.apply((id) =>
1854
+ id
1855
+ ? create(vpc.cloudmapNamespaceId.apply((id) => id!))
1856
+ : undefined,
1857
+ );
1858
+
1859
+ part.defer(() =>
1860
+ service.apply((service) => {
1861
+ if (!service)
1862
+ throw new VisibleError(
1863
+ `Cannot access "nodes.cloudmapService" for the "${name}" Service. Cloud Map is not configured for the cluster.`,
1864
+ );
1865
+ return service;
1866
+ }),
1867
+ );
1868
+ return service;
1869
+ }
1870
+
1871
+ /**
1872
+ * The URL of the service.
1873
+ *
1874
+ * If `loadBalancer.domain` is set, this is the URL with the custom domain.
1875
+ * Otherwise, it's the auto-generated load balancer URL.
1876
+ */
1877
+ public get url() {
1878
+ if (!this.reach.url)
1879
+ throw new VisibleError(
1880
+ "Cannot access the URL because no public ports are exposed.",
1881
+ );
1882
+ return this.reach.url;
1883
+ }
1884
+
1885
+ /**
1886
+ * The name of the Cloud Map service. This is useful for service discovery.
1887
+ */
1888
+ public get service() {
1889
+ // Made when it's read: it fails for a cluster with no Cloud Map namespace
1890
+ return this.reach.host.apply((host) => {
1891
+ if (!host)
1892
+ throw new VisibleError(
1893
+ `Cannot access the AWS Cloud Map service name for the "${this.componentName}" Service. Cloud Map is not configured for the cluster.`,
1894
+ );
1895
+ return host;
1896
+ });
1897
+ }
1898
+
1899
+ /**
1900
+ * Linking a service gives the linked resource its `url`, when it has a load balancer,
1901
+ * and its `service` host name.
1902
+ */
1903
+ public link() {
1904
+ return {
1905
+ properties: {
1906
+ url: this.reach.url,
1907
+ service: this.reach.host,
1908
+ },
1909
+ };
1910
+ }
1911
+ }
1912
+
1913
+ /** Where a service runs. */
1914
+ /** A container port that traffic is sent to. */
1915
+ type Target = { group: lb.TargetGroup; container: string; port: number };
1916
+
1917
+ /** What a load balancer gives the service, its own or one it shares. */
1918
+ type Routing = {
1919
+ arn: Output<string>;
1920
+ url: Output<string>;
1921
+ targets: Target[];
1922
+ /** The listeners and listener rules that send traffic to the targets. */
1923
+ routes: (lb.Listener | lb.ListenerRule)[];
1924
+ };
1925
+
1926
+ type InlineRule = ReturnType<typeof ruleOf>;
1927
+ type OwnBalancer = ReturnType<typeof ownBalancer>;
1928
+ type SharedBalancer = ReturnType<typeof sharedBalancer>;
1929
+
1930
+ // What the service is told about its load balancer, checked: one of its
1931
+ // own, or an `Alb` it's attached to
1932
+ function loadBalancerOf(
1933
+ name: string,
1934
+ given: ServiceArgs["loadBalancer"],
1935
+ containers: Container[],
1936
+ ) {
1937
+ const args = plain(given, `The "loadBalancer" of the "${name}" service`);
1938
+ if (!args) return undefined;
1939
+ return "instance" in args
1940
+ ? sharedBalancer(name, args, containers)
1941
+ : ownBalancer(name, args, containers);
1942
+ }
1943
+
1944
+ function ownBalancer(
1945
+ name: string,
1946
+ args: ServiceLoadBalancerArgs,
1947
+ containers: Container[],
1948
+ ) {
1949
+ const of = `the load balancer of the "${name}" service`;
1950
+ notAnOption(args, "ports", `It's "rules" now, in ${of}.`);
1951
+ const given = plain(args.rules, `The "rules" of ${of}`);
1952
+ if (!given?.length)
1953
+ throw new VisibleError(
1954
+ `You must provide the ports to expose via "loadBalancer.rules".`,
1955
+ );
1956
+ const rules = given.map((rule, i) =>
1957
+ ruleOf(rule, `Rule ${i + 1} of ${of}`, containers),
1958
+ );
1959
+
1960
+ // validate protocols are consistent
1961
+ const type = protocolType(rules[0].listenProtocol);
1962
+ if (rules.some((rule) => protocolType(rule.listenProtocol) !== type))
1963
+ throw new VisibleError(
1964
+ `Protocols must be either all http/https, or all tcp/udp/tcp_udp/tls.`,
1965
+ );
1966
+
1967
+ // validate certificate exists for https/tls protocol
1968
+ for (const rule of rules)
1969
+ if (["https", "tls"].includes(rule.listenProtocol) && !args.domain)
1970
+ throw new VisibleError(
1971
+ `You must provide a custom domain for ${rule.listenProtocol.toUpperCase()} protocol.`,
1972
+ );
1973
+
1974
+ const domain = domainOf(args.domain, of);
1975
+
1976
+ const health = Object.fromEntries(
1977
+ Object.entries(plain(args.health, `The "health" of ${of}`) ?? {}).map(
1978
+ ([port, check]) => {
1979
+ if (
1980
+ !rules.find(
1981
+ (rule) =>
1982
+ rule.type === "forward" &&
1983
+ `${rule.forwardPort}/${rule.forwardProtocol}` === port,
1984
+ )
1985
+ )
1986
+ throw new VisibleError(
1987
+ `Cannot configure health check for "${port}". Make sure it is defined in "loadBalancer.rules".`,
1988
+ );
1989
+ const http = protocolType(portOf(port)[1]) === "application";
1990
+ return [
1991
+ port,
1992
+ output(check).apply((check) => ({
1993
+ path: http ? check?.path ?? "/" : undefined,
1994
+ interval: check?.interval ? toSeconds(check.interval) : 30,
1995
+ timeout: check?.timeout
1996
+ ? toSeconds(check.timeout)
1997
+ : type === "application"
1998
+ ? 5
1999
+ : 6,
2000
+ healthyThreshold: check?.healthyThreshold ?? 5,
2001
+ unhealthyThreshold: check?.unhealthyThreshold ?? 2,
2002
+ protocol: http ? undefined : "TCP",
2003
+ matcher: http ? check?.successCodes ?? "200" : undefined,
2004
+ })),
2005
+ ];
2006
+ },
2007
+ ),
2008
+ );
2009
+
2010
+ return {
2011
+ type,
2012
+ public: withDefault(args.public, true),
2013
+ domain,
2014
+ rules,
2015
+ health,
2016
+ };
2017
+ }
2018
+
2019
+ // A rule of the service's own load balancer: where it listens, and whether
2020
+ // it forwards to a container or redirects
2021
+ function ruleOf(rule: ServiceRuleArgs, what: string, containers: Container[]) {
2022
+ // A rule decides a listener, a target group and a listener rule, and the
2023
+ // listener rule is named after its conditions
2024
+ plainDeep(rule, what);
2025
+ notAnOption(rule, "path", `It's "conditions: { path }" now.`);
2026
+ const [listenPort, listenProtocol] = portOf(rule.listen);
2027
+ const listen = {
2028
+ listenPort,
2029
+ listenProtocol,
2030
+ // The same three, in the same order, whatever was written: the listener
2031
+ // rule's name is made from them
2032
+ conditions: rule.conditions && {
2033
+ path: rule.conditions.path,
2034
+ query: rule.conditions.query,
2035
+ header: rule.conditions.header,
2036
+ },
2037
+ };
2038
+ if (protocolType(listenProtocol) === "network" && listen.conditions)
2039
+ throw new VisibleError(
2040
+ `Invalid rule conditions for listen protocol "${rule.listen}". Only "http" protocols support conditions.`,
2041
+ );
2042
+
2043
+ if (rule.redirect) {
2044
+ const [redirectPort, redirectProtocol] = portOf(rule.redirect);
2045
+ if (protocolType(listenProtocol) !== protocolType(redirectProtocol))
2046
+ throw new VisibleError(
2047
+ `The listen protocol "${rule.listen}" must match the redirect protocol "${rule.redirect}".`,
2048
+ );
2049
+ return {
2050
+ type: "redirect" as const,
2051
+ ...listen,
2052
+ redirectPort,
2053
+ redirectProtocol,
2054
+ };
2055
+ }
2056
+
2057
+ const container = containerOf(rule, what, containers);
2058
+ const [forwardPort, forwardProtocol] = portOf(rule.forward ?? rule.listen);
2059
+ if (protocolType(listenProtocol) !== protocolType(forwardProtocol))
2060
+ throw new VisibleError(
2061
+ `The listen protocol "${rule.listen}" must match the forward protocol "${rule.forward}".`,
2062
+ );
2063
+ return {
2064
+ type: "forward" as const,
2065
+ ...listen,
2066
+ forwardPort,
2067
+ forwardProtocol,
2068
+ container,
2069
+ };
2070
+ }
2071
+
2072
+ // The container a rule forwards to: the one it names, or the only one
2073
+ function containerOf(
2074
+ rule: { container?: string },
2075
+ what: string,
2076
+ containers: Container[],
2077
+ ) {
2078
+ const names = containers.map((container) => container.name);
2079
+ if (!rule.container) {
2080
+ if (names.length > 1)
2081
+ throw new VisibleError(
2082
+ `${what} has to name the "container" it forwards to. There's more than one: ${names.join(
2083
+ ", ",
2084
+ )}.`,
2085
+ );
2086
+ return names[0];
2087
+ }
2088
+ if (!names.includes(rule.container))
2089
+ throw new VisibleError(
2090
+ `${what} forwards to the container "${
2091
+ rule.container
2092
+ }", which isn't one of the service's: ${names.join(", ")}.`,
2093
+ );
2094
+ return rule.container;
2095
+ }
2096
+
2097
+ function sharedBalancer(
2098
+ name: string,
2099
+ args: ServiceAlbArgs,
2100
+ containers: Container[],
2101
+ ) {
2102
+ if (!(args.instance instanceof OriginalAlb || args.instance instanceof Alb))
2103
+ throw new VisibleError(
2104
+ `The "loadBalancer.instance" of the "${name}" service has to be an "Alb".`,
2105
+ );
2106
+ const rules = plain(
2107
+ args.rules,
2108
+ `The "rules" of the load balancer of the "${name}" service`,
2109
+ );
2110
+ if (!rules?.length)
2111
+ throw new VisibleError(
2112
+ `You must provide at least one rule in "loadBalancer.rules" when using an external ALB in Service "${name}".`,
2113
+ );
2114
+
2115
+ const of = `the load balancer of the "${name}" service`;
2116
+ const priorities = new Map<string, Set<number>>();
2117
+ const forwards = rules.map((rule, i) => {
2118
+ const container = containerOf(rule, `Rule ${i + 1} of ${of}`, containers);
2119
+
2120
+ if (!(rule.priority >= 1 && rule.priority <= 50000))
2121
+ throw new VisibleError(
2122
+ `Priority ${rule.priority} must be between 1 and 50000 in Service "${name}". When sharing an ALB, ensure non-overlapping priority ranges across services.`,
2123
+ );
2124
+ const taken = priorities.get(rule.listen) ?? new Set();
2125
+ if (taken.has(rule.priority))
2126
+ throw new VisibleError(
2127
+ `Duplicate priority ${rule.priority} on listener "${rule.listen}" in Service "${name}".`,
2128
+ );
2129
+ priorities.set(rule.listen, taken.add(rule.priority));
2130
+
2131
+ if (
2132
+ !rule.conditions?.path &&
2133
+ !rule.conditions?.query &&
2134
+ !rule.conditions?.header
2135
+ )
2136
+ throw new VisibleError(
2137
+ `At least one condition (path, query, or header) must be set for rules on an external ALB in Service "${name}".`,
2138
+ );
2139
+ // A rule that doesn't name its container has a target group named
2140
+ // after the service
2141
+ return { ...rule, container, key: rule.container ?? name };
2142
+ });
2143
+
2144
+ return {
2145
+ // An `Alb` is an application load balancer
2146
+ type: "application" as const,
2147
+ alb: args.instance,
2148
+ rules: forwards,
2149
+ health: (plain(args.health, `The "health" of ${of}`) ?? {}) as Record<
2150
+ string,
2151
+ Input<ServiceHealthCheckArgs> | undefined
2152
+ >,
2153
+ };
2154
+ }
2155
+
2156
+ // How the service scales. Which metrics it tracks decides which policies
2157
+ // are created.
2158
+ function scalingOf(
2159
+ name: string,
2160
+ given: ServiceArgs["scaling"],
2161
+ balancer: ReturnType<typeof loadBalancerOf>,
2162
+ ) {
2163
+ const scaling = plain(given, `The "scaling" of the "${name}" service`) ?? {};
2164
+ const target = (
2165
+ metric: "cpuUtilization" | "memoryUtilization" | "requestCount",
2166
+ ) =>
2167
+ plain(scaling[metric], `The "scaling.${metric}" of the "${name}" service`);
2168
+
2169
+ const requestCount = target("requestCount") ?? false;
2170
+ if (requestCount && balancer?.type !== "application")
2171
+ throw new VisibleError(
2172
+ `Request count scaling is only supported for http/https protocols.`,
2173
+ );
2174
+
2175
+ return {
2176
+ min: withDefault(scaling.min, 1),
2177
+ max: withDefault(scaling.max, 1),
2178
+ cpuUtilization: target("cpuUtilization") ?? 70,
2179
+ memoryUtilization: target("memoryUtilization") ?? 70,
2180
+ requestCount,
2181
+ scaleInCooldown: ifSet(scaling.scaleInCooldown, toSeconds),
2182
+ scaleOutCooldown: ifSet(scaling.scaleOutCooldown, toSeconds),
2183
+ };
2184
+ }
2185
+
2186
+ // How the service's tasks are split between Fargate and Fargate Spot
2187
+ function capacityStrategies(
2188
+ capacity: Exclude<Unwrap<ServiceArgs["capacity"]>, undefined>,
2189
+ ) {
2190
+ const { fargate, spot }: Exclude<typeof capacity, "spot"> =
2191
+ capacity === "spot"
2192
+ ? { spot: { weight: 1 }, fargate: { weight: 0 } }
2193
+ : capacity;
2194
+ const strategy = (capacityProvider: string, share: typeof fargate) =>
2195
+ share ? [{ capacityProvider, base: share.base, weight: share.weight }] : [];
2196
+ return [...strategy("FARGATE", fargate), ...strategy("FARGATE_SPOT", spot)];
2197
+ }
2198
+
2199
+ // "8080/http" as the port and the protocol
2200
+ function portOf(port: string): [number, string] {
2201
+ const [number, protocol] = port.split("/");
2202
+ return [parseInt(number), protocol];
2203
+ }
2204
+
2205
+ function protocolType(protocol: string) {
2206
+ return ["http", "https"].includes(protocol)
2207
+ ? ("application" as const)
2208
+ : ("network" as const);
2209
+ }