@deftai/directive-content 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/.agents/skills/deft/SKILL.md +6 -0
  2. package/.agents/skills/deft-directive-article-review/SKILL.md +11 -0
  3. package/.agents/skills/deft-directive-build/SKILL.md +10 -0
  4. package/.agents/skills/deft-directive-cost/SKILL.md +12 -0
  5. package/.agents/skills/deft-directive-debug/SKILL.md +13 -0
  6. package/.agents/skills/deft-directive-gh-arch/SKILL.md +11 -0
  7. package/.agents/skills/deft-directive-gh-slice/SKILL.md +10 -0
  8. package/.agents/skills/deft-directive-glossary/SKILL.md +10 -0
  9. package/.agents/skills/deft-directive-interview/SKILL.md +9 -0
  10. package/.agents/skills/deft-directive-pre-pr/SKILL.md +9 -0
  11. package/.agents/skills/deft-directive-refinement/SKILL.md +10 -0
  12. package/.agents/skills/deft-directive-release/SKILL.md +12 -0
  13. package/.agents/skills/deft-directive-review-cycle/SKILL.md +10 -0
  14. package/.agents/skills/deft-directive-setup/SKILL.md +10 -0
  15. package/.agents/skills/deft-directive-swarm/SKILL.md +10 -0
  16. package/.agents/skills/deft-directive-sync/SKILL.md +9 -0
  17. package/.agents/skills/deft-directive-triage/SKILL.md +9 -0
  18. package/.agents/skills/deft-directive-write-skill/SKILL.md +9 -0
  19. package/LICENSE.md +22 -0
  20. package/QUICK-START.md +167 -0
  21. package/UPGRADING.md +517 -0
  22. package/coding/build-output.md +28 -0
  23. package/coding/coding.md +235 -0
  24. package/coding/debugging.md +110 -0
  25. package/coding/holzmann.md +96 -0
  26. package/coding/hygiene.md +127 -0
  27. package/coding/security.md +158 -0
  28. package/coding/testing.md +162 -0
  29. package/coding/toolchain.md +44 -0
  30. package/commands.md +300 -0
  31. package/context/context.md +57 -0
  32. package/context/deterministic-split.md +67 -0
  33. package/context/examples.md +26 -0
  34. package/context/fractal-summaries.md +69 -0
  35. package/context/long-horizon.md +46 -0
  36. package/context/spec-deltas.md +177 -0
  37. package/context/tool-design.md +34 -0
  38. package/context/working-memory.md +62 -0
  39. package/contracts/boundary-maps.md +65 -0
  40. package/contracts/deterministic-questions.md +59 -0
  41. package/contracts/hierarchy.md +77 -0
  42. package/conventions/content-manifest.json +399 -0
  43. package/conventions/machine-generated-banner.md +130 -0
  44. package/conventions/references.md +120 -0
  45. package/conventions/rule-ownership.json +382 -0
  46. package/conventions/task-caching.md +43 -0
  47. package/conventions/vbrief-filenames.md +70 -0
  48. package/deployments/README.md +37 -0
  49. package/deployments/agentuity/README.md +138 -0
  50. package/deployments/agentuity/via-cli.md +380 -0
  51. package/deployments/agentuity/via-cloud.md +425 -0
  52. package/deployments/agentuity/via-github-actions.md +664 -0
  53. package/deployments/agentuity/via-gravity-network.md +606 -0
  54. package/deployments/agentuity/via-vpc.md +607 -0
  55. package/deployments/aws/README.md +38 -0
  56. package/deployments/aws/via-app-runner.md +612 -0
  57. package/deployments/aws/via-ecs-fargate.md +561 -0
  58. package/deployments/aws/via-elastic-beanstalk.md +628 -0
  59. package/deployments/aws/via-lambda.md +649 -0
  60. package/deployments/azure/README.md +37 -0
  61. package/deployments/azure/via-aks.md +390 -0
  62. package/deployments/azure/via-app-service.md +564 -0
  63. package/deployments/azure/via-container-apps.md +599 -0
  64. package/deployments/azure/via-functions.md +552 -0
  65. package/deployments/cloud-gov/README.md +63 -0
  66. package/deployments/cloud-gov/agents/compliance-docs.md +154 -0
  67. package/deployments/cloud-gov/agents.md +39 -0
  68. package/deployments/cloud-gov/cicd.md +64 -0
  69. package/deployments/cloud-gov/deployment.md +150 -0
  70. package/deployments/cloud-gov/logging.md +43 -0
  71. package/deployments/cloud-gov/manifest.md +121 -0
  72. package/deployments/cloud-gov/overview.md +58 -0
  73. package/deployments/cloud-gov/security.md +46 -0
  74. package/deployments/cloud-gov/services.md +72 -0
  75. package/deployments/cloud-gov/upstream/README.md +18 -0
  76. package/deployments/cloudflare/README.md +33 -0
  77. package/deployments/cloudflare/via-dashboard.md +83 -0
  78. package/deployments/cloudflare/via-git.md +90 -0
  79. package/deployments/cloudflare/via-github-actions.md +185 -0
  80. package/deployments/cloudflare/via-terraform.md +157 -0
  81. package/deployments/cloudflare/via-wrangler.md +165 -0
  82. package/deployments/fly-io/README.md +37 -0
  83. package/deployments/fly-io/via-dockerfile.md +648 -0
  84. package/deployments/fly-io/via-flyctl.md +653 -0
  85. package/deployments/fly-io/via-github-actions.md +695 -0
  86. package/deployments/fly-io/via-multi-region.md +598 -0
  87. package/deployments/google/README.md +34 -0
  88. package/deployments/google/via-app-engine.md +42 -0
  89. package/deployments/google/via-cloud-functions.md +23 -0
  90. package/deployments/google/via-cloud-run.md +330 -0
  91. package/deployments/google/via-gke.md +23 -0
  92. package/deployments/netlify/README.md +99 -0
  93. package/deployments/netlify/via-cli.md +17 -0
  94. package/deployments/netlify/via-functions.md +19 -0
  95. package/deployments/netlify/via-git.md +25 -0
  96. package/deployments/vercel/README.md +90 -0
  97. package/deployments/vercel/via-api.md +16 -0
  98. package/deployments/vercel/via-cli.md +17 -0
  99. package/deployments/vercel/via-git.md +24 -0
  100. package/docs/BROWNFIELD.md +179 -0
  101. package/docs/getting-started.md +137 -0
  102. package/docs/good-agents-md.md +137 -0
  103. package/events/README.md +89 -0
  104. package/events/event-record.schema.json +26 -0
  105. package/events/registry.json +166 -0
  106. package/events/registry.schema.json +71 -0
  107. package/glossary.md +145 -0
  108. package/incidents/README.md +81 -0
  109. package/incidents/_template.md +38 -0
  110. package/interfaces/cli.md +104 -0
  111. package/interfaces/rest.md +212 -0
  112. package/interfaces/tui.md +242 -0
  113. package/interfaces/web.md +123 -0
  114. package/languages/6502-DASM.md +132 -0
  115. package/languages/c.md +235 -0
  116. package/languages/commands.md +23 -0
  117. package/languages/cpp.md +132 -0
  118. package/languages/csharp.md +259 -0
  119. package/languages/dart.md +183 -0
  120. package/languages/delphi.md +218 -0
  121. package/languages/elixir.md +208 -0
  122. package/languages/go.md +78 -0
  123. package/languages/java.md +278 -0
  124. package/languages/javascript.md +163 -0
  125. package/languages/julia.md +175 -0
  126. package/languages/kotlin.md +193 -0
  127. package/languages/markdown.md +168 -0
  128. package/languages/mermaid.md +146 -0
  129. package/languages/officejs.md +392 -0
  130. package/languages/python.md +209 -0
  131. package/languages/r.md +163 -0
  132. package/languages/rust.md +216 -0
  133. package/languages/sql.md +216 -0
  134. package/languages/swift.md +153 -0
  135. package/languages/typescript.md +132 -0
  136. package/languages/vba.md +279 -0
  137. package/languages/vhdl.md +180 -0
  138. package/languages/visual-basic.md +151 -0
  139. package/languages/zig.md +196 -0
  140. package/meta/SOUL.md +27 -0
  141. package/meta/code-field.md +44 -0
  142. package/meta/morals.md +40 -0
  143. package/meta/philosophy.md +39 -0
  144. package/meta/project.md +49 -0
  145. package/meta/ralph.md +223 -0
  146. package/meta/security.md +80 -0
  147. package/meta/versioning.md +326 -0
  148. package/package.json +22 -0
  149. package/packs/lessons/lessons-pack-0.1.json +553 -0
  150. package/packs/patterns/patterns-pack-0.1.json +57 -0
  151. package/packs/rules/rules-pack-0.1.json +4767 -0
  152. package/packs/skills/skills-pack-0.1.json +262 -0
  153. package/packs/strategies/strategies-pack-0.1.json +167 -0
  154. package/packs/swarm-spec/swarm-spec-pack-0.1.json +17 -0
  155. package/patterns/executor-layer-credentials.md +227 -0
  156. package/patterns/llm-app.md +156 -0
  157. package/patterns/multi-agent.md +278 -0
  158. package/patterns/prompt-assembly-layer-ordering.md +154 -0
  159. package/patterns/role-as-overlay.md +179 -0
  160. package/platforms/2600.md +137 -0
  161. package/platforms/unity.md +329 -0
  162. package/references/composer-skill-porting.md +152 -0
  163. package/references/cost-models.md +163 -0
  164. package/references/ip-risk.md +246 -0
  165. package/references/plain-english-ux.md +275 -0
  166. package/resilience/context-pruning.md +67 -0
  167. package/resilience/continue-here.md +62 -0
  168. package/scm/changelog.md +276 -0
  169. package/scm/git.md +139 -0
  170. package/scm/github.md +265 -0
  171. package/secrets/.gitkeep +0 -0
  172. package/skills/deft-build/SKILL.md +20 -0
  173. package/skills/deft-directive-article-review/SKILL.md +156 -0
  174. package/skills/deft-directive-build/SKILL.md +302 -0
  175. package/skills/deft-directive-cost/SKILL.md +201 -0
  176. package/skills/deft-directive-debug/SKILL.md +140 -0
  177. package/skills/deft-directive-decompose/SKILL.md +96 -0
  178. package/skills/deft-directive-gh-arch/SKILL.md +160 -0
  179. package/skills/deft-directive-gh-slice/SKILL.md +199 -0
  180. package/skills/deft-directive-glossary/SKILL.md +118 -0
  181. package/skills/deft-directive-interview/SKILL.md +528 -0
  182. package/skills/deft-directive-pre-pr/SKILL.md +131 -0
  183. package/skills/deft-directive-probe/SKILL.md +127 -0
  184. package/skills/deft-directive-refinement/SKILL.md +403 -0
  185. package/skills/deft-directive-release/SKILL.md +266 -0
  186. package/skills/deft-directive-review-cycle/SKILL.md +401 -0
  187. package/skills/deft-directive-setup/SKILL.md +717 -0
  188. package/skills/deft-directive-swarm/SKILL.md +989 -0
  189. package/skills/deft-directive-sync/SKILL.md +288 -0
  190. package/skills/deft-directive-triage/SKILL.md +137 -0
  191. package/skills/deft-directive-write-skill/SKILL.md +169 -0
  192. package/skills/deft-interview/SKILL.md +16 -0
  193. package/skills/deft-pre-pr/SKILL.md +16 -0
  194. package/skills/deft-review-cycle/SKILL.md +16 -0
  195. package/skills/deft-roadmap-refresh/SKILL.md +16 -0
  196. package/skills/deft-setup/SKILL.md +20 -0
  197. package/skills/deft-swarm/SKILL.md +16 -0
  198. package/skills/deft-sync/SKILL.md +16 -0
  199. package/strategies/README.md +83 -0
  200. package/strategies/artifact-guards.md +85 -0
  201. package/strategies/bdd.md +115 -0
  202. package/strategies/brownfield.md +7 -0
  203. package/strategies/discuss.md +129 -0
  204. package/strategies/emit-hints.md +69 -0
  205. package/strategies/enterprise.md +193 -0
  206. package/strategies/interview.md +551 -0
  207. package/strategies/map.md +179 -0
  208. package/strategies/probe.md +151 -0
  209. package/strategies/rapid.md +155 -0
  210. package/strategies/research.md +155 -0
  211. package/strategies/roadmap.md +9 -0
  212. package/strategies/speckit.md +437 -0
  213. package/strategies/v0-20-contract.md +134 -0
  214. package/strategies/yolo.md +169 -0
  215. package/swarm/swarm.md +300 -0
  216. package/templates/COST-ESTIMATE.md +114 -0
  217. package/templates/PULL_REQUEST_TEMPLATE.md +35 -0
  218. package/templates/agent-prompt-preamble.md +409 -0
  219. package/templates/agents-entry.md +211 -0
  220. package/templates/agents-entry.placeholders.md +75 -0
  221. package/templates/embed.go +20 -0
  222. package/templates/embed_test.go +36 -0
  223. package/templates/make-spec-example.md +9 -0
  224. package/templates/make-spec.md +246 -0
  225. package/templates/project.md.template +52 -0
  226. package/templates/specification.md +1 -0
  227. package/templates/swarm-greptile-poller-prompt.md +556 -0
  228. package/templates/user.md.template +31 -0
  229. package/tools/RWLDL.md +80 -0
  230. package/tools/greptile.md +141 -0
  231. package/tools/installer.md +23 -0
  232. package/tools/taskfile-migration.md +32 -0
  233. package/tools/taskfile.md +185 -0
  234. package/tools/telemetry.md +285 -0
  235. package/vbrief/schemas/cache-meta.schema.json +137 -0
  236. package/vbrief/schemas/candidates.schema.json +130 -0
  237. package/vbrief/schemas/codebase-map.schema.json +213 -0
  238. package/vbrief/schemas/lessons-pack.schema.json +134 -0
  239. package/vbrief/schemas/patterns-pack.schema.json +84 -0
  240. package/vbrief/schemas/rules-pack.schema.json +105 -0
  241. package/vbrief/schemas/skills-pack.schema.json +94 -0
  242. package/vbrief/schemas/slices.schema.json +87 -0
  243. package/vbrief/schemas/strategies-pack.schema.json +89 -0
  244. package/vbrief/schemas/swarm-spec-pack.schema.json +84 -0
  245. package/vbrief/schemas/vbrief-core.schema.json +1022 -0
  246. package/vbrief/vbrief.md +684 -0
  247. package/verification/integration.md +76 -0
  248. package/verification/plan-checking.md +85 -0
  249. package/verification/uat.md +60 -0
  250. package/verification/verification.md +117 -0
@@ -0,0 +1,628 @@
1
+ # Deploy via Elastic Beanstalk
2
+
3
+ Deploy applications using AWS Elastic Beanstalk, a Platform-as-a-Service (PaaS) that handles infrastructure provisioning, load balancing, auto-scaling, and monitoring.
4
+
5
+ ## Overview
6
+
7
+ Elastic Beanstalk simplifies application deployment:
8
+ - **Managed Platform**: Infrastructure automatically provisioned
9
+ - **Multi-Language Support**: Python, Node.js, Java, .NET, PHP, Ruby, Go, Docker
10
+ - **Auto-scaling**: Built-in scaling based on metrics
11
+ - **Load Balancing**: Automatic load balancer setup
12
+ - **Monitoring**: CloudWatch integration included
13
+
14
+ ## Prerequisites
15
+
16
+ - AWS account with IAM permissions
17
+ - EB CLI installed
18
+ - Application code
19
+ - AWS CLI (optional)
20
+
21
+ ## Quick Start
22
+
23
+ ### 1. Install EB CLI
24
+
25
+ ```bash
26
+ # Via pip
27
+ pip install awsebcli --upgrade --user
28
+
29
+ # Verify installation
30
+ eb --version
31
+ ```
32
+
33
+ ### 2. Initialize Application
34
+
35
+ ```bash
36
+ # Navigate to project directory
37
+ cd my-app
38
+
39
+ # Initialize Elastic Beanstalk
40
+ eb init
41
+
42
+ # Follow prompts:
43
+ # - Select region
44
+ # - Choose or create application
45
+ # - Select platform (Python, Node.js, etc.)
46
+ # - Set up CodeCommit (optional)
47
+ # - Set up SSH (optional)
48
+ ```
49
+
50
+ ### 3. Create Environment and Deploy
51
+
52
+ ```bash
53
+ # Create environment and deploy
54
+ eb create production
55
+
56
+ # Or specify options
57
+ eb create production \
58
+ --instance-type t3.small \
59
+ --envvars KEY1=value1,KEY2=value2
60
+ ```
61
+
62
+ ### 4. Manage Application
63
+
64
+ ```bash
65
+ # Check status
66
+ eb status
67
+
68
+ # View logs
69
+ eb logs
70
+
71
+ # Open in browser
72
+ eb open
73
+
74
+ # Deploy updates
75
+ eb deploy
76
+ ```
77
+
78
+ ## Platform-Specific Configurations
79
+
80
+ ### Node.js Application
81
+
82
+ ```json
83
+ // package.json
84
+ {
85
+ "name": "my-app",
86
+ "version": "1.0.0",
87
+ "scripts": {
88
+ "start": "node server.js"
89
+ },
90
+ "engines": {
91
+ "node": "18.x"
92
+ }
93
+ }
94
+ ```
95
+
96
+ ```yaml
97
+ # .ebextensions/nodecommand.config
98
+ option_settings:
99
+ aws:elasticbeanstalk:container:nodejs:
100
+ NodeCommand: "npm start"
101
+ ProxyServer: nginx
102
+ ```
103
+
104
+ ### Python Application
105
+
106
+ ```txt
107
+ # requirements.txt
108
+ Flask==2.3.0
109
+ gunicorn==20.1.0
110
+ ```
111
+
112
+ ```yaml
113
+ # .ebextensions/python.config
114
+ option_settings:
115
+ aws:elasticbeanstalk:container:python:
116
+ WSGIPath: application:application
117
+ NumProcesses: 4
118
+ NumThreads: 2
119
+ ```
120
+
121
+ ### Java Application
122
+
123
+ ```xml
124
+ <!-- pom.xml -->
125
+ <build>
126
+ <plugins>
127
+ <plugin>
128
+ <groupId>org.springframework.boot</groupId>
129
+ <artifactId>spring-boot-maven-plugin</artifactId>
130
+ </plugin>
131
+ </plugins>
132
+ <finalName>application</finalName>
133
+ </build>
134
+ ```
135
+
136
+ ### Docker Single Container
137
+
138
+ ```dockerfile
139
+ FROM node:18-alpine
140
+
141
+ WORKDIR /app
142
+
143
+ COPY package*.json ./
144
+ RUN npm ci --production
145
+
146
+ COPY . .
147
+
148
+ EXPOSE 3000
149
+
150
+ CMD ["node", "server.js"]
151
+ ```
152
+
153
+ ```json
154
+ // Dockerrun.aws.json
155
+ {
156
+ "AWSEBDockerrunVersion": "1",
157
+ "Image": {
158
+ "Name": "my-app:latest",
159
+ "Update": "true"
160
+ },
161
+ "Ports": [
162
+ {
163
+ "ContainerPort": 3000
164
+ }
165
+ ],
166
+ "Volumes": [],
167
+ "Logging": "/var/log/nginx"
168
+ }
169
+ ```
170
+
171
+ ### Docker Multi-Container
172
+
173
+ ```json
174
+ // Dockerrun.aws.json (v2)
175
+ {
176
+ "AWSEBDockerrunVersion": 2,
177
+ "containerDefinitions": [
178
+ {
179
+ "name": "nginx",
180
+ "image": "nginx:latest",
181
+ "essential": true,
182
+ "memory": 128,
183
+ "portMappings": [
184
+ {
185
+ "hostPort": 80,
186
+ "containerPort": 80
187
+ }
188
+ ],
189
+ "links": ["app"]
190
+ },
191
+ {
192
+ "name": "app",
193
+ "image": "my-app:latest",
194
+ "essential": true,
195
+ "memory": 512,
196
+ "portMappings": [
197
+ {
198
+ "hostPort": 8080,
199
+ "containerPort": 8080
200
+ }
201
+ ]
202
+ }
203
+ ]
204
+ }
205
+ ```
206
+
207
+ ## Configuration with .ebextensions
208
+
209
+ ### Environment Variables
210
+
211
+ ```yaml
212
+ # .ebextensions/env-vars.config
213
+ option_settings:
214
+ aws:elasticbeanstalk:application:environment:
215
+ APP_ENV: production
216
+ LOG_LEVEL: info
217
+ DATABASE_URL: "{{resolve:secretsmanager:db-url}}"
218
+ ```
219
+
220
+ ### Instance Configuration
221
+
222
+ ```yaml
223
+ # .ebextensions/instances.config
224
+ option_settings:
225
+ aws:autoscaling:launchconfiguration:
226
+ InstanceType: t3.medium
227
+ RootVolumeSize: 20
228
+ EC2KeyName: my-keypair
229
+
230
+ aws:autoscaling:asg:
231
+ MinSize: 2
232
+ MaxSize: 10
233
+
234
+ aws:elasticbeanstalk:environment:
235
+ LoadBalancerType: application
236
+ EnvironmentType: LoadBalanced
237
+ ```
238
+
239
+ ### Load Balancer
240
+
241
+ ```yaml
242
+ # .ebextensions/alb.config
243
+ option_settings:
244
+ aws:elbv2:listener:default:
245
+ Protocol: HTTP
246
+ Rules: forward
247
+
248
+ aws:elbv2:listener:443:
249
+ Protocol: HTTPS
250
+ SSLCertificateArns: arn:aws:acm:region:account:certificate/id
251
+ Rules: forward
252
+
253
+ aws:elasticbeanstalk:environment:process:default:
254
+ HealthCheckPath: /health
255
+ HealthCheckTimeout: 5
256
+ HealthCheckInterval: 30
257
+ HealthyThresholdCount: 2
258
+ UnhealthyThresholdCount: 5
259
+ ```
260
+
261
+ ### Custom Commands
262
+
263
+ ```yaml
264
+ # .ebextensions/commands.config
265
+ commands:
266
+ 01_install_dependencies:
267
+ command: "yum install -y postgresql-devel"
268
+
269
+ 02_migrate_database:
270
+ command: "python manage.py migrate"
271
+ leader_only: true
272
+
273
+ container_commands:
274
+ 01_collectstatic:
275
+ command: "python manage.py collectstatic --noinput"
276
+
277
+ 02_create_superuser:
278
+ command: "python scripts/create_admin.py"
279
+ leader_only: true
280
+ ```
281
+
282
+ ### Files
283
+
284
+ ```yaml
285
+ # .ebextensions/files.config
286
+ files:
287
+ "/etc/nginx/conf.d/proxy.conf":
288
+ mode: "000644"
289
+ owner: root
290
+ group: root
291
+ content: |
292
+ client_max_body_size 50M;
293
+
294
+ "/opt/elasticbeanstalk/tasks/taillogs.d/app.conf":
295
+ mode: "000644"
296
+ owner: root
297
+ group: root
298
+ content: |
299
+ /var/log/app/*.log
300
+ ```
301
+
302
+ ## Deployment Strategies
303
+
304
+ ### Rolling Deployments
305
+
306
+ ```yaml
307
+ # .ebextensions/rolling.config
308
+ option_settings:
309
+ aws:elasticbeanstalk:command:
310
+ DeploymentPolicy: Rolling
311
+ BatchSizeType: Percentage
312
+ BatchSize: 50
313
+
314
+ aws:autoscaling:updatepolicy:rollingupdate:
315
+ RollingUpdateEnabled: true
316
+ MaxBatchSize: 2
317
+ MinInstancesInService: 2
318
+ ```
319
+
320
+ ### Immutable Deployments
321
+
322
+ ```yaml
323
+ # .ebextensions/immutable.config
324
+ option_settings:
325
+ aws:elasticbeanstalk:command:
326
+ DeploymentPolicy: Immutable
327
+ HealthCheckSuccessThreshold: OK
328
+ IgnoreHealthCheck: false
329
+ Timeout: "600"
330
+ ```
331
+
332
+ ### Blue/Green Deployments
333
+
334
+ ```bash
335
+ # Create new environment (green)
336
+ eb create production-v2 --cname production-temp
337
+
338
+ # Test green environment
339
+ eb open production-v2
340
+
341
+ # Swap URLs (zero downtime)
342
+ eb swap production production-v2
343
+
344
+ # Terminate old environment
345
+ eb terminate production-v2
346
+ ```
347
+
348
+ ## Environment Management
349
+
350
+ ### Multiple Environments
351
+
352
+ ```bash
353
+ # Create staging environment
354
+ eb create staging --branch-default
355
+
356
+ # Create production environment
357
+ eb create production
358
+
359
+ # Switch between environments
360
+ eb use staging
361
+ eb deploy
362
+
363
+ eb use production
364
+ eb deploy
365
+ ```
366
+
367
+ ### Saved Configurations
368
+
369
+ ```bash
370
+ # Save current configuration
371
+ eb config save production --cfg production-config
372
+
373
+ # Apply saved configuration to new environment
374
+ eb create new-prod --cfg production-config
375
+ ```
376
+
377
+ ## Database Integration
378
+
379
+ ### RDS Integration
380
+
381
+ ```bash
382
+ # Create environment with RDS
383
+ eb create production \
384
+ --database \
385
+ --database.engine postgres \
386
+ --database.username admin \
387
+ --database.instance db.t3.micro
388
+ ```
389
+
390
+ ```python
391
+ # Access RDS credentials in application
392
+ import os
393
+
394
+ DB_HOST = os.environ['RDS_HOSTNAME']
395
+ DB_PORT = os.environ['RDS_PORT']
396
+ DB_NAME = os.environ['RDS_DB_NAME']
397
+ DB_USER = os.environ['RDS_USERNAME']
398
+ DB_PASSWORD = os.environ['RDS_PASSWORD']
399
+
400
+ DATABASE_URL = f"postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
401
+ ```
402
+
403
+ ### External Database
404
+
405
+ ```yaml
406
+ # .ebextensions/database.config
407
+ option_settings:
408
+ aws:elasticbeanstalk:application:environment:
409
+ DATABASE_URL: "{{resolve:secretsmanager:prod/db/url}}"
410
+ ```
411
+
412
+ ## Auto-scaling
413
+
414
+ ### Metric-Based Scaling
415
+
416
+ ```yaml
417
+ # .ebextensions/autoscaling.config
418
+ option_settings:
419
+ aws:autoscaling:asg:
420
+ MinSize: 2
421
+ MaxSize: 10
422
+
423
+ aws:autoscaling:trigger:
424
+ MeasureName: CPUUtilization
425
+ Unit: Percent
426
+ UpperThreshold: 75
427
+ LowerThreshold: 25
428
+ UpperBreachScaleIncrement: 2
429
+ LowerBreachScaleIncrement: -1
430
+ ```
431
+
432
+ ### Time-Based Scaling
433
+
434
+ ```yaml
435
+ # .ebextensions/scheduled-scaling.config
436
+ Resources:
437
+ ScaleUpRule:
438
+ Type: AWS::AutoScaling::ScheduledAction
439
+ Properties:
440
+ AutoScalingGroupName: !Ref AWSEBAutoScalingGroup
441
+ MinSize: 5
442
+ MaxSize: 10
443
+ Recurrence: "0 8 * * MON-FRI"
444
+
445
+ ScaleDownRule:
446
+ Type: AWS::AutoScaling::ScheduledAction
447
+ Properties:
448
+ AutoScalingGroupName: !Ref AWSEBAutoScalingGroup
449
+ MinSize: 2
450
+ MaxSize: 5
451
+ Recurrence: "0 18 * * MON-FRI"
452
+ ```
453
+
454
+ ## CI/CD Integration
455
+
456
+ ### GitHub Actions
457
+
458
+ ```yaml
459
+ # .github/workflows/deploy.yml
460
+ name: Deploy to Elastic Beanstalk
461
+
462
+ on:
463
+ push:
464
+ branches: [main]
465
+
466
+ jobs:
467
+ deploy:
468
+ runs-on: ubuntu-latest
469
+
470
+ steps:
471
+ - uses: actions/checkout@v3
472
+
473
+ - uses: actions/setup-python@v4
474
+ with:
475
+ python-version: '3.11'
476
+
477
+ - name: Install EB CLI
478
+ run: pip install awsebcli
479
+
480
+ - uses: aws-actions/configure-aws-credentials@v2
481
+ with:
482
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
483
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
484
+ aws-region: us-east-1
485
+
486
+ - name: Deploy to EB
487
+ run: |
488
+ eb init my-app --region us-east-1 --platform python-3.11
489
+ eb use production
490
+ eb deploy --staged --label ${{ github.sha }}
491
+ ```
492
+
493
+ ### AWS CodePipeline
494
+
495
+ ```yaml
496
+ # buildspec.yml
497
+ version: 0.2
498
+
499
+ phases:
500
+ install:
501
+ runtime-versions:
502
+ python: 3.11
503
+ commands:
504
+ - pip install -r requirements.txt
505
+
506
+ build:
507
+ commands:
508
+ - python -m pytest tests/
509
+ - echo "Build completed"
510
+
511
+ artifacts:
512
+ files:
513
+ - '**/*'
514
+ ```
515
+
516
+ ## Monitoring
517
+
518
+ ### Enhanced Health Reporting
519
+
520
+ ```yaml
521
+ # .ebextensions/health.config
522
+ option_settings:
523
+ aws:elasticbeanstalk:healthreporting:system:
524
+ SystemType: enhanced
525
+ EnhancedHealthAuthEnabled: true
526
+
527
+ aws:elasticbeanstalk:cloudwatch:logs:
528
+ StreamLogs: true
529
+ DeleteOnTerminate: false
530
+ RetentionInDays: 7
531
+ ```
532
+
533
+ ### Custom CloudWatch Metrics
534
+
535
+ ```yaml
536
+ # .ebextensions/cloudwatch.config
537
+ files:
538
+ "/opt/aws/amazon-cloudwatch-agent/etc/config.json":
539
+ mode: "000644"
540
+ owner: root
541
+ group: root
542
+ content: |
543
+ {
544
+ "metrics": {
545
+ "namespace": "MyApp",
546
+ "metrics_collected": {
547
+ "cpu": {
548
+ "measurement": ["cpu_usage_idle"],
549
+ "metrics_collection_interval": 60
550
+ },
551
+ "mem": {
552
+ "measurement": ["mem_used_percent"],
553
+ "metrics_collection_interval": 60
554
+ }
555
+ }
556
+ }
557
+ }
558
+ ```
559
+
560
+ ## Best Practices
561
+
562
+ 1. **Use .ebextensions**: Version control all configuration
563
+ 2. **Immutable Deployments**: Use for production zero-downtime
564
+ 3. **Health Checks**: Configure meaningful health check endpoints
565
+ 4. **Secrets Management**: Use Secrets Manager for sensitive data
566
+ 5. **Environment Tiers**: Separate dev/staging/production
567
+ 6. **Auto-scaling**: Configure based on actual load patterns
568
+ 7. **Monitoring**: Enable enhanced health reporting
569
+ 8. **Logging**: Stream logs to CloudWatch
570
+ 9. **Database Separation**: Don't use coupled RDS (use external)
571
+ 10. **Cost Management**: Right-size instances, use auto-scaling
572
+
573
+ ## Troubleshooting
574
+
575
+ ### View Logs
576
+
577
+ ```bash
578
+ # Recent logs
579
+ eb logs
580
+
581
+ # Tail logs
582
+ eb logs --stream
583
+
584
+ # Download all logs
585
+ eb logs --all --zip
586
+ ```
587
+
588
+ ### SSH into Instances
589
+
590
+ ```bash
591
+ # Enable SSH in .ebextensions or console
592
+ eb ssh
593
+
594
+ # SSH to specific instance
595
+ eb ssh --instance i-xxxxx
596
+ ```
597
+
598
+ ### Common Issues
599
+
600
+ **Deployment Fails**
601
+ ```bash
602
+ # Check events
603
+ eb events --follow
604
+
605
+ # View health
606
+ eb health --refresh
607
+ ```
608
+
609
+ **502/503 Errors**
610
+ - Check application is listening on correct port
611
+ - Verify health check endpoint returns 200
612
+ - Check security group allows ALB → instance traffic
613
+
614
+ ## Cost Optimization
615
+
616
+ ```yaml
617
+ # Use t3/t4g instances
618
+ # Enable auto-scaling to scale to zero during off-hours
619
+ # Use spot instances for dev/test
620
+ # Right-size based on CloudWatch metrics
621
+ ```
622
+
623
+ ## References
624
+
625
+ - [Elastic Beanstalk Documentation](https://docs.aws.amazon.com/elasticbeanstalk/)
626
+ - [EB CLI Reference](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html)
627
+ - [.ebextensions](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html)
628
+ - [Platform Hooks](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html)