@salza80/openclaw-aws 0.1.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.
- package/LICENSE +21 -0
- package/README.md +414 -0
- package/dist/cdk/app.d.ts +3 -0
- package/dist/cdk/app.d.ts.map +1 -0
- package/dist/cdk/app.js +60 -0
- package/dist/cdk/app.js.map +1 -0
- package/dist/cdk/stack.d.ts +16 -0
- package/dist/cdk/stack.d.ts.map +1 -0
- package/dist/cdk/stack.js +151 -0
- package/dist/cdk/stack.js.map +1 -0
- package/dist/cli/commands/connect.d.ts +7 -0
- package/dist/cli/commands/connect.d.ts.map +1 -0
- package/dist/cli/commands/connect.js +99 -0
- package/dist/cli/commands/connect.js.map +1 -0
- package/dist/cli/commands/current.d.ts +4 -0
- package/dist/cli/commands/current.d.ts.map +1 -0
- package/dist/cli/commands/current.js +18 -0
- package/dist/cli/commands/current.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts +8 -0
- package/dist/cli/commands/dashboard.d.ts.map +1 -0
- package/dist/cli/commands/dashboard.js +231 -0
- package/dist/cli/commands/dashboard.js.map +1 -0
- package/dist/cli/commands/deploy.d.ts +9 -0
- package/dist/cli/commands/deploy.d.ts.map +1 -0
- package/dist/cli/commands/deploy.js +380 -0
- package/dist/cli/commands/deploy.js.map +1 -0
- package/dist/cli/commands/destroy.d.ts +10 -0
- package/dist/cli/commands/destroy.d.ts.map +1 -0
- package/dist/cli/commands/destroy.js +359 -0
- package/dist/cli/commands/destroy.js.map +1 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +258 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +4 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +23 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +11 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +163 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/outputs.d.ts +7 -0
- package/dist/cli/commands/outputs.d.ts.map +1 -0
- package/dist/cli/commands/outputs.js +69 -0
- package/dist/cli/commands/outputs.js.map +1 -0
- package/dist/cli/commands/restart.d.ts +8 -0
- package/dist/cli/commands/restart.d.ts.map +1 -0
- package/dist/cli/commands/restart.js +91 -0
- package/dist/cli/commands/restart.js.map +1 -0
- package/dist/cli/commands/start.d.ts +7 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +80 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +12 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +244 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +8 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +86 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/use.d.ts +7 -0
- package/dist/cli/commands/use.d.ts.map +1 -0
- package/dist/cli/commands/use.js +26 -0
- package/dist/cli/commands/use.js.map +1 -0
- package/dist/cli/constants.d.ts +63 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +37 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +43 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/types/index.d.ts +47 -0
- package/dist/cli/types/index.d.ts.map +1 -0
- package/dist/cli/types/index.js +2 -0
- package/dist/cli/types/index.js.map +1 -0
- package/dist/cli/utils/api-keys.d.ts +6 -0
- package/dist/cli/utils/api-keys.d.ts.map +1 -0
- package/dist/cli/utils/api-keys.js +14 -0
- package/dist/cli/utils/api-keys.js.map +1 -0
- package/dist/cli/utils/aws-clients.d.ts +7 -0
- package/dist/cli/utils/aws-clients.d.ts.map +1 -0
- package/dist/cli/utils/aws-clients.js +13 -0
- package/dist/cli/utils/aws-clients.js.map +1 -0
- package/dist/cli/utils/aws-validation.d.ts +35 -0
- package/dist/cli/utils/aws-validation.d.ts.map +1 -0
- package/dist/cli/utils/aws-validation.js +266 -0
- package/dist/cli/utils/aws-validation.js.map +1 -0
- package/dist/cli/utils/aws.d.ts +17 -0
- package/dist/cli/utils/aws.d.ts.map +1 -0
- package/dist/cli/utils/aws.js +213 -0
- package/dist/cli/utils/aws.js.map +1 -0
- package/dist/cli/utils/cdk.d.ts +12 -0
- package/dist/cli/utils/cdk.d.ts.map +1 -0
- package/dist/cli/utils/cdk.js +52 -0
- package/dist/cli/utils/cdk.js.map +1 -0
- package/dist/cli/utils/cloud-init.d.ts +11 -0
- package/dist/cli/utils/cloud-init.d.ts.map +1 -0
- package/dist/cli/utils/cloud-init.js +104 -0
- package/dist/cli/utils/cloud-init.js.map +1 -0
- package/dist/cli/utils/config-store.d.ts +17 -0
- package/dist/cli/utils/config-store.d.ts.map +1 -0
- package/dist/cli/utils/config-store.js +85 -0
- package/dist/cli/utils/config-store.js.map +1 -0
- package/dist/cli/utils/config-validation.d.ts +4 -0
- package/dist/cli/utils/config-validation.d.ts.map +1 -0
- package/dist/cli/utils/config-validation.js +89 -0
- package/dist/cli/utils/config-validation.js.map +1 -0
- package/dist/cli/utils/config.d.ts +12 -0
- package/dist/cli/utils/config.d.ts.map +1 -0
- package/dist/cli/utils/config.js +80 -0
- package/dist/cli/utils/config.js.map +1 -0
- package/dist/cli/utils/context.d.ts +14 -0
- package/dist/cli/utils/context.d.ts.map +1 -0
- package/dist/cli/utils/context.js +28 -0
- package/dist/cli/utils/context.js.map +1 -0
- package/dist/cli/utils/ec2.d.ts +6 -0
- package/dist/cli/utils/ec2.d.ts.map +1 -0
- package/dist/cli/utils/ec2.js +103 -0
- package/dist/cli/utils/ec2.js.map +1 -0
- package/dist/cli/utils/errors.d.ts +23 -0
- package/dist/cli/utils/errors.d.ts.map +1 -0
- package/dist/cli/utils/errors.js +126 -0
- package/dist/cli/utils/errors.js.map +1 -0
- package/dist/cli/utils/logger.d.ts +9 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +25 -0
- package/dist/cli/utils/logger.js.map +1 -0
- package/dist/cli/utils/suggestions.d.ts +7 -0
- package/dist/cli/utils/suggestions.d.ts.map +1 -0
- package/dist/cli/utils/suggestions.js +44 -0
- package/dist/cli/utils/suggestions.js.map +1 -0
- package/dist/cli/utils/validation.d.ts +12 -0
- package/dist/cli/utils/validation.d.ts.map +1 -0
- package/dist/cli/utils/validation.js +52 -0
- package/dist/cli/utils/validation.js.map +1 -0
- package/package.json +96 -0
- package/templates/openclaw.config.json.template +23 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sally Mclean
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
# openclaw-aws
|
|
2
|
+
|
|
3
|
+
[](https://github.com/salza80/openclaw-aws/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
OpenClaw AWS is a CLI that makes it simple to provision and manage OpenClaw bots on AWS. It creates a minimal Ubuntu EC2 setup with secure SSM-only access.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Recommended: local install in your bot folder
|
|
11
|
+
mkdir my-openclaw-bot
|
|
12
|
+
cd my-openclaw-bot
|
|
13
|
+
npm init -y
|
|
14
|
+
npm install @salza80/openclaw-aws
|
|
15
|
+
npx openclaw-aws --help
|
|
16
|
+
|
|
17
|
+
# Alternative: run directly with npx (no install)
|
|
18
|
+
npx @salza80/openclaw-aws --help
|
|
19
|
+
|
|
20
|
+
# Alternative: install globally
|
|
21
|
+
npm install -g @salza80/openclaw-aws
|
|
22
|
+
openclaw-aws --help
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Initialize your bot with interactive prompts
|
|
29
|
+
# This will generate a config file
|
|
30
|
+
npx openclaw-aws init
|
|
31
|
+
|
|
32
|
+
# Deploy. -- That's it!
|
|
33
|
+
npx openclaw-aws deploy
|
|
34
|
+
|
|
35
|
+
# Wait for deploy to finish. View the status of your bot
|
|
36
|
+
npx openclaw-aws status
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If you installed locally, prefix commands with `npx openclaw-aws`.
|
|
40
|
+
|
|
41
|
+
To access your bot:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Open the dashboard to view in your browser (port forwarded via secure SSM - not public access)
|
|
45
|
+
openclaw-aws dashboard
|
|
46
|
+
# Opens http://localhost:18789 in your browser - short delay before it works - refresh browser after 5 seconds
|
|
47
|
+
|
|
48
|
+
# Or connect to the instance via SSM - for full terminal access
|
|
49
|
+
openclaw-aws connect
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
See the OpenClaw docs for ongoing configuration and usage guidance for your bot: [OpenClaw Documentation](https://docs.openclaw.ai/)
|
|
53
|
+
|
|
54
|
+
Managing multiple bots / instances:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# This will generate another config file
|
|
58
|
+
openclaw-aws init
|
|
59
|
+
# deploy it
|
|
60
|
+
openclaw-aws deploy
|
|
61
|
+
|
|
62
|
+
# List all bot configs
|
|
63
|
+
openclaw-aws list
|
|
64
|
+
|
|
65
|
+
# View status of the currently selected config
|
|
66
|
+
openclaw-aws status
|
|
67
|
+
# View status of all configs
|
|
68
|
+
openclaw-aws status --all
|
|
69
|
+
|
|
70
|
+
# See the currently selected config.
|
|
71
|
+
# Commands default to this config.
|
|
72
|
+
openclaw-aws current
|
|
73
|
+
|
|
74
|
+
# Select another config
|
|
75
|
+
openclaw-aws use <name>
|
|
76
|
+
|
|
77
|
+
# Run any command against a specific config or all configs with --name <name> or --all
|
|
78
|
+
|
|
79
|
+
# get help with commands
|
|
80
|
+
openclaw-aws --help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Prerequisites
|
|
84
|
+
|
|
85
|
+
- **Node.js 20+**
|
|
86
|
+
- **AWS CLI v2 installed and authenticated** (SSO recommended)
|
|
87
|
+
- Install AWS CLI v2: [AWS CLI install guide](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
|
|
88
|
+
- Configure SSO: [AWS CLI SSO setup guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html)
|
|
89
|
+
|
|
90
|
+
## Commands
|
|
91
|
+
|
|
92
|
+
### `openclaw-aws init`
|
|
93
|
+
|
|
94
|
+
Interactive setup wizard to create a config.
|
|
95
|
+
|
|
96
|
+
**Example:**
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
openclaw-aws init
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `openclaw-aws deploy`
|
|
103
|
+
|
|
104
|
+
Deploy infrastructure to AWS.
|
|
105
|
+
|
|
106
|
+
**Example:**
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
openclaw-aws deploy
|
|
110
|
+
openclaw-aws deploy --name my-bot
|
|
111
|
+
openclaw-aws deploy --all
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `openclaw-aws status`
|
|
115
|
+
|
|
116
|
+
Check deployment and instance status.
|
|
117
|
+
|
|
118
|
+
**Example:**
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
openclaw-aws status
|
|
122
|
+
openclaw-aws status --all
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### `openclaw-aws dashboard`
|
|
126
|
+
|
|
127
|
+
Forward port 18789 to access the OpenClaw dashboard locally.
|
|
128
|
+
|
|
129
|
+
**Example:**
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
openclaw-aws dashboard
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### `openclaw-aws connect`
|
|
136
|
+
|
|
137
|
+
Connect to your EC2 instance via SSM.
|
|
138
|
+
|
|
139
|
+
**Example:**
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
openclaw-aws connect
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### `openclaw-aws start`
|
|
146
|
+
|
|
147
|
+
Start a stopped instance.
|
|
148
|
+
|
|
149
|
+
**Example:**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
openclaw-aws start
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### `openclaw-aws stop`
|
|
156
|
+
|
|
157
|
+
Stop a running instance to save costs.
|
|
158
|
+
|
|
159
|
+
**Example:**
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
openclaw-aws stop
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `openclaw-aws restart`
|
|
166
|
+
|
|
167
|
+
Reboot the instance.
|
|
168
|
+
|
|
169
|
+
**Example:**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
openclaw-aws restart
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### `openclaw-aws outputs`
|
|
176
|
+
|
|
177
|
+
Show CloudFormation stack outputs.
|
|
178
|
+
|
|
179
|
+
**Example:**
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
openclaw-aws outputs --name my-bot
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### `openclaw-aws destroy`
|
|
186
|
+
|
|
187
|
+
Delete all AWS resources.
|
|
188
|
+
|
|
189
|
+
**Options:**
|
|
190
|
+
|
|
191
|
+
- `--name <name>` - Config name
|
|
192
|
+
- `--all` - Destroy all configs
|
|
193
|
+
- `--force` - Skip confirmation
|
|
194
|
+
- `--delete-config` - Delete configuration file
|
|
195
|
+
|
|
196
|
+
**Example:**
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
openclaw-aws destroy --name my-bot
|
|
200
|
+
openclaw-aws destroy --all
|
|
201
|
+
|
|
202
|
+
# Force delete without confirmation
|
|
203
|
+
openclaw-aws destroy --name my-bot --force
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### `openclaw-aws list`
|
|
207
|
+
|
|
208
|
+
List configs.
|
|
209
|
+
|
|
210
|
+
**Example:**
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
openclaw-aws list
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### `openclaw-aws current`
|
|
217
|
+
|
|
218
|
+
Show the current config.
|
|
219
|
+
|
|
220
|
+
**Example:**
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
openclaw-aws current
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### `openclaw-aws use`
|
|
227
|
+
|
|
228
|
+
Select a config.
|
|
229
|
+
|
|
230
|
+
**Example:**
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
openclaw-aws use my-bot
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
Configuration is created with the `init` command, and stored per config in `.openclaw-aws/configs/<name>.json`.
|
|
239
|
+
The current selection is stored in `.openclaw-aws/current.json`.
|
|
240
|
+
|
|
241
|
+
**Example configuration:**
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"version": "1.0",
|
|
246
|
+
"aws": {
|
|
247
|
+
"region": "us-east-1",
|
|
248
|
+
"profile": "default"
|
|
249
|
+
},
|
|
250
|
+
"instance": {
|
|
251
|
+
"type": "t3.micro",
|
|
252
|
+
"name": "openclaw-my-bot"
|
|
253
|
+
},
|
|
254
|
+
"network": {
|
|
255
|
+
"useDefaultVpc": true
|
|
256
|
+
},
|
|
257
|
+
"features": {
|
|
258
|
+
"cloudWatchLogs": true
|
|
259
|
+
},
|
|
260
|
+
"openclaw": {
|
|
261
|
+
"apiProvider": "anthropic-api-key"
|
|
262
|
+
},
|
|
263
|
+
"stack": {
|
|
264
|
+
"name": "OpenclawStack-my-bot"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Multiple Bots (Configs)
|
|
270
|
+
|
|
271
|
+
To manage multiple bots, create one config per bot and switch between them:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
openclaw-aws init --name bot-a
|
|
275
|
+
openclaw-aws init --name bot-b
|
|
276
|
+
openclaw-aws list
|
|
277
|
+
openclaw-aws use bot-b
|
|
278
|
+
openclaw-aws current
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Start/Stop (Cost Control)
|
|
282
|
+
|
|
283
|
+
Use `stop` to save costs when you don’t need the bot running, and `start` to resume.
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
openclaw-aws stop --name my-bot
|
|
287
|
+
openclaw-aws start --name my-bot
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Benefits & Setup
|
|
291
|
+
|
|
292
|
+
- **Ubuntu 24.04 LTS** on EC2
|
|
293
|
+
- **SSM-only access** (no SSH, no inbound ports)
|
|
294
|
+
- **Encrypted EBS** by default
|
|
295
|
+
- **IMDSv2 enforced** for metadata security
|
|
296
|
+
|
|
297
|
+
## Architecture
|
|
298
|
+
|
|
299
|
+
The deployment creates:
|
|
300
|
+
|
|
301
|
+
- **EC2 Instance** - Ubuntu 24.04 LTS, t3.micro (or your chosen type)
|
|
302
|
+
- IMDSv2 enforced (SSRF protection)
|
|
303
|
+
- Encrypted EBS volume (data at rest encryption)
|
|
304
|
+
- Public IP assigned (required for outbound connectivity)
|
|
305
|
+
- **Security Group** - Zero inbound rules (SSM access only, no SSH)
|
|
306
|
+
- **IAM Role** - Least-privilege with SSM access
|
|
307
|
+
- **VPC** - Uses default VPC by default (option to create new VPC)
|
|
308
|
+
|
|
309
|
+
## Security
|
|
310
|
+
|
|
311
|
+
- **No inbound ports** (SSM access only)
|
|
312
|
+
- **No SSH** (disabled by design)
|
|
313
|
+
- **Encrypted storage** with EBS
|
|
314
|
+
- **SSM sessions** are auditable in CloudTrail
|
|
315
|
+
|
|
316
|
+
### Troubleshooting - Instance not appearing in SSM
|
|
317
|
+
|
|
318
|
+
Wait 2-3 minutes after deployment. Check status:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
openclaw-aws status
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### "Config file not found"
|
|
325
|
+
|
|
326
|
+
Run the init command first:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
openclaw-aws init
|
|
330
|
+
openclaw-aws list
|
|
331
|
+
openclaw-aws use my-bot
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Deployment fails
|
|
335
|
+
|
|
336
|
+
Check AWS credentials:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
aws sts get-caller-identity
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Port forwarding fails
|
|
343
|
+
|
|
344
|
+
Ensure SSM plugin is installed and instance is ready:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
openclaw-aws status
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Restart instance if the gateway or SSM has crashed:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
openclaw-aws restart
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Development
|
|
357
|
+
|
|
358
|
+
For developers contributing to openclaw-aws:
|
|
359
|
+
|
|
360
|
+
### Setup
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# 1. Clone the repository
|
|
364
|
+
git clone https://github.com/salza80/openclaw-aws.git
|
|
365
|
+
cd openclaw-aws
|
|
366
|
+
|
|
367
|
+
# 2. Use Node 20+
|
|
368
|
+
nvm use
|
|
369
|
+
|
|
370
|
+
# 3. Install dependencies
|
|
371
|
+
npm install
|
|
372
|
+
|
|
373
|
+
# 4. Build the project
|
|
374
|
+
npm run build
|
|
375
|
+
|
|
376
|
+
# 5. Link for local testing
|
|
377
|
+
npm link
|
|
378
|
+
|
|
379
|
+
# 6. Test the CLI
|
|
380
|
+
openclaw-aws --help
|
|
381
|
+
openclaw-aws init
|
|
382
|
+
|
|
383
|
+
# 7. Watch mode for development (auto-rebuild on changes)
|
|
384
|
+
npm run watch
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Requirements for Development
|
|
388
|
+
|
|
389
|
+
- **Node.js 20+** (required by AWS SDK v3)
|
|
390
|
+
- **AWS CLI** with configured credentials
|
|
391
|
+
- **AWS account** with CDK bootstrapped
|
|
392
|
+
- All dependencies install automatically via `npm install`
|
|
393
|
+
|
|
394
|
+
### Testing Changes
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# After making changes, rebuild
|
|
398
|
+
npm run build
|
|
399
|
+
|
|
400
|
+
# Test locally in another folder (ie openclaw-aws-test)
|
|
401
|
+
openclaw-aws init
|
|
402
|
+
openclaw-aws deploy
|
|
403
|
+
|
|
404
|
+
# Or use watch mode for auto-rebuild
|
|
405
|
+
npm run watch
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## License
|
|
409
|
+
|
|
410
|
+
MIT
|
|
411
|
+
|
|
412
|
+
## Author
|
|
413
|
+
|
|
414
|
+
Sally Mclean <smclean17@gmail.com>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/cdk/app.ts"],"names":[],"mappings":""}
|
package/dist/cdk/app.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as cdk from 'aws-cdk-lib';
|
|
3
|
+
import { OpenClawStack } from './stack.js';
|
|
4
|
+
import { loadConfigByName } from '../cli/utils/config.js';
|
|
5
|
+
import { getApiKeyParamName, getGatewayTokenParamName } from '../cli/utils/api-keys.js';
|
|
6
|
+
// Load configuration
|
|
7
|
+
let config;
|
|
8
|
+
let configName;
|
|
9
|
+
try {
|
|
10
|
+
const envConfigName = process.env.OPENCLAW_CONFIG_NAME;
|
|
11
|
+
if (!envConfigName) {
|
|
12
|
+
console.error('Error loading configuration: OPENCLAW_CONFIG_NAME is required');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
configName = envConfigName;
|
|
16
|
+
config = loadConfigByName(configName);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.error('Error loading configuration:', error instanceof Error ? error.message : String(error));
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
// Determine API provider from config
|
|
23
|
+
const apiProvider = config.openclaw?.apiProvider || 'anthropic-api-key'; // Default to Anthropic if not set
|
|
24
|
+
const apiKeyParamName = getApiKeyParamName(configName, apiProvider);
|
|
25
|
+
const gatewayTokenParamName = getGatewayTokenParamName(configName);
|
|
26
|
+
// Parse instance type
|
|
27
|
+
function parseInstanceType(type) {
|
|
28
|
+
const [family, size] = type.split('.');
|
|
29
|
+
return {
|
|
30
|
+
class: family.toUpperCase(),
|
|
31
|
+
size: size.toUpperCase(),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Build stack config
|
|
35
|
+
const stackConfig = {
|
|
36
|
+
projectName: process.env.OPENCLAW_CONFIG_NAME ?? 'openclaw',
|
|
37
|
+
instanceName: config.instance.name,
|
|
38
|
+
instanceType: parseInstanceType(config.instance.type),
|
|
39
|
+
enableCloudWatchLogs: config.features.cloudWatchLogs,
|
|
40
|
+
useDefaultVpc: config.network.useDefaultVpc,
|
|
41
|
+
};
|
|
42
|
+
// Get configuration from environment (no model/sandbox in config anymore)
|
|
43
|
+
// Gateway port is fixed in the stack (18789)
|
|
44
|
+
// Create CDK app
|
|
45
|
+
const app = new cdk.App();
|
|
46
|
+
// Build stack props
|
|
47
|
+
const stackProps = {
|
|
48
|
+
config: stackConfig,
|
|
49
|
+
apiProvider,
|
|
50
|
+
apiKeyParamName,
|
|
51
|
+
gatewayTokenParamName,
|
|
52
|
+
useDefaultVpc: config.network.useDefaultVpc,
|
|
53
|
+
env: {
|
|
54
|
+
region: config.aws.region,
|
|
55
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
new OpenClawStack(app, config.stack.name, stackProps);
|
|
59
|
+
app.synth();
|
|
60
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/cdk/app.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAGxF,qBAAqB;AACrB,IAAI,MAAM,CAAC;AACX,IAAI,UAAkB,CAAC;AACvB,IAAI,CAAC;IACH,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,UAAU,GAAG,aAAa,CAAC;IAC3B,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CACX,8BAA8B,EAC9B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,qCAAqC;AACrC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,WAAW,IAAI,mBAAmB,CAAC,CAAC,kCAAkC;AAE3G,MAAM,eAAe,GAAG,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AACpE,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;AAEnE,sBAAsB;AACtB,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE;QAC3B,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE;KACzB,CAAC;AACJ,CAAC;AAED,qBAAqB;AACrB,MAAM,WAAW,GAAgB;IAC/B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,UAAU;IAC3D,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;IAClC,YAAY,EAAE,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IACrD,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc;IACpD,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa;CAC5C,CAAC;AAEF,0EAA0E;AAC1E,6CAA6C;AAE7C,iBAAiB;AACjB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;AAE1B,oBAAoB;AACpB,MAAM,UAAU,GAAuB;IACrC,MAAM,EAAE,WAAW;IACnB,WAAW;IACX,eAAe;IACf,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa;IAC3C,GAAG,EAAE;QACH,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM;QACzB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;KACzC;CACF,CAAC;AAEF,IAAI,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAEtD,GAAG,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
import type { StackConfig } from '../cli/types/index.js';
|
|
4
|
+
import type { Provider } from '../cli/types/index.js';
|
|
5
|
+
export interface OpenClawStackProps extends StackProps {
|
|
6
|
+
config: StackConfig;
|
|
7
|
+
apiProvider: Provider;
|
|
8
|
+
apiKeyParamName: string;
|
|
9
|
+
gatewayTokenParamName: string;
|
|
10
|
+
useDefaultVpc: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class OpenClawStack extends Stack {
|
|
13
|
+
constructor(scope: Construct, id: string, props: OpenClawStackProps);
|
|
14
|
+
}
|
|
15
|
+
export default OpenClawStack;
|
|
16
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/cdk/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAgBvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,QAAQ,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAsWpE;AAED,eAAe,aAAa,CAAC"}
|