vybekiit 0.7.3 → 0.7.7

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 (203) hide show
  1. package/dist/bin.js +16607 -7527
  2. package/dist/global-skills/aws-cdk/SKILL.md +2 -1
  3. package/dist/global-skills/aws-cloudformation/SKILL.md +2 -1
  4. package/dist/global-skills/aws-serverless/SKILL.md +45 -44
  5. package/dist/global-skills/aws-serverless/assets/powertools-handler.py +2 -1
  6. package/dist/global-skills/aws-serverless/references/api-gateway.md +50 -470
  7. package/dist/global-skills/aws-serverless/references/architecture.md +47 -186
  8. package/dist/global-skills/aws-serverless/references/concurrency.md +44 -158
  9. package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
  10. package/dist/global-skills/aws-serverless/references/event-sources.md +72 -391
  11. package/dist/global-skills/aws-serverless/references/lambda.md +69 -428
  12. package/dist/global-skills/aws-serverless/references/orchestration.md +65 -384
  13. package/dist/global-skills/aws-serverless/references/production.md +78 -415
  14. package/dist/global-skills/aws-serverless/references/troubleshooting.md +92 -619
  15. package/dist/global-skills/claimable-postgres/SKILL.md +60 -49
  16. package/dist/global-skills/design-my-data/SKILL.md +2 -0
  17. package/dist/global-skills/eas-app-stores/SKILL.md +8 -0
  18. package/dist/global-skills/eas-app-stores/references/play-store.md +2 -0
  19. package/dist/global-skills/eas-hosting/SKILL.md +8 -0
  20. package/dist/global-skills/eas-observe/SKILL.md +30 -8
  21. package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
  22. package/dist/global-skills/eas-observe/references/metrics.md +54 -3
  23. package/dist/global-skills/eas-observe/references/queries.md +78 -17
  24. package/dist/global-skills/eas-observe/references/setup.md +164 -5
  25. package/dist/global-skills/eas-observe/references/third-party.md +136 -0
  26. package/dist/global-skills/eas-simulator/SKILL.md +63 -11
  27. package/dist/global-skills/eas-simulator/references/controllers.md +21 -2
  28. package/dist/global-skills/eas-simulator/references/run-your-app.md +16 -11
  29. package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -5
  30. package/dist/global-skills/eas-update-insights/SKILL.md +8 -0
  31. package/dist/global-skills/eas-workflows/SKILL.md +15 -10
  32. package/dist/global-skills/eas-workflows/scripts/package.json +2 -7
  33. package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +30 -0
  34. package/dist/global-skills/email-best-practices/README.md +63 -0
  35. package/dist/global-skills/email-best-practices/references/accessibility.md +189 -0
  36. package/dist/global-skills/email-best-practices/references/compliance.md +125 -0
  37. package/dist/global-skills/email-best-practices/references/deliverability.md +121 -0
  38. package/dist/global-skills/email-best-practices/references/email-capture.md +129 -0
  39. package/dist/global-skills/email-best-practices/references/email-types.md +173 -0
  40. package/dist/global-skills/email-best-practices/references/list-management.md +157 -0
  41. package/dist/global-skills/email-best-practices/references/marketing-emails.md +115 -0
  42. package/dist/global-skills/email-best-practices/references/sending-reliability.md +155 -0
  43. package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +418 -0
  44. package/dist/global-skills/email-best-practices/references/transactional-emails.md +92 -0
  45. package/dist/global-skills/email-best-practices/references/webhooks-events.md +167 -0
  46. package/dist/global-skills/email-best-practices/tests/README.md +35 -0
  47. package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +46 -0
  48. package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +48 -0
  49. package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +36 -0
  50. package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +52 -0
  51. package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +51 -0
  52. package/dist/global-skills/expo-animation/LICENSE +21 -0
  53. package/dist/global-skills/expo-animation/RECIPES.md +385 -0
  54. package/dist/global-skills/expo-animation/SKILL.md +267 -0
  55. package/dist/global-skills/expo-animation/agents/openai.yaml +4 -0
  56. package/dist/global-skills/expo-app-clip/SKILL.md +8 -0
  57. package/dist/global-skills/expo-brownfield/SKILL.md +8 -0
  58. package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +53 -4
  59. package/dist/global-skills/expo-data-fetching/SKILL.md +8 -0
  60. package/dist/global-skills/expo-design-system/SKILL.md +356 -0
  61. package/dist/global-skills/expo-design-system/agents/openai.yaml +4 -0
  62. package/dist/global-skills/expo-design-system/references/audit.md +185 -0
  63. package/dist/global-skills/expo-dev-client/SKILL.md +8 -0
  64. package/dist/global-skills/expo-dom/SKILL.md +8 -0
  65. package/dist/global-skills/expo-examples/SKILL.md +8 -0
  66. package/dist/global-skills/expo-migrate-module/SKILL.md +113 -0
  67. package/dist/global-skills/expo-migrate-module/agents/openai.yaml +4 -0
  68. package/dist/global-skills/expo-migrate-module/references/compatibility.md +73 -0
  69. package/dist/global-skills/expo-migrate-module/references/example.md +212 -0
  70. package/dist/global-skills/expo-migrate-module/references/migration-map.md +306 -0
  71. package/dist/global-skills/expo-module/SKILL.md +11 -1
  72. package/dist/global-skills/expo-native-ui/SKILL.md +8 -0
  73. package/dist/global-skills/expo-project-structure/SKILL.md +114 -0
  74. package/dist/global-skills/expo-project-structure/agents/openai.yaml +4 -0
  75. package/dist/global-skills/expo-router/SKILL.md +8 -0
  76. package/dist/global-skills/expo-skill-feedback/SKILL.md +66 -33
  77. package/dist/global-skills/expo-skill-feedback/agents/openai.yaml +2 -2
  78. package/dist/global-skills/expo-tailwind-setup/SKILL.md +8 -0
  79. package/dist/global-skills/expo-ui/SKILL.md +8 -0
  80. package/dist/global-skills/expo-upgrade/SKILL.md +15 -1
  81. package/dist/global-skills/expo-web-to-native/SKILL.md +8 -0
  82. package/dist/global-skills/extension-to-functions-codebase/SKILL.md +129 -0
  83. package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md +161 -0
  84. package/dist/global-skills/extension-to-functions-codebase/references/destructuring-shim.md +122 -0
  85. package/dist/global-skills/extension-to-functions-codebase/references/signature-mapping.md +84 -0
  86. package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +61 -19
  87. package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +6 -3
  88. package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
  89. package/dist/global-skills/firebase-auth-basics/SKILL.md +4 -2
  90. package/dist/global-skills/firebase-basics/SKILL.md +5 -5
  91. package/dist/global-skills/firebase-crashlytics/SKILL.md +2 -0
  92. package/dist/global-skills/firebase-data-connect/SKILL.md +2 -0
  93. package/dist/global-skills/firebase-firestore/SKILL.md +3 -6
  94. package/dist/global-skills/firebase-hosting-basics/SKILL.md +4 -1
  95. package/dist/global-skills/firebase-remote-config-basics/SKILL.md +5 -1
  96. package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +4 -1
  97. package/dist/global-skills/harden/SKILL.md +2 -1
  98. package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
  99. package/dist/global-skills/instrument-feature-flags/references/COMMANDMENTS.md +5 -0
  100. package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +6 -4
  101. package/dist/global-skills/instrument-feature-flags/references/android.md +6 -4
  102. package/dist/global-skills/instrument-feature-flags/references/api.md +6 -4
  103. package/dist/global-skills/instrument-feature-flags/references/best-practices.md +6 -4
  104. package/dist/global-skills/instrument-feature-flags/references/django.md +38 -5
  105. package/dist/global-skills/instrument-feature-flags/references/dotnet.md +10 -4
  106. package/dist/global-skills/instrument-feature-flags/references/elixir.md +6 -4
  107. package/dist/global-skills/instrument-feature-flags/references/flask.md +17 -5
  108. package/dist/global-skills/instrument-feature-flags/references/flutter.md +7 -5
  109. package/dist/global-skills/instrument-feature-flags/references/go.md +6 -4
  110. package/dist/global-skills/instrument-feature-flags/references/ios.md +6 -4
  111. package/dist/global-skills/instrument-feature-flags/references/java.md +6 -4
  112. package/dist/global-skills/instrument-feature-flags/references/laravel.md +6 -4
  113. package/dist/global-skills/instrument-feature-flags/references/next-js.md +74 -8
  114. package/dist/global-skills/instrument-feature-flags/references/nodejs.md +6 -4
  115. package/dist/global-skills/instrument-feature-flags/references/php.md +6 -4
  116. package/dist/global-skills/instrument-feature-flags/references/python.md +6 -4
  117. package/dist/global-skills/instrument-feature-flags/references/react-native.md +6 -4
  118. package/dist/global-skills/instrument-feature-flags/references/react.md +6 -4
  119. package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +6 -4
  120. package/dist/global-skills/instrument-feature-flags/references/ruby.md +6 -4
  121. package/dist/global-skills/instrument-feature-flags/references/rust.md +6 -4
  122. package/dist/global-skills/instrument-feature-flags/references/usage.md +41 -4
  123. package/dist/global-skills/instrument-feature-flags/references/web.md +7 -5
  124. package/dist/global-skills/instrument-product-analytics/SKILL.md +2 -1
  125. package/dist/global-skills/instrument-product-analytics/references/COMMANDMENTS.md +5 -0
  126. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +12 -14
  127. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +25 -21
  128. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-django.md +75 -55
  129. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-fastapi.md +3 -6
  130. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-flask.md +26 -16
  131. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-3-6.md +8 -5
  132. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-4.md +4 -4
  133. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-react-react-router-7-framework.md +3 -3
  134. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +8 -4
  135. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-tanstack-start.md +20 -8
  136. package/dist/global-skills/instrument-product-analytics/references/android.md +46 -4
  137. package/dist/global-skills/instrument-product-analytics/references/angular.md +41 -5
  138. package/dist/global-skills/instrument-product-analytics/references/astro.md +41 -5
  139. package/dist/global-skills/instrument-product-analytics/references/configuration.md +7 -4
  140. package/dist/global-skills/instrument-product-analytics/references/django.md +38 -5
  141. package/dist/global-skills/instrument-product-analytics/references/dotnet.md +10 -4
  142. package/dist/global-skills/instrument-product-analytics/references/elixir.md +6 -4
  143. package/dist/global-skills/instrument-product-analytics/references/flask.md +17 -5
  144. package/dist/global-skills/instrument-product-analytics/references/flutter.md +49 -4
  145. package/dist/global-skills/instrument-product-analytics/references/go.md +6 -4
  146. package/dist/global-skills/instrument-product-analytics/references/identify-users.md +38 -7
  147. package/dist/global-skills/instrument-product-analytics/references/ios.md +14 -4
  148. package/dist/global-skills/instrument-product-analytics/references/laravel.md +6 -4
  149. package/dist/global-skills/instrument-product-analytics/references/next-js.md +74 -8
  150. package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +39 -7
  151. package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +40 -4
  152. package/dist/global-skills/instrument-product-analytics/references/php.md +6 -4
  153. package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +21 -17
  154. package/dist/global-skills/instrument-product-analytics/references/python.md +15 -5
  155. package/dist/global-skills/instrument-product-analytics/references/react-native.md +41 -7
  156. package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +18 -4
  157. package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +18 -4
  158. package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +18 -4
  159. package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +18 -4
  160. package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +6 -4
  161. package/dist/global-skills/instrument-product-analytics/references/ruby.md +6 -4
  162. package/dist/global-skills/instrument-product-analytics/references/svelte.md +42 -6
  163. package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +31 -7
  164. package/dist/global-skills/instrument-product-analytics/references/usage.md +41 -4
  165. package/dist/global-skills/instrument-product-analytics/references/vue-js.md +42 -6
  166. package/dist/global-skills/manifest.json +6 -1
  167. package/dist/global-skills/neon/SKILL.md +235 -121
  168. package/dist/global-skills/neon-ai-gateway/SKILL.md +95 -16
  169. package/dist/global-skills/neon-functions/SKILL.md +242 -152
  170. package/dist/global-skills/neon-functions/references/ai-sdk.md +9 -3
  171. package/dist/global-skills/neon-functions/references/mastra-studio.md +1 -1
  172. package/dist/global-skills/neon-functions/references/mcp.md +13 -4
  173. package/dist/global-skills/neon-functions/references/sentry.md +165 -52
  174. package/dist/global-skills/neon-functions/references/sse.md +23 -6
  175. package/dist/global-skills/neon-object-storage/SKILL.md +40 -16
  176. package/dist/global-skills/neon-postgres/SKILL.md +63 -262
  177. package/dist/global-skills/neon-postgres-branches/SKILL.md +61 -50
  178. package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +22 -3
  179. package/dist/global-skills/resend/SKILL.md +6 -6
  180. package/dist/global-skills/resend/references/automations.md +2 -2
  181. package/dist/global-skills/resend/references/broadcasts.md +11 -3
  182. package/dist/global-skills/resend/references/domains.md +25 -3
  183. package/dist/global-skills/resend/references/installation.md +7 -7
  184. package/dist/global-skills/setup-payments/SKILL.md +4 -5
  185. package/dist/global-skills/stripe-best-practices/SKILL.md +32 -7
  186. package/dist/global-skills/stripe-best-practices/references/billing.md +11 -1
  187. package/dist/global-skills/stripe-best-practices/references/payments.md +23 -2
  188. package/dist/global-skills/stripe-best-practices/references/security.md +21 -11
  189. package/dist/global-skills/stripe-best-practices/references/tax.md +116 -11
  190. package/dist/global-skills/supabase/CHANGELOG.md +25 -0
  191. package/dist/global-skills/supabase/SKILL.md +5 -1
  192. package/dist/global-skills/supabase-postgres-best-practices/CHANGELOG.md +30 -0
  193. package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -1
  194. package/dist/global-skills/use-kit-mcp/SKILL.md +5 -5
  195. package/dist/global-skills/use-railway/SKILL.md +4 -4
  196. package/dist/global-skills/use-railway/references/iac.md +206 -57
  197. package/dist/global-skills/use-railway/scripts/railway-api.sh +7 -2
  198. package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
  199. package/package.json +12 -9
  200. package/LICENSE.md +0 -47
  201. package/dist/global-skills/eas-workflows/scripts/validate.js +0 -84
  202. package/dist/global-skills/expo-skill-feedback/scripts/skill-feedback.cjs +0 -118
  203. package/dist/global-skills/neon-functions/references/hono-websockets.md +0 -145
@@ -1,16 +1,15 @@
1
1
  # AWS Lambda Reference
2
2
 
3
- Specific values, limits, constraints, and code that complement general Lambda knowledge.
3
+ Quotas, constraints, and gotchas that are easy to get wrong. Assumes you already know Lambda basics (packaging, layer paths, VPC-has-no-public-IP, Graviton ≈ 34% better price-performance, Powertools APIs) — this file focuses on the values and edge cases that trip up implementations.
4
4
 
5
5
  ## Contents
6
6
 
7
7
  - [Cold Start Optimization](#cold-start-optimization)
8
- - [Packaging](#packaging)
9
8
  - [Memory and Timeout Tuning](#memory-and-timeout-tuning)
10
9
  - [VPC Connectivity](#vpc-connectivity)
11
- - [Execution Roles](#execution-roles)
12
10
  - [Runtime Lifecycle](#runtime-lifecycle)
13
- - [Powertools for AWS Lambda](#powertools-for-aws-lambda)
11
+ - [Function URLs](#function-urls)
12
+ - [Powertools and Packaging](#powertools-and-packaging)
14
13
 
15
14
  ---
16
15
 
@@ -21,28 +20,23 @@ Specific values, limits, constraints, and code that complement general Lambda kn
21
20
  Snapshots the initialized execution environment (Firecracker microVM memory + disk) and restores from cache instead of cold-booting.
22
21
 
23
22
  **Supported runtimes:** Java 11+, Python 3.12+, .NET 8+
24
- **NOT supported:** Node.js, Ruby, container images, OS-only runtimes
25
23
 
26
24
  **Constraints:**
27
25
 
28
- - Mutually exclusive with Provisioned Concurrency
26
+ - **Mutually exclusive with Provisioned Concurrency** (cannot set both on one function)
29
27
  - Mutually exclusive with Amazon EFS
30
28
  - Ephemeral storage must be ≤ 512 MB
31
29
  - Only works on published versions (not `$LATEST`)
32
- - Java: no additional SnapStart overhead
33
- - Python/.NET: caching charge (based on memory, minimum 3 hours) + per-restore charge
30
+ - Java: no additional SnapStart charge. Python/.NET: caching charge (by memory, min 3 hours) + per-restore charge
34
31
 
35
- **Restoration considerations:**
32
+ **Restoration gotchas** (snapshot is reused across restores):
36
33
 
37
- - Generate unique IDs/secrets in the handler, not during init (snapshot reuse)
34
+ - Generate unique IDs/secrets in the handler, not during init
38
35
  - Re-establish network connections in the handler (connections are stale after restore)
39
36
  - Refresh cached timestamps/credentials in the handler
40
37
 
41
- **CDK example (Python):**
42
-
43
38
  ```python
44
- from aws_cdk import aws_lambda as lambda_
45
-
39
+ # CDK (Python)
46
40
  fn = lambda_.Function(self, "MyFunction",
47
41
  runtime=lambda_.Runtime.PYTHON_3_13,
48
42
  handler="index.handler",
@@ -57,492 +51,139 @@ version = fn.current_version
57
51
  Pre-initializes execution environments that stay warm permanently.
58
52
 
59
53
  - A single instance handles one concurrent request at a time; throughput per instance = 1 / function duration
60
- - Account-level RPS quota: 10 × total concurrency (applies across all invocations, not per instance)
61
- - Supports auto-scaling via Application Auto Scaling
54
+ - **Account-level RPS quota: 10 × total concurrency** (applies across all invocations, not per instance)
55
+ - Supports auto-scaling via Application Auto Scaling (target ~70% utilization)
62
56
  - Lambda can scale beyond provisioned count using on-demand instances
63
57
  - **Paid even when idle** — disable in dev/staging
64
58
 
65
- ```typescript
66
- const fn = new lambda.Function(this, 'MyFunction', {
67
- runtime: lambda.Runtime.NODEJS_22_X,
68
- handler: 'index.handler',
69
- code: lambda.Code.fromAsset('lambda'),
70
- });
71
-
72
- const version = fn.currentVersion;
73
- const alias = new lambda.Alias(this, 'ProdAlias', {
74
- aliasName: 'prod',
75
- version,
76
- provisionedConcurrentExecutions: 10,
77
- });
78
- ```
79
-
80
- ### Graviton (arm64)
81
-
82
- - **Up to 34% better price-performance** compared to x86 (per AWS)
83
- - Supported for all Lambda managed runtimes
84
- - Set `architecture: lambda_.Architecture.ARM_64` in CDK
85
-
86
59
  ### Strategy Selection
87
60
 
88
61
  | Scenario | Strategy |
89
62
  |---|---|
90
63
  | Java/Python/.NET with heavy init | SnapStart |
91
- | Strict <50ms cold start | Provisioned Concurrency |
64
+ | Strict <50ms cold start, or need EFS / >512MB ephemeral | Provisioned Concurrency |
92
65
  | Tolerant of occasional cold starts | On-demand + minimize package |
93
66
  | Predictable traffic | Provisioned Concurrency + auto-scaling |
94
67
  | General optimization | arm64 (Graviton) |
95
68
 
96
69
  ---
97
70
 
98
- ## Packaging
99
-
100
- ### Decision Tree
101
-
102
- ```
103
- Need > 250 MB uncompressed?
104
- └─ YES → Container image (up to 10 GB)
105
- └─ NO
106
- ├─ Sharing deps across multiple functions?
107
- │ └─ YES → Lambda layers
108
- └─ NO
109
- ├─ Simple function, few deps → .zip
110
- └─ Native binaries, complex build → Container image
111
- ```
112
-
113
- ### Size Limits
114
-
115
- | Package Type | Limit |
116
- |---|---|
117
- | .zip compressed | 50 MB |
118
- | .zip uncompressed (including layers) | 250 MB |
119
- | Container image | 10 GB |
120
- | Layers per function | 5 |
121
-
122
- ### Layer Paths by Runtime
123
-
124
- | Runtime | Layer Path |
125
- |---|---|
126
- | Python | `python/` or `python/lib/python3.x/site-packages/` |
127
- | Node.js | `nodejs/node_modules/` |
128
- | Java | `java/lib/` |
129
- | Ruby | `ruby/gems/3.4.0/` or `ruby/lib/` |
130
- | All runtimes | `bin/` (PATH), `lib/` (LD_LIBRARY_PATH) |
131
-
132
- **Layer constraints:**
133
-
134
- - Layers count toward the 250 MB unzipped limit
135
- - Layers only work with .zip deployments, NOT container images
136
- - Not recommended for Go/Rust — bundle deps in the deployment package
137
- - Multiple layers with conflicting dependency versions cause subtle bugs; merge order matters
138
-
139
- ### Container Image Dockerfile
140
-
141
- ```dockerfile
142
- FROM public.ecr.aws/lambda/python:3.13
143
-
144
- COPY requirements.txt .
145
- RUN pip install -r requirements.txt
146
-
147
- COPY app.py ${LAMBDA_TASK_ROOT}
148
-
149
- CMD ["app.handler"]
150
- ```
151
-
152
- - Use official AWS base images from `public.ecr.aws/lambda/`
153
- - Container images do NOT support Lambda layers
154
- - SnapStart is NOT supported with container images
155
-
156
- ### Python Build Tips
157
-
158
- Use `uv` for dependency installation — **10-100x faster than pip**:
159
-
160
- ```bash
161
- uv pip install -r requirements.txt --target ./package
162
- ```
163
-
164
- Cross-platform build flags (when building on non-Linux):
165
-
166
- ```bash
167
- pip install -r requirements.txt \
168
- --target ./package \
169
- --platform manylinux2014_x86_64 \
170
- --only-binary=:all:
171
- ```
172
-
173
- Use `manylinux2014_aarch64` for arm64. Exclude `__pycache__`, `.pyc`, tests, docs.
174
-
175
- ---
176
-
177
71
  ## Memory and Timeout Tuning
178
72
 
179
- ### Memory
73
+ ### Memory → CPU
180
74
 
181
75
  | Parameter | Value |
182
76
  |---|---|
183
- | Minimum | 128 MB |
184
- | Maximum | 10,240 MB (10 GB) |
185
- | Increment | 1 MB |
186
- | Default | 128 MB |
187
- | 1 vCPU at | 1,769 MB |
77
+ | Range | 128 MB – 10,240 MB (1 MB increments), default 128 MB |
78
+ | **1 vCPU at** | **1,769 MB** |
188
79
  | ~5.8 vCPUs at | 10,240 MB |
189
80
 
190
- CPU scales linearly with memory. Doubling memory doubles CPU. **Over-provisioning memory can improve performance** faster execution = less total duration.
191
-
192
- **Tuning process:**
81
+ CPU scales linearly with memory doubling memory doubles CPU. **Over-provisioning memory often lowers cost** (faster execution = less billed duration). Start at 256–512 MB; tune with [AWS Lambda Power Tuning](https://github.com/alexcasalboni/aws-lambda-power-tuning) against `Max Memory Used` in REPORT lines.
193
82
 
194
- 1. Start at 256–512 MB (128 MB only for trivial event routers)
195
- 2. Monitor `Max Memory Used` in CloudWatch REPORT lines
196
- 3. Use **AWS Lambda Power Tuning** (open-source Step Functions tool):
83
+ ### Ephemeral storage (/tmp)
197
84
 
198
- ```bash
199
- aws stepfunctions start-execution \
200
- --state-machine-arn arn:aws:states:REGION:ACCOUNT:stateMachine:powerTuningStateMachine \
201
- --input '{
202
- "lambdaARN": "arn:aws:lambda:REGION:ACCOUNT:function:my-function",
203
- "powerValues": [128, 256, 512, 1024, 1769, 3008],
204
- "num": 50,
205
- "payload": "{\"test\": true}"
206
- }'
207
- ```
208
-
209
- ### Ephemeral Storage (/tmp)
210
-
211
- | Parameter | Value |
212
- |---|---|
213
- | Minimum / Default | 512 MB |
214
- | Maximum | 10,240 MB (10 GB) |
215
- | Extra cost | Above 512 MB |
216
-
217
- - Content **persists across warm invocations** (use as transient cache)
218
- - Content is NOT cleared after invoke failures
219
- - SnapStart requires ≤ 512 MB ephemeral storage
85
+ - 512 MB (default/min) – 10,240 MB; extra cost above 512 MB
86
+ - Persists across warm invocations (transient cache); NOT cleared after invoke failures
87
+ - SnapStart requires ≤ 512 MB
220
88
 
221
89
  ### Timeout
222
90
 
223
- | Parameter | Value |
224
- |---|---|
225
- | Minimum | 1 second |
226
- | Maximum | 900 seconds (15 minutes) |
227
- | Default | 3 seconds |
91
+ - Range 1s 900s (15 min); **default is 3s** — always set it explicitly
228
92
 
229
93
  **Critical integration limits:**
230
94
 
231
- - API Gateway REST API: **29s default** (adjustable for Regional/private APIs since June 2024; edge-optimized remains 29s max)
232
- - API Gateway HTTP API: **30-second hard limit**
233
- - SQS visibility timeout must be **≥ 6× function timeout** (AWS recommendation)
95
+ - **API Gateway REST API: 29s default** adjustable higher for Regional/private APIs; **edge-optimized remains 29s max**
96
+ - **API Gateway HTTP API: 30s hard limit** (cannot be raised)
97
+ - SQS visibility timeout should be **≥ 6× function timeout**
234
98
 
235
- ### Other Limits
99
+ ### Other limits worth knowing
236
100
 
237
101
  | Resource | Limit |
238
102
  |---|---|
239
- | Environment variables (total) | 4 KB |
240
103
  | Sync invocation payload (request/response) | 6 MB each |
241
104
  | Async invocation payload | 1 MB |
242
- | Streamed response | 200 MB (first 6 MB uncapped, then 2 MBps) |
243
- | File descriptors | 1,024 |
244
- | Processes/threads | 1,024 |
245
- | Concurrent executions (default) | 1,000 per region (soft limit) |
246
- | Scaling rate | 1,000 new environments every 10s per function |
247
- | Function code storage (.zip) | 75 GB per region (soft limit) |
105
+ | Streamed response | 200 MB (2 MBps after first 6 MB) |
106
+ | Environment variables (total) | 4 KB |
107
+ | Concurrent executions (default) | 1,000 per region (soft) |
108
+ | Scaling rate | 1,000 new environments / 10s, per function |
248
109
 
249
110
  ---
250
111
 
251
112
  ## VPC Connectivity
252
113
 
253
- ### Hyperplane ENI
254
-
255
- Lambda uses **Hyperplane Elastic Network Interfaces** (shared, not per-function):
256
-
257
- - Shared across functions using the same subnet + security group combination
258
- - Each ENI supports **65,000 connections/ports**
259
- - First-time ENI creation: **several minutes** (function stays in `Pending`)
260
- - ENIs reclaimed after **14 days of inactivity** (function goes `Inactive`)
261
- - Removing VPC config takes up to **20 minutes** for ENI cleanup
262
- - Default quota: **500 Hyperplane ENIs per VPC** (Lambda-specific soft limit, can be increased). The broader VPC ENI service quota is **5,000 per region** by default.
263
-
264
- ### Internet Access Patterns
265
-
266
- **Lambda in a VPC NEVER gets a public IP**, even in a public subnet.
267
-
268
- **Pattern 1: Private Subnet + NAT Gateway** (most common)
269
-
270
- ```
271
- Lambda → Private Subnet → Route Table → NAT Gateway → IGW → Internet
272
- ```
273
-
274
- - Deploy in each AZ for HA
275
-
276
- **Pattern 2: VPC Endpoints** (for AWS services)
277
-
278
- ```
279
- Lambda → Private Subnet → VPC Endpoint → AWS Service
280
- ```
281
-
282
- - **Gateway endpoints:** S3, DynamoDB
283
- - **Interface endpoints:** STS, Secrets Manager, SQS, etc.
284
- - Traffic stays on AWS network — lower latency
114
+ Lambda uses **Hyperplane ENIs** — shared across functions that use the same subnet + security group combination (NOT per-function). Each ENI supports ~65,000 connections.
285
115
 
286
- #### Pattern 3: IPv6 Egress-Only Internet Gateway
116
+ - First-time ENI creation can take **several minutes** (function stays `Pending`)
117
+ - ENIs reclaimed after **14 days of inactivity** (function goes `Inactive`); removing VPC config takes up to **20 minutes**
287
118
 
288
- ```
289
- Lambda → Dual-Stack Subnet → Egress-Only IGW → Internet (IPv6)
290
- ```
291
-
292
- - Eliminates NAT Gateway for IPv6 traffic
293
- - Requires dual-stack subnets and IPv6-capable endpoints
294
- - Set `Ipv6AllowedForDualStack=true` in function config
295
-
296
- ### Required IAM Permissions
297
-
298
- VPC-attached functions need `AWSLambdaVPCAccessExecutionRole` managed policy or equivalent EC2 network interface permissions.
299
-
300
- ### Best Practices
301
-
302
- - Reuse subnet + security group combos across functions to share ENIs
303
- - Use multiple subnets across AZs for HA
304
- - Prefer VPC endpoints over NAT Gateway for AWS service access
305
- - Don't attach to VPC unless accessing private resources (RDS, ElastiCache, etc.)
306
-
307
- ---
308
-
309
- ## Execution Roles
310
-
311
- One execution role per function. Key Lambda-specific managed policies:
312
-
313
- | Policy | Grants |
314
- |---|---|
315
- | `AWSLambdaBasicExecutionRole` | CloudWatch Logs only |
316
- | `AWSLambdaVPCAccessExecutionRole` | VPC ENI management |
317
- | `AWSLambdaDynamoDBExecutionRole` | DynamoDB Streams |
318
- | `AWSLambdaSQSQueueExecutionRole` | SQS polling |
319
- | `AWSLambdaKinesisExecutionRole` | Kinesis Streams |
119
+ Reuse subnet + SG combos to share ENIs. Prefer **VPC endpoints** (gateway: S3, DynamoDB; interface: STS, Secrets Manager, SQS, …) over NAT Gateway for AWS-service access — lower latency, traffic stays on the AWS backbone. Don't attach to a VPC unless you need private resources (RDS, ElastiCache). VPC-attached functions need `AWSLambdaVPCAccessExecutionRole`.
320
120
 
321
121
  ---
322
122
 
323
123
  ## Runtime Lifecycle
324
124
 
325
- ### Phases
326
-
327
125
  ```
328
- ┌─────────┐ ┌─────────┐ ┌──────────┐
329
- │ INIT │───▶│ INVOKE │───▶│ SHUTDOWN │
330
- │ │ │(repeat) │ │ │
331
- └─────────┘ └─────────┘ └──────────┘
126
+ INIT ──▶ INVOKE (repeat) ──▶ SHUTDOWN [+ RESTORE phase for SnapStart]
332
127
  ```
333
128
 
334
- **Init Phase** (3 sub-phases: extension init → runtime init → function init):
335
-
336
- - On-demand timeout: **10 seconds**
337
- - Provisioned/SnapStart timeout: **up to 15 minutes**
338
- - If init exceeds 10s on-demand, Lambda retries at first invocation using the function's configured timeout
339
-
340
- **Invoke Phase:**
129
+ **Init phase** (extension init → runtime init → function init):
341
130
 
342
- - Limited by function timeout (max 900s)
343
- - Each environment handles **one concurrent invocation** at a time
131
+ - **On-demand init timeout: 10s.** If exceeded, Lambda retries at first invocation using the function's configured timeout.
132
+ - **Provisioned/SnapStart init timeout: up to 15 minutes.**
344
133
 
345
- **Shutdown Phase:**
134
+ **Shutdown phase:** 0 ms (no extensions), 500 ms (internal only), 2,000 ms (external extensions); SIGKILL if not done in time.
346
135
 
347
- - 0 ms (no extensions), 500 ms (internal only), 2,000 ms (external extensions)
348
- - SIGKILL if extensions don't respond in time
136
+ **Restore phase (SnapStart):** 10s timeout for restore + after-restore hooks.
349
137
 
350
- **Restore Phase** (SnapStart only):
138
+ ### Warm-start reuse
351
139
 
352
- - Resumes from cached snapshot
353
- - 10-second timeout for restore + after-restore hooks
140
+ Objects initialized outside the handler persist across invocations (SDK clients, DB connections, `/tmp`). Gotchas:
354
141
 
355
- ### Execution Environment Reuse (Warm Starts)
356
-
357
- Objects initialized outside the handler persist across invocations:
358
-
359
- - SDK clients, DB connections, cached data all survive
360
- - `/tmp` content persists (512 MB–10 GB)
361
- - Background processes resume on next invocation
362
- - **Workers have a maximum lease lifetime of ~14 hours** (observed behavior, not a documented SLA — do not depend on this value)
363
- - Environments terminated periodically for maintenance even under continuous load
364
-
365
- **Common pitfall:** Global variables persist — stale DB connections, expired credentials, and leaked state across invocations cause subtle production bugs.
366
-
367
- ### Extensions
368
-
369
- - **Internal:** Run in the runtime process (APM agents)
370
- - **External:** Separate processes alongside the runtime
371
- - Use Extensions API and Telemetry API for lifecycle events, logs, metrics, traces
142
+ - **Execution environments are recycled periodically** for maintenance even under continuous load — never assume an environment (or its warmed state) lives indefinitely.
143
+ - **Global variables persist** — stale DB connections, expired credentials, and leaked state across invocations cause subtle production bugs. Refresh connections/credentials in the handler.
372
144
 
373
145
  ---
374
146
 
375
- ## Powertools for AWS Lambda
376
-
377
- Official AWS toolkit for Lambda best practices. Available for Python, TypeScript, Java, .NET.
378
-
379
- **Performance note:** Powertools adds cold start overhead. Use selective imports when cold start matters:
147
+ ## Function URLs
380
148
 
381
- ```python
382
- # Instead of: from aws_lambda_powertools import Logger, Tracer, Metrics
383
- # Import only what you need if cold start is critical
384
- from aws_lambda_powertools import Logger
385
- ```
149
+ A Function URL is a dedicated HTTPS endpoint on a single function — no API Gateway. Use for internal service-to-service (IAM auth), Lambdalith + CloudFront, response streaming, or webhook receivers. There's **no built-in rate limiting, WAF, or request validation** (front with CloudFront/API Gateway if you need those). Choose **API Gateway** instead for public APIs needing rate limiting, JWT/Cognito auth, multi-function routing, request validation, or WAF without CloudFront.
386
150
 
387
- ### Core Utilities
388
-
389
- | Utility | Purpose |
390
- |---|---|
391
- | Logger | Structured JSON logging with correlation IDs |
392
- | Tracer | X-Ray tracing with decorators/middleware |
393
- | Metrics | CloudWatch metrics via Embedded Metric Format (EMF) |
394
- | Idempotency | Make handlers idempotent using DynamoDB |
395
- | Batch Processing | Partial failure handling for SQS, Kinesis, DynamoDB Streams |
396
- | Event Handler | Routing for API Gateway, ALB, Function URLs, AppSync |
397
- | Parameters | Retrieve/cache SSM, Secrets Manager, AppConfig, DynamoDB values |
151
+ Invoking a Function URL **always requires `lambda:InvokeFunctionUrl` and `lambda:InvokeFunction`** — granting only `InvokeFunctionUrl` returns **HTTP 403** even with `AuthType=NONE`. The two `AuthType` options differ in *how* those permissions are supplied:
398
152
 
399
- ### Environment Variables
153
+ ### `AuthType=AWS_IAM` (non-public — prefer for production)
400
154
 
401
- | Variable | Purpose |
402
- |---|---|
403
- | `POWERTOOLS_SERVICE_NAME` | Service name for logs, metrics, traces |
404
- | `POWERTOOLS_METRICS_NAMESPACE` | CloudWatch metrics namespace |
405
- | `POWERTOOLS_LOG_LEVEL` | Logging level (DEBUG, INFO, WARNING, ERROR) |
406
- | `POWERTOOLS_TRACE_DISABLED` | Disable tracing (useful for tests) |
407
- | `POWERTOOLS_DEV` | Dev mode (pretty-print JSON, verbose errors) |
155
+ Only callers with valid AWS credentials that sign requests with **SigV4** can invoke; unauthenticated requests get **403**.
408
156
 
409
- ### Python: Logger + Tracer + Metrics
157
+ - **Same-account caller:** grant the two actions in the caller's **identity-based policy** *or* the function's resource-based policy — a resource-based policy is **optional** if the caller's identity policy already allows them (this is why an admin/broad identity policy invokes with no resource policy on the function).
158
+ - **Cross-account caller:** requires **both** an identity-based policy on the caller **and** a resource-based policy on the function.
159
+ - For CloudFront in front, use **Origin Access Control** to sign requests rather than `NONE`.
410
160
 
411
- ```python
412
- from aws_lambda_powertools import Logger, Tracer, Metrics
413
- from aws_lambda_powertools.metrics import MetricUnit
414
- from aws_lambda_powertools.utilities.typing import LambdaContext
415
-
416
- logger = Logger()
417
- tracer = Tracer()
418
- metrics = Metrics()
419
-
420
- @logger.inject_lambda_context(log_event=False)
421
- @tracer.capture_lambda_handler
422
- @metrics.log_metrics(capture_cold_start_metric=True)
423
- def handler(event: dict, context: LambdaContext) -> dict:
424
- logger.info("Processing order", order_id=event.get("order_id"))
425
- metrics.add_metric(name="OrdersProcessed", unit=MetricUnit.Count, value=1)
426
- result = process_order(event)
427
- return {"statusCode": 200, "body": result}
428
-
429
- @tracer.capture_method
430
- def process_order(event: dict) -> str:
431
- return "processed"
432
- ```
161
+ ### `AuthType=NONE` (public)
433
162
 
434
- ### TypeScript: Logger + Tracer + Metrics
435
-
436
- ```typescript
437
- import { Logger } from '@aws-lambda-powertools/logger';
438
- import { Tracer } from '@aws-lambda-powertools/tracer';
439
- import { Metrics, MetricUnit } from '@aws-lambda-powertools/metrics';
440
- import middy from '@middy/core';
441
- import { injectLambdaContext } from '@aws-lambda-powertools/logger/middleware';
442
- import { captureLambdaHandler } from '@aws-lambda-powertools/tracer/middleware';
443
- import { logMetrics } from '@aws-lambda-powertools/metrics/middleware';
444
-
445
- const logger = new Logger({ serviceName: 'orderService' });
446
- const tracer = new Tracer({ serviceName: 'orderService' });
447
- const metrics = new Metrics({ namespace: 'OrderApp', serviceName: 'orderService' });
448
-
449
- const lambdaHandler = async (event: any) => {
450
- logger.info('Processing order', { orderId: event.orderId });
451
- metrics.addMetric('OrdersProcessed', MetricUnit.Count, 1);
452
- const result = await processOrder(event);
453
- return { statusCode: 200, body: JSON.stringify(result) };
454
- };
455
-
456
- export const handler = middy(lambdaHandler)
457
- .use(injectLambdaContext(logger, { logEvent: false }))
458
- .use(captureLambdaHandler(tracer))
459
- .use(logMetrics(metrics, { captureColdStartMetric: true }));
460
- ```
461
-
462
- ### Python: Idempotency
463
-
464
- ```python
465
- from aws_lambda_powertools.utilities.idempotency import (
466
- DynamoDBPersistenceLayer,
467
- idempotent,
468
- )
469
-
470
- persistence_layer = DynamoDBPersistenceLayer(table_name="IdempotencyTable")
471
-
472
- @idempotent(persistence_store=persistence_layer)
473
- def handler(event: dict, context) -> dict:
474
- payment = process_payment(event)
475
- return {"payment_id": payment.id, "status": "success"}
476
- ```
163
+ Lambda does no auth the resource-based policy alone gates access, so it must grant **public** access. Only use when the endpoint must be reachable by unauthenticated clients (e.g. a browser hitting the URL directly) with no CloudFront/edge auth in front; it exposes the function to anyone with the URL, so pair it with in-code auth, throttling, and monitoring. The console and SAM add both required statements automatically; with the CLI/API add each yourself (two separate `add-permission` calls):
477
164
 
478
- ### TypeScript: Idempotency
479
-
480
- ```typescript
481
- import { makeIdempotent } from '@aws-lambda-powertools/idempotency';
482
- import { DynamoDBPersistenceLayer } from '@aws-lambda-powertools/idempotency/dynamodb';
483
-
484
- const persistenceStore = new DynamoDBPersistenceLayer({
485
- tableName: 'IdempotencyTable',
486
- });
487
-
488
- const processPayment = async (event: { paymentId: string; amount: number }) => {
489
- return { paymentId: event.paymentId, status: 'success' };
490
- };
491
-
492
- export const handler = makeIdempotent(processPayment, {
493
- persistenceStore,
494
- });
495
- ```
496
-
497
- ### Python: Batch Processing (SQS Partial Failures)
498
-
499
- ```python
500
- from aws_lambda_powertools.utilities.batch import (
501
- BatchProcessor,
502
- EventType,
503
- process_partial_response,
504
- )
505
- from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord
506
-
507
- processor = BatchProcessor(event_type=EventType.SQS)
508
-
509
- def record_handler(record: SQSRecord):
510
- payload = record.json_body
511
- process_item(payload)
165
+ ```bash
166
+ # Statement 1: allow invoking via the Function URL (public)
167
+ aws lambda add-permission --function-name my-function \
168
+ --statement-id FunctionURLAllowPublicAccess \
169
+ --action lambda:InvokeFunctionUrl --principal '*' \
170
+ --function-url-auth-type NONE
512
171
 
513
- def handler(event, context):
514
- return process_partial_response(
515
- event=event,
516
- record_handler=record_handler,
517
- processor=processor,
518
- context=context,
519
- )
172
+ # Statement 2: REQUIRED — allow the underlying invoke, scoped to URL calls
173
+ aws lambda add-permission --function-name my-function \
174
+ --statement-id FunctionURLInvokeAllowPublicAccess \
175
+ --action lambda:InvokeFunction --principal '*' \
176
+ --invoked-via-function-url
520
177
  ```
521
178
 
522
- ### TypeScript: Batch Processing (SQS Partial Failures)
523
-
524
- ```typescript
525
- import {
526
- BatchProcessor,
527
- EventType,
528
- processPartialResponse,
529
- } from '@aws-lambda-powertools/batch';
530
- import type { SQSRecord, SQSHandler } from 'aws-lambda';
179
+ The `lambda:InvokedViaFunctionUrl` condition on statement 2 (set by `--invoked-via-function-url`) restricts that grant to Function URL calls, so it does not open direct `Invoke` access. See [Lambda function URL auth](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html).
531
180
 
532
- const processor = new BatchProcessor(EventType.SQS);
181
+ ## Powertools and Packaging
533
182
 
534
- const recordHandler = async (record: SQSRecord): Promise<void> => {
535
- const payload = JSON.parse(record.body);
536
- await processItem(payload);
537
- };
183
+ Use **Powertools for AWS Lambda** (Python, TypeScript, Java, .NET) for structured logging, X-Ray tracing, EMF metrics, idempotency, batch processing, event handling, and parameter caching. The APIs are well-documented at [docs.powertools.aws.dev](https://docs.powertools.aws.dev/lambda/); for a ready-to-use Python handler with Logger + Tracer + Metrics + Idempotency wired, start from [assets/powertools-handler.py](../assets/powertools-handler.py).
538
184
 
539
- export const handler: SQSHandler = async (event, context) => {
540
- return processPartialResponse(event, recordHandler, processor, {
541
- context,
542
- });
543
- };
544
- ```
185
+ Powertools adds cold-start overhead use selective imports when cold start is critical.
545
186
 
546
- ### Asset Reference
187
+ **Useful Powertools env vars:** `POWERTOOLS_SERVICE_NAME`, `POWERTOOLS_METRICS_NAMESPACE`, `POWERTOOLS_LOG_LEVEL`, `POWERTOOLS_TRACE_DISABLED` (tests), `POWERTOOLS_DEV` (pretty-print).
547
188
 
548
- For a ready-to-use Python handler with Powertools wired, read [assets/powertools-handler.py](../assets/powertools-handler.py).
189
+ **Packaging quick facts:** 50 MB zipped / 250 MB unzipped (incl. layers) → switch to container image (10 GB) past that. Max 5 layers/function; layers don't work with container images. Use `uv pip install` (10–100× faster than pip) and `--platform manylinux2014_{x86_64,aarch64} --only-binary=:all:` for cross-platform builds, or let `sam build` handle it. See [troubleshooting.md](troubleshooting.md) for size/import errors.