-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.html
More file actions
414 lines (371 loc) · 17.7 KB
/
cli.html
File metadata and controls
414 lines (371 loc) · 17.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5C3LL34WWW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-5C3LL34WWW');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CLI Reference - Local Web Services</title>
<meta name="description" content="Complete command reference for the ldk and lws CLI tools.">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
</head>
<body>
<nav class="nav">
<div class="container nav-inner">
<a href="index.html" class="nav-logo">Local Web Services</a>
<ul class="nav-links">
<li><a href="getting-started.html">Get Started</a></li>
<li><a href="sdks.html">SDKs</a></li>
<li><a href="services.html">Cloud Emulation</a></li>
<li><a href="faking.html">Faking Services</a></li>
<li><a href="chaos.html">Chaos Engineering</a></li>
<li><a href="cli.html" class="nav-active">CLI</a></li>
<li><a href="https://github.com/local-web-services/local-web-services" class="nav-github">GitHub</a></li>
</ul>
</div>
</nav>
<header class="page-header">
<div class="container">
<h1>CLI Reference</h1>
<p class="section-lead">Complete command reference for both <code>ldk</code> and <code>lws</code> tools.</p>
</div>
</header>
<section class="section">
<div class="container">
<h2>LDK Commands</h2>
<div class="cli-detail">
<div class="code-block"><code>uvx --from local-web-services ldk dev [OPTIONS]</code></div>
<h3>ldk dev</h3>
<p>Start the full local environment with hot-reload. Watches your source files and restarts handlers on change.</p>
<ul class="option-list">
<li><code>--port, -p</code> <span>API Gateway listen port (default: 3000)</span></li>
<li><code>--no-persist</code> <span>Disable data persistence — data is lost when ldk stops</span></li>
<li><code>--force-synth</code> <span>Force CDK synth even if cdk.out exists</span></li>
<li><code>--log-level, -l</code> <span>Log level: debug, info, warning, error (default: info)</span></li>
<li><code>--project-dir, -d</code> <span>Project root directory (default: current directory)</span></li>
<li><code>--mode, -m</code> <span>Project mode: cdk or terraform (default: auto-detect from project files)</span></li>
<li><code>--background, -b</code> <span>Run in the background as a detached process. Logs are written to <code>.lws/ldk-dev.log</code>. Stop with <code>ldk stop</code>.</span></li>
</ul>
</div>
<div class="cli-detail">
<div class="code-block"><code>uvx --from local-web-services ldk stop [OPTIONS]</code></div>
<h3>ldk stop</h3>
<p>Stop a background <code>ldk dev</code> session. Sends a graceful shutdown signal via the management API.</p>
<ul class="option-list">
<li><code>--port, -p</code> <span>Port of the running ldk dev instance to stop (default: 3000)</span></li>
</ul>
</div>
<div class="cli-detail">
<div class="code-block"><code>uvx --from local-web-services ldk invoke [OPTIONS]</code></div>
<h3>ldk invoke</h3>
<p>Invoke a Lambda function directly with a JSON event payload. Useful for testing handlers in isolation.</p>
<ul class="option-list">
<li><code>--function-name, -f</code> <span>Lambda function name (required)</span></li>
<li><code>--event, -e</code> <span>Inline JSON event payload</span></li>
<li><code>--event-file</code> <span>Path to JSON event file</span></li>
<li><code>--project-dir, -d</code> <span>Project root directory (default: current directory)</span></li>
<li><code>--port, -p</code> <span>Management API port to connect to running ldk dev</span></li>
</ul>
</div>
<div class="cli-detail">
<div class="code-block"><code>uvx --from local-web-services ldk reset [OPTIONS]</code></div>
<h3>ldk reset</h3>
<p>Clear all persisted local state — databases, queues, buckets. Start fresh.</p>
<ul class="option-list">
<li><code>--yes, -y</code> <span>Skip confirmation prompt</span></li>
<li><code>--project-dir, -d</code> <span>Project root directory (default: current directory)</span></li>
<li><code>--port, -p</code> <span>Management API port to notify running ldk dev</span></li>
</ul>
</div>
<div class="cli-detail">
<div class="code-block"><code>uvx --from local-web-services ldk setup SERVICE [OPTIONS]</code></div>
<h3>ldk setup</h3>
<p>Pull Docker images required for local service emulation. Currently supports <code>lambda</code> which pulls official AWS Lambda base images from ECR Public (includes AWS SDK pre-installed).</p>
<ul class="option-list">
<li><code>SERVICE</code> <span>Service to set up (currently: <code>lambda</code>)</span></li>
<li><code>--runtime, -r</code> <span>Pull only a specific runtime (e.g. <code>python3.12</code>, <code>nodejs20.x</code>)</span></li>
</ul>
<div class="code-block" style="margin-top: 12px;"><code># Pull all Lambda runtime images
uvx --from local-web-services ldk setup lambda
# Pull a specific runtime only
uvx --from local-web-services ldk setup lambda --runtime python3.12</code></div>
</div>
</div>
</section>
<section class="section section-alt">
<div class="container">
<h2>LWS Commands</h2>
<p class="section-lead">AWS CLI-style commands for interacting with your local services. Requires a running <code>ldk dev</code> instance.</p>
<div class="lws-command-grid">
<div class="lws-command">
<h4>lws init</h4>
<p>Initialize Claude Code integration. Creates CLAUDE.md context and slash commands for AI-assisted fake and chaos workflows.</p>
<div>
<span class="subcmd">--project-dir</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws init</code></div>
</div>
<div class="lws-command">
<h4>lws status</h4>
<p>Show the status of the running ldk dev instance and all providers.</p>
<div class="code-block"><code>uvx --from local-web-services lws status</code></div>
</div>
<div class="lws-command">
<h4>lws dynamodb</h4>
<p>DynamoDB table operations.</p>
<div>
<span class="subcmd">put-item</span>
<span class="subcmd">get-item</span>
<span class="subcmd">delete-item</span>
<span class="subcmd">scan</span>
<span class="subcmd">query</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws dynamodb scan \
--table-name MyTable</code></div>
</div>
<div class="lws-command">
<h4>lws sqs</h4>
<p>SQS queue operations.</p>
<div>
<span class="subcmd">send-message</span>
<span class="subcmd">receive-message</span>
<span class="subcmd">delete-message</span>
<span class="subcmd">get-queue-attributes</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws sqs receive-message \
--queue-name MyQueue</code></div>
</div>
<div class="lws-command">
<h4>lws s3api</h4>
<p>S3 bucket operations.</p>
<div>
<span class="subcmd">put-object</span>
<span class="subcmd">get-object</span>
<span class="subcmd">delete-object</span>
<span class="subcmd">list-objects-v2</span>
<span class="subcmd">head-object</span>
<span class="subcmd">put-bucket-website</span>
<span class="subcmd">get-bucket-website</span>
<span class="subcmd">delete-bucket-website</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws s3api list-objects-v2 \
--bucket my-bucket</code></div>
</div>
<div class="lws-command">
<h4>lws sns</h4>
<p>SNS topic operations.</p>
<div>
<span class="subcmd">publish</span>
<span class="subcmd">list-topics</span>
<span class="subcmd">list-subscriptions</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws sns publish \
--topic-name MyTopic \
--message "Hello"</code></div>
</div>
<div class="lws-command">
<h4>lws events</h4>
<p>EventBridge operations.</p>
<div>
<span class="subcmd">put-events</span>
<span class="subcmd">list-rules</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws events put-events \
--entries '[{...}]'</code></div>
</div>
<div class="lws-command">
<h4>lws stepfunctions</h4>
<p>Step Functions operations.</p>
<div>
<span class="subcmd">start-execution</span>
<span class="subcmd">describe-execution</span>
<span class="subcmd">list-executions</span>
<span class="subcmd">list-state-machines</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws stepfunctions start-execution \
--name MyStateMachine \
--input '{...}'</code></div>
</div>
<div class="lws-command">
<h4>lws cognito-idp</h4>
<p>Cognito User Pool operations.</p>
<div>
<span class="subcmd">sign-up</span>
<span class="subcmd">confirm-sign-up</span>
<span class="subcmd">initiate-auth</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws cognito-idp sign-up \
--user-pool-name MyPool \
--username user@example.com</code></div>
</div>
<div class="lws-command">
<h4>lws ssm</h4>
<p>SSM Parameter Store operations.</p>
<div>
<span class="subcmd">put-parameter</span>
<span class="subcmd">get-parameter</span>
<span class="subcmd">get-parameters-by-path</span>
<span class="subcmd">delete-parameter</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws ssm put-parameter \
--name /app/config/key \
--value "my-value" \
--type String</code></div>
</div>
<div class="lws-command">
<h4>lws secretsmanager</h4>
<p>Secrets Manager operations.</p>
<div>
<span class="subcmd">create-secret</span>
<span class="subcmd">get-secret-value</span>
<span class="subcmd">put-secret-value</span>
<span class="subcmd">list-secrets</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws secretsmanager create-secret \
--name MySecret \
--secret-string "my-secret-value"</code></div>
</div>
<div class="lws-command">
<h4>lws apigateway</h4>
<p>API Gateway test invocation.</p>
<div>
<span class="subcmd">test-invoke-method</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code>uvx --from local-web-services lws apigateway test-invoke-method \
--resource /orders \
--http-method GET</code></div>
</div>
<div class="lws-command">
<h4>lws fake</h4>
<p>Fake server management. Create and manage fake HTTP/GraphQL/gRPC servers for external API dependencies.</p>
<div>
<span class="subcmd">create</span>
<span class="subcmd">delete</span>
<span class="subcmd">list</span>
<span class="subcmd">status</span>
<span class="subcmd">add-route</span>
<span class="subcmd">remove-route</span>
<span class="subcmd">import-spec</span>
<span class="subcmd">validate</span>
<span class="subcmd">chaos</span>
<span class="subcmd">invoke</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code># Create a fake server
uvx --from local-web-services lws fake create --name stripe-api
# Add a route
uvx --from local-web-services lws fake add-route \
--name stripe-api \
--method POST --path /v1/charges \
--status 200 --body '{"id": "ch_{{uuid}}"}'
# Import from OpenAPI spec
uvx --from local-web-services lws fake import-spec \
--name stripe-api \
--spec openapi.yaml
# Enable chaos testing
uvx --from local-web-services lws fake chaos \
--name stripe-api \
--error-rate 0.1</code></div>
</div>
<div class="lws-command">
<h4>lws aws-fake</h4>
<p>AWS operation faking. Override individual AWS API operations with custom responses.</p>
<div>
<span class="subcmd">create</span>
<span class="subcmd">delete</span>
<span class="subcmd">list</span>
<span class="subcmd">status</span>
<span class="subcmd">add-operation</span>
<span class="subcmd">remove-operation</span>
<span class="subcmd">enable</span>
<span class="subcmd">disable</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code># Create an AWS fake for S3
uvx --from local-web-services lws aws-fake create my-s3-fake --service s3
# Fake a DynamoDB GetItem with a helper
uvx --from local-web-services lws aws-fake add-operation my-ddb-fake \
--operation get-item \
--item '{"id": "123", "name": "test"}'
# Fake an S3 GetObject
uvx --from local-web-services lws aws-fake add-operation my-s3-fake \
--operation get-object \
--body-string "Hello from S3"
# Enable/disable at runtime
uvx --from local-web-services lws aws-fake enable s3
uvx --from local-web-services lws aws-fake disable s3</code></div>
</div>
<div class="lws-command">
<h4>lws chaos</h4>
<p>Chaos engineering for AWS services. Inject errors, latency, timeouts, and connection resets into local service emulations.</p>
<div>
<span class="subcmd">enable</span>
<span class="subcmd">disable</span>
<span class="subcmd">set</span>
<span class="subcmd">status</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code># Enable chaos on DynamoDB
uvx --from local-web-services lws chaos enable dynamodb
# Set error rate and latency
uvx --from local-web-services lws chaos set dynamodb \
--error-rate 0.1 \
--latency-min 50 --latency-max 200
# Check status
uvx --from local-web-services lws chaos status
# Disable
uvx --from local-web-services lws chaos disable dynamodb</code></div>
</div>
<div class="lws-command">
<h4>lws iam-auth</h4>
<p>IAM authorization management. Audit, ignore, or enforce IAM permissions on local AWS services.</p>
<div>
<span class="subcmd">status</span>
<span class="subcmd">enable</span>
<span class="subcmd">disable</span>
<span class="subcmd">set</span>
<span class="subcmd">set-identity</span>
</div>
<div class="code-block" style="margin-top: 12px;"><code># Check IAM auth status
uvx --from local-web-services lws iam-auth status
# Enforce IAM on DynamoDB (deny unauthorized requests)
uvx --from local-web-services lws iam-auth set dynamodb --mode enforce
# Audit mode (log violations without blocking)
uvx --from local-web-services lws iam-auth set s3 --mode audit
# Switch active identity
uvx --from local-web-services lws iam-auth set-identity readonly-user
# Disable IAM auth for a service
uvx --from local-web-services lws iam-auth disable sqs</code></div>
</div>
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="footer-inner">
<div class="footer-brand">
<a href="index.html" class="nav-logo">Local Web Services</a>
<p>The fastest feedback loop for cloud-native development, for humans and AI alike</p>
</div>
<div class="footer-links">
<a href="https://github.com/local-web-services/local-web-services">GitHub</a>
<a href="https://github.com/local-web-services/local-web-services/tree/main/sample-project/cdk">CDK Sample</a>
<a href="https://github.com/local-web-services/local-web-services/tree/main/sample-project/hcl">Terraform Sample</a>
<a href="https://github.com/local-web-services/local-web-services/issues">Issues</a>
</div>
</div>
<p class="footer-copy">Open source under the MIT License.</p>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
<script src="lws.js"></script>
</body>
</html>