gmab 0.1.1__tar.gz
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.
- gmab-0.1.1/LICENSE +21 -0
- gmab-0.1.1/PKG-INFO +350 -0
- gmab-0.1.1/README.md +322 -0
- gmab-0.1.1/gmab/__init__.py +7 -0
- gmab-0.1.1/gmab/cli.py +307 -0
- gmab-0.1.1/gmab/commands/__init__.py +5 -0
- gmab-0.1.1/gmab/commands/configure.py +238 -0
- gmab-0.1.1/gmab/commands/list.py +74 -0
- gmab-0.1.1/gmab/commands/spawn.py +51 -0
- gmab-0.1.1/gmab/commands/terminate.py +91 -0
- gmab-0.1.1/gmab/providers/__init__.py +36 -0
- gmab-0.1.1/gmab/providers/aws.py +387 -0
- gmab-0.1.1/gmab/providers/base.py +93 -0
- gmab-0.1.1/gmab/providers/hetzner.py +311 -0
- gmab-0.1.1/gmab/providers/linode.py +264 -0
- gmab-0.1.1/gmab/utils/__init__.py +5 -0
- gmab-0.1.1/gmab/utils/config_loader.py +108 -0
- gmab-0.1.1/gmab/utils/paths.py +53 -0
- gmab-0.1.1/gmab.egg-info/PKG-INFO +350 -0
- gmab-0.1.1/gmab.egg-info/SOURCES.txt +24 -0
- gmab-0.1.1/gmab.egg-info/dependency_links.txt +1 -0
- gmab-0.1.1/gmab.egg-info/entry_points.txt +2 -0
- gmab-0.1.1/gmab.egg-info/requires.txt +5 -0
- gmab-0.1.1/gmab.egg-info/top_level.txt +1 -0
- gmab-0.1.1/pyproject.toml +44 -0
- gmab-0.1.1/setup.cfg +4 -0
gmab-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Steve Cannivy (steve at roudeleiw dot lu)
|
|
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.
|
gmab-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: gmab
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Give Me A Box - CLI tool to spawn, list, and manage temporary cloud boxes
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/gmab
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/yourusername/gmab/issues
|
|
9
|
+
Keywords: cloud,cli,devops,aws,linode,hetzner
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: click>=8.0.0
|
|
24
|
+
Requires-Dist: requests>=2.28.0
|
|
25
|
+
Requires-Dist: boto3>=1.26.0
|
|
26
|
+
Requires-Dist: pathlib>=1.0.1
|
|
27
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
28
|
+
|
|
29
|
+
# GMAB (Give Me A Box) v0.1.1
|
|
30
|
+
|
|
31
|
+
A CLI tool to spawn, list, and manage temporary cloud boxes.
|
|
32
|
+
|
|
33
|
+
#### Why?
|
|
34
|
+
|
|
35
|
+
- Need a quick VPS for pentesting, bug bounty, or scanning?
|
|
36
|
+
- Want to run commands from a different IP without using your local machine?
|
|
37
|
+
- No need for manual cloud console interaction—just **gmab spawn**, and you're in!
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- Spawn temporary cloud instances that automatically expire
|
|
43
|
+
- List active instances across providers
|
|
44
|
+
- Terminate instances individually or in bulk
|
|
45
|
+
- Support for multiple cloud providers (Linode, AWS, Hetzner)
|
|
46
|
+
- Provider-agnostic command interface
|
|
47
|
+
- SSH key management
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### Using pip
|
|
52
|
+
|
|
53
|
+
The easiest way to install GMAB is directly from PyPI:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install gmab
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### From Source
|
|
60
|
+
|
|
61
|
+
You can also install directly from the source code:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Clone the repository
|
|
65
|
+
git clone https://github.com/yourusername/gmab.git
|
|
66
|
+
cd gmab
|
|
67
|
+
|
|
68
|
+
# Install the package
|
|
69
|
+
pip install .
|
|
70
|
+
|
|
71
|
+
# For development (editable mode)
|
|
72
|
+
pip install -e .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
Before you can use GMAB, you need to configure it with your provider credentials and preferences. You must run the `configure` command before using any other functionality.
|
|
77
|
+
|
|
78
|
+
### Interactive Configuration
|
|
79
|
+
|
|
80
|
+
Use the configure command to set up or modify your configuration:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Configure all settings and providers
|
|
84
|
+
gmab configure
|
|
85
|
+
|
|
86
|
+
# Configure a specific provider
|
|
87
|
+
gmab configure -p linode
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> **Note:** GMAB will only use providers that you've explicitly configured. If you don't configure a provider, GMAB will not attempt to use it, preventing any unnecessary API calls or errors.
|
|
91
|
+
|
|
92
|
+
### Viewing Configuration
|
|
93
|
+
|
|
94
|
+
You can view your current configuration using the `--print` flag:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gmab configure --print
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This will display:
|
|
101
|
+
- The location of your config files
|
|
102
|
+
- The contents of your configuration (with sensitive data masked)
|
|
103
|
+
- The current settings for all configured providers
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
### Spawn a new instance
|
|
108
|
+
```bash
|
|
109
|
+
# Using default provider
|
|
110
|
+
gmab spawn
|
|
111
|
+
|
|
112
|
+
# Specify a provider
|
|
113
|
+
gmab spawn --provider linode
|
|
114
|
+
gmab spawn --provider aws
|
|
115
|
+
gmab spawn --provider hetzner
|
|
116
|
+
|
|
117
|
+
# Override defaults
|
|
118
|
+
gmab spawn -p linode -r us-east -i linode/ubuntu22.04 -t 120
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### List instances
|
|
122
|
+
```bash
|
|
123
|
+
# List all instances
|
|
124
|
+
gmab list
|
|
125
|
+
|
|
126
|
+
# List instances for specific provider
|
|
127
|
+
gmab list --provider linode
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Terminate instances
|
|
131
|
+
```bash
|
|
132
|
+
# Terminate by ID or label
|
|
133
|
+
gmab terminate instance-123
|
|
134
|
+
gmab terminate my-instance-label
|
|
135
|
+
|
|
136
|
+
# Terminate multiple instances
|
|
137
|
+
gmab terminate instance-1 instance-2
|
|
138
|
+
|
|
139
|
+
# Terminate all instances
|
|
140
|
+
gmab terminate all
|
|
141
|
+
|
|
142
|
+
# Terminate expired instances
|
|
143
|
+
gmab terminate expired
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Provider-Specific Notes
|
|
147
|
+
|
|
148
|
+
### Linode
|
|
149
|
+
- Requires API key with full access
|
|
150
|
+
- Default instance type: Nanode 1GB
|
|
151
|
+
- Supports all regions
|
|
152
|
+
|
|
153
|
+
### AWS
|
|
154
|
+
- Requires access key and secret key
|
|
155
|
+
- Default instance type: t2.micro
|
|
156
|
+
- Creates VPC and security group if needed
|
|
157
|
+
- Supports all regions
|
|
158
|
+
|
|
159
|
+
### Hetzner
|
|
160
|
+
- Requires API token
|
|
161
|
+
- Default instance type: CPX11
|
|
162
|
+
- Supports all Hetzner Cloud regions
|
|
163
|
+
- Uses label-based instance tracking
|
|
164
|
+
|
|
165
|
+
## Best Practices
|
|
166
|
+
|
|
167
|
+
1. **SSH Key**: Use an ed25519 key pair for better security
|
|
168
|
+
```bash
|
|
169
|
+
ssh-keygen -t ed25519 -C "your_email@example.com"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
2. **Instance Lifetime**: Set reasonable expiration times and automatic cleanup
|
|
173
|
+
```bash
|
|
174
|
+
# Set lifetime when spawning
|
|
175
|
+
gmab spawn -t 60 # 60 minutes lifetime
|
|
176
|
+
|
|
177
|
+
# Set up automatic cleanup with cron (Linux/Mac)
|
|
178
|
+
# Run every hour to clean up expired instances
|
|
179
|
+
0 * * * * gmab terminate expired -y
|
|
180
|
+
|
|
181
|
+
# For Windows, use Task Scheduler to run:
|
|
182
|
+
# gmab.exe terminate expired -y
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
3. **Regular Cleanup**: Periodically check and terminate expired instances
|
|
186
|
+
```bash
|
|
187
|
+
gmab terminate expired
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
4. **Provider Organization**:
|
|
191
|
+
- AWS: Create a dedicated IAM user for GMAB
|
|
192
|
+
- Linode: Use a dedicated API key
|
|
193
|
+
- Hetzner: Create a dedicated project named "gmab" and generate the API token specifically for this project
|
|
194
|
+
|
|
195
|
+
5. **Security**:
|
|
196
|
+
- Store configuration files securely
|
|
197
|
+
- Don't commit provider credentials to version control
|
|
198
|
+
- Regularly rotate API keys and tokens
|
|
199
|
+
|
|
200
|
+
## Example Commands and Outputs
|
|
201
|
+
|
|
202
|
+
### List Command
|
|
203
|
+
```bash
|
|
204
|
+
$ gmab list
|
|
205
|
+
Provider Instance ID Label IP Address Status Region Image Time Left
|
|
206
|
+
=====================================================================================================================
|
|
207
|
+
linode 12345678 gmab-abc123def456 192.168.1.100 running us-east linode/ubuntu22.04 45m
|
|
208
|
+
aws i-0abc123def456789 gmab-def456abc789 10.0.1.100 running us-west-2 ami-123456789abc 30m
|
|
209
|
+
hetzner 98765432 gmab-ghi789jkl012 10.0.0.100 running nbg1 ubuntu-22.04 15m
|
|
210
|
+
aws i-0xyz987wvu654321 gmab-mno345pqr678 10.0.2.200 running (expired) us-east-1 ami-987654321xyz expired
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Terminate Command
|
|
214
|
+
```bash
|
|
215
|
+
$ gmab terminate gmab-abc123def456 i-0abc123def456789
|
|
216
|
+
Are you sure you want to terminate instances: 'gmab-abc123def456', 'i-0abc123def456789'? [y/N]: y
|
|
217
|
+
Terminated instance 'gmab-abc123def456' on 'linode'.
|
|
218
|
+
Terminated instance 'i-0abc123def456789' on 'aws'.
|
|
219
|
+
Successfully terminated 2 instance(s).
|
|
220
|
+
|
|
221
|
+
$ gmab terminate all
|
|
222
|
+
The following instances will be terminated:
|
|
223
|
+
- 98765432 (hetzner: gmab-ghi789jkl012)
|
|
224
|
+
- i-0xyz987wvu654321 (aws: gmab-mno345pqr678)
|
|
225
|
+
Do you want to proceed? [y/N]: y
|
|
226
|
+
Successfully terminated 2 instance(s).
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Terminate Expired Command
|
|
230
|
+
```bash
|
|
231
|
+
$ gmab terminate expired
|
|
232
|
+
The following expired instances will be terminated:
|
|
233
|
+
- i-0xyz987wvu654321 (aws: gmab-mno345pqr678)
|
|
234
|
+
Do you want to proceed? [y/N]: y
|
|
235
|
+
Successfully terminated 1 instance(s).
|
|
236
|
+
|
|
237
|
+
$ gmab terminate expired
|
|
238
|
+
No expired instances found.
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Configuration Storage
|
|
242
|
+
GMAB follows platform-specific standards for storing configuration:
|
|
243
|
+
|
|
244
|
+
- Linux/macOS: `~/.config/gmab/` or `$XDG_CONFIG_HOME/gmab/`
|
|
245
|
+
- Windows: `%APPDATA%\gmab\`
|
|
246
|
+
- Override: Set `GMAB_CONFIG_DIR` environment variable
|
|
247
|
+
|
|
248
|
+
Two main configuration files are used:
|
|
249
|
+
1. `config.json` - General settings (SSH key, default lifetime, default provider)
|
|
250
|
+
2. `providers.json` - Provider-specific credentials and defaults
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
### AWS Resources Created
|
|
254
|
+
When using AWS as a provider, GMAB automatically creates and manages the following resources:
|
|
255
|
+
|
|
256
|
+
1. **VPC (Virtual Private Cloud)**
|
|
257
|
+
- Named: 'gmab-vpc'
|
|
258
|
+
- CIDR: 10.0.0.0/16
|
|
259
|
+
- DNS hostnames enabled
|
|
260
|
+
|
|
261
|
+
2. **Internet Gateway**
|
|
262
|
+
- Named: 'gmab-igw'
|
|
263
|
+
- Attached to gmab-vpc
|
|
264
|
+
|
|
265
|
+
3. **Subnet**
|
|
266
|
+
- Named: 'gmab-subnet'
|
|
267
|
+
- CIDR: 10.0.1.0/24
|
|
268
|
+
- Auto-assign public IP enabled
|
|
269
|
+
|
|
270
|
+
4. **Route Table**
|
|
271
|
+
- Named: 'gmab-rt'
|
|
272
|
+
- Routes all traffic (0.0.0.0/0) through the internet gateway
|
|
273
|
+
- Associated with gmab-subnet
|
|
274
|
+
|
|
275
|
+
5. **Security Group**
|
|
276
|
+
- Named: 'gmab-sg'
|
|
277
|
+
- Inbound rules: SSH (port 22) from anywhere
|
|
278
|
+
- All resources are tagged with 'gmab=true'
|
|
279
|
+
|
|
280
|
+
### Provider Recommendations
|
|
281
|
+
While GMAB supports multiple cloud providers, it has been primarily developed and tested with Linode in mind. Linode typically offers:
|
|
282
|
+
|
|
283
|
+
- Faster instance provisioning times
|
|
284
|
+
- Simpler setup (no VPC/networking configuration needed)
|
|
285
|
+
- More straightforward API and authentication
|
|
286
|
+
- Lower costs for basic instances
|
|
287
|
+
- Consistent image names across regions (e.g., "linode/ubuntu22.04" works everywhere)
|
|
288
|
+
|
|
289
|
+
Hetzner Cloud provides similar ease of use and speed to Linode, with:
|
|
290
|
+
- Simple API and quick instance provisioning
|
|
291
|
+
- Consistent image names across regions
|
|
292
|
+
- Automatic network configuration
|
|
293
|
+
- Competitive pricing
|
|
294
|
+
|
|
295
|
+
AWS on the other hand adds some complexity due to:
|
|
296
|
+
- Network setup (VPC, subnet, security groups) required per region
|
|
297
|
+
- AMI IDs (image IDs) are different between regions
|
|
298
|
+
- Instance types may not be available in all regions
|
|
299
|
+
- Slower API responses and instance provisioning
|
|
300
|
+
- More complex authentication setup
|
|
301
|
+
|
|
302
|
+
For these reasons, when using GMAB with AWS we recommend:
|
|
303
|
+
- Stick to one region for all your instances
|
|
304
|
+
- Make sure your chosen AMI ID exists in your region
|
|
305
|
+
- Use modern instance types (t3.micro instead of t2.micro) for better region compatibility
|
|
306
|
+
- Configure your AWS credentials properly with sufficient permissions for VPC/networking
|
|
307
|
+
- Be patient as instance creation takes longer than other providers
|
|
308
|
+
|
|
309
|
+
If you're just getting started with GMAB, we recommend beginning with Linode or Hetzner for the simplest experience.
|
|
310
|
+
|
|
311
|
+
## Example configuration session:
|
|
312
|
+
```bash
|
|
313
|
+
$ gmab configure
|
|
314
|
+
Using config directory: /home/user/.config/gmab
|
|
315
|
+
|
|
316
|
+
Configuring general settings:
|
|
317
|
+
SSH public key path [~/.ssh/id_ed25519.pub]:
|
|
318
|
+
Default instance lifetime (minutes) [60]:
|
|
319
|
+
Default provider (linode, aws, hetzner) [linode]:
|
|
320
|
+
|
|
321
|
+
Do you want to configure linode? [Y/n]: y
|
|
322
|
+
|
|
323
|
+
Configuring linode provider:
|
|
324
|
+
API Key: your-api-key-here
|
|
325
|
+
Default region [nl-ams]:
|
|
326
|
+
Default instance type [g6-nanode-1]:
|
|
327
|
+
Default image [linode/ubuntu22.04]:
|
|
328
|
+
Default root password: your-root-password
|
|
329
|
+
|
|
330
|
+
Do you want to configure aws? [Y/n]: y
|
|
331
|
+
|
|
332
|
+
Configuring aws provider:
|
|
333
|
+
Access Key: your-access-key
|
|
334
|
+
Secret Key: your-secret-key
|
|
335
|
+
Default region [eu-west-1]:
|
|
336
|
+
Default image [ami-12345678]:
|
|
337
|
+
Default instance type [t2.micro]:
|
|
338
|
+
|
|
339
|
+
Do you want to configure hetzner? [Y/n]: n
|
|
340
|
+
|
|
341
|
+
Configuration completed successfully!
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Contributing
|
|
345
|
+
|
|
346
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
|
|
350
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
gmab-0.1.1/README.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# GMAB (Give Me A Box) v0.1.1
|
|
2
|
+
|
|
3
|
+
A CLI tool to spawn, list, and manage temporary cloud boxes.
|
|
4
|
+
|
|
5
|
+
#### Why?
|
|
6
|
+
|
|
7
|
+
- Need a quick VPS for pentesting, bug bounty, or scanning?
|
|
8
|
+
- Want to run commands from a different IP without using your local machine?
|
|
9
|
+
- No need for manual cloud console interaction—just **gmab spawn**, and you're in!
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Spawn temporary cloud instances that automatically expire
|
|
15
|
+
- List active instances across providers
|
|
16
|
+
- Terminate instances individually or in bulk
|
|
17
|
+
- Support for multiple cloud providers (Linode, AWS, Hetzner)
|
|
18
|
+
- Provider-agnostic command interface
|
|
19
|
+
- SSH key management
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### Using pip
|
|
24
|
+
|
|
25
|
+
The easiest way to install GMAB is directly from PyPI:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install gmab
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### From Source
|
|
32
|
+
|
|
33
|
+
You can also install directly from the source code:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Clone the repository
|
|
37
|
+
git clone https://github.com/yourusername/gmab.git
|
|
38
|
+
cd gmab
|
|
39
|
+
|
|
40
|
+
# Install the package
|
|
41
|
+
pip install .
|
|
42
|
+
|
|
43
|
+
# For development (editable mode)
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
Before you can use GMAB, you need to configure it with your provider credentials and preferences. You must run the `configure` command before using any other functionality.
|
|
49
|
+
|
|
50
|
+
### Interactive Configuration
|
|
51
|
+
|
|
52
|
+
Use the configure command to set up or modify your configuration:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Configure all settings and providers
|
|
56
|
+
gmab configure
|
|
57
|
+
|
|
58
|
+
# Configure a specific provider
|
|
59
|
+
gmab configure -p linode
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> **Note:** GMAB will only use providers that you've explicitly configured. If you don't configure a provider, GMAB will not attempt to use it, preventing any unnecessary API calls or errors.
|
|
63
|
+
|
|
64
|
+
### Viewing Configuration
|
|
65
|
+
|
|
66
|
+
You can view your current configuration using the `--print` flag:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
gmab configure --print
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This will display:
|
|
73
|
+
- The location of your config files
|
|
74
|
+
- The contents of your configuration (with sensitive data masked)
|
|
75
|
+
- The current settings for all configured providers
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
### Spawn a new instance
|
|
80
|
+
```bash
|
|
81
|
+
# Using default provider
|
|
82
|
+
gmab spawn
|
|
83
|
+
|
|
84
|
+
# Specify a provider
|
|
85
|
+
gmab spawn --provider linode
|
|
86
|
+
gmab spawn --provider aws
|
|
87
|
+
gmab spawn --provider hetzner
|
|
88
|
+
|
|
89
|
+
# Override defaults
|
|
90
|
+
gmab spawn -p linode -r us-east -i linode/ubuntu22.04 -t 120
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### List instances
|
|
94
|
+
```bash
|
|
95
|
+
# List all instances
|
|
96
|
+
gmab list
|
|
97
|
+
|
|
98
|
+
# List instances for specific provider
|
|
99
|
+
gmab list --provider linode
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Terminate instances
|
|
103
|
+
```bash
|
|
104
|
+
# Terminate by ID or label
|
|
105
|
+
gmab terminate instance-123
|
|
106
|
+
gmab terminate my-instance-label
|
|
107
|
+
|
|
108
|
+
# Terminate multiple instances
|
|
109
|
+
gmab terminate instance-1 instance-2
|
|
110
|
+
|
|
111
|
+
# Terminate all instances
|
|
112
|
+
gmab terminate all
|
|
113
|
+
|
|
114
|
+
# Terminate expired instances
|
|
115
|
+
gmab terminate expired
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Provider-Specific Notes
|
|
119
|
+
|
|
120
|
+
### Linode
|
|
121
|
+
- Requires API key with full access
|
|
122
|
+
- Default instance type: Nanode 1GB
|
|
123
|
+
- Supports all regions
|
|
124
|
+
|
|
125
|
+
### AWS
|
|
126
|
+
- Requires access key and secret key
|
|
127
|
+
- Default instance type: t2.micro
|
|
128
|
+
- Creates VPC and security group if needed
|
|
129
|
+
- Supports all regions
|
|
130
|
+
|
|
131
|
+
### Hetzner
|
|
132
|
+
- Requires API token
|
|
133
|
+
- Default instance type: CPX11
|
|
134
|
+
- Supports all Hetzner Cloud regions
|
|
135
|
+
- Uses label-based instance tracking
|
|
136
|
+
|
|
137
|
+
## Best Practices
|
|
138
|
+
|
|
139
|
+
1. **SSH Key**: Use an ed25519 key pair for better security
|
|
140
|
+
```bash
|
|
141
|
+
ssh-keygen -t ed25519 -C "your_email@example.com"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
2. **Instance Lifetime**: Set reasonable expiration times and automatic cleanup
|
|
145
|
+
```bash
|
|
146
|
+
# Set lifetime when spawning
|
|
147
|
+
gmab spawn -t 60 # 60 minutes lifetime
|
|
148
|
+
|
|
149
|
+
# Set up automatic cleanup with cron (Linux/Mac)
|
|
150
|
+
# Run every hour to clean up expired instances
|
|
151
|
+
0 * * * * gmab terminate expired -y
|
|
152
|
+
|
|
153
|
+
# For Windows, use Task Scheduler to run:
|
|
154
|
+
# gmab.exe terminate expired -y
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
3. **Regular Cleanup**: Periodically check and terminate expired instances
|
|
158
|
+
```bash
|
|
159
|
+
gmab terminate expired
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
4. **Provider Organization**:
|
|
163
|
+
- AWS: Create a dedicated IAM user for GMAB
|
|
164
|
+
- Linode: Use a dedicated API key
|
|
165
|
+
- Hetzner: Create a dedicated project named "gmab" and generate the API token specifically for this project
|
|
166
|
+
|
|
167
|
+
5. **Security**:
|
|
168
|
+
- Store configuration files securely
|
|
169
|
+
- Don't commit provider credentials to version control
|
|
170
|
+
- Regularly rotate API keys and tokens
|
|
171
|
+
|
|
172
|
+
## Example Commands and Outputs
|
|
173
|
+
|
|
174
|
+
### List Command
|
|
175
|
+
```bash
|
|
176
|
+
$ gmab list
|
|
177
|
+
Provider Instance ID Label IP Address Status Region Image Time Left
|
|
178
|
+
=====================================================================================================================
|
|
179
|
+
linode 12345678 gmab-abc123def456 192.168.1.100 running us-east linode/ubuntu22.04 45m
|
|
180
|
+
aws i-0abc123def456789 gmab-def456abc789 10.0.1.100 running us-west-2 ami-123456789abc 30m
|
|
181
|
+
hetzner 98765432 gmab-ghi789jkl012 10.0.0.100 running nbg1 ubuntu-22.04 15m
|
|
182
|
+
aws i-0xyz987wvu654321 gmab-mno345pqr678 10.0.2.200 running (expired) us-east-1 ami-987654321xyz expired
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Terminate Command
|
|
186
|
+
```bash
|
|
187
|
+
$ gmab terminate gmab-abc123def456 i-0abc123def456789
|
|
188
|
+
Are you sure you want to terminate instances: 'gmab-abc123def456', 'i-0abc123def456789'? [y/N]: y
|
|
189
|
+
Terminated instance 'gmab-abc123def456' on 'linode'.
|
|
190
|
+
Terminated instance 'i-0abc123def456789' on 'aws'.
|
|
191
|
+
Successfully terminated 2 instance(s).
|
|
192
|
+
|
|
193
|
+
$ gmab terminate all
|
|
194
|
+
The following instances will be terminated:
|
|
195
|
+
- 98765432 (hetzner: gmab-ghi789jkl012)
|
|
196
|
+
- i-0xyz987wvu654321 (aws: gmab-mno345pqr678)
|
|
197
|
+
Do you want to proceed? [y/N]: y
|
|
198
|
+
Successfully terminated 2 instance(s).
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Terminate Expired Command
|
|
202
|
+
```bash
|
|
203
|
+
$ gmab terminate expired
|
|
204
|
+
The following expired instances will be terminated:
|
|
205
|
+
- i-0xyz987wvu654321 (aws: gmab-mno345pqr678)
|
|
206
|
+
Do you want to proceed? [y/N]: y
|
|
207
|
+
Successfully terminated 1 instance(s).
|
|
208
|
+
|
|
209
|
+
$ gmab terminate expired
|
|
210
|
+
No expired instances found.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Configuration Storage
|
|
214
|
+
GMAB follows platform-specific standards for storing configuration:
|
|
215
|
+
|
|
216
|
+
- Linux/macOS: `~/.config/gmab/` or `$XDG_CONFIG_HOME/gmab/`
|
|
217
|
+
- Windows: `%APPDATA%\gmab\`
|
|
218
|
+
- Override: Set `GMAB_CONFIG_DIR` environment variable
|
|
219
|
+
|
|
220
|
+
Two main configuration files are used:
|
|
221
|
+
1. `config.json` - General settings (SSH key, default lifetime, default provider)
|
|
222
|
+
2. `providers.json` - Provider-specific credentials and defaults
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
### AWS Resources Created
|
|
226
|
+
When using AWS as a provider, GMAB automatically creates and manages the following resources:
|
|
227
|
+
|
|
228
|
+
1. **VPC (Virtual Private Cloud)**
|
|
229
|
+
- Named: 'gmab-vpc'
|
|
230
|
+
- CIDR: 10.0.0.0/16
|
|
231
|
+
- DNS hostnames enabled
|
|
232
|
+
|
|
233
|
+
2. **Internet Gateway**
|
|
234
|
+
- Named: 'gmab-igw'
|
|
235
|
+
- Attached to gmab-vpc
|
|
236
|
+
|
|
237
|
+
3. **Subnet**
|
|
238
|
+
- Named: 'gmab-subnet'
|
|
239
|
+
- CIDR: 10.0.1.0/24
|
|
240
|
+
- Auto-assign public IP enabled
|
|
241
|
+
|
|
242
|
+
4. **Route Table**
|
|
243
|
+
- Named: 'gmab-rt'
|
|
244
|
+
- Routes all traffic (0.0.0.0/0) through the internet gateway
|
|
245
|
+
- Associated with gmab-subnet
|
|
246
|
+
|
|
247
|
+
5. **Security Group**
|
|
248
|
+
- Named: 'gmab-sg'
|
|
249
|
+
- Inbound rules: SSH (port 22) from anywhere
|
|
250
|
+
- All resources are tagged with 'gmab=true'
|
|
251
|
+
|
|
252
|
+
### Provider Recommendations
|
|
253
|
+
While GMAB supports multiple cloud providers, it has been primarily developed and tested with Linode in mind. Linode typically offers:
|
|
254
|
+
|
|
255
|
+
- Faster instance provisioning times
|
|
256
|
+
- Simpler setup (no VPC/networking configuration needed)
|
|
257
|
+
- More straightforward API and authentication
|
|
258
|
+
- Lower costs for basic instances
|
|
259
|
+
- Consistent image names across regions (e.g., "linode/ubuntu22.04" works everywhere)
|
|
260
|
+
|
|
261
|
+
Hetzner Cloud provides similar ease of use and speed to Linode, with:
|
|
262
|
+
- Simple API and quick instance provisioning
|
|
263
|
+
- Consistent image names across regions
|
|
264
|
+
- Automatic network configuration
|
|
265
|
+
- Competitive pricing
|
|
266
|
+
|
|
267
|
+
AWS on the other hand adds some complexity due to:
|
|
268
|
+
- Network setup (VPC, subnet, security groups) required per region
|
|
269
|
+
- AMI IDs (image IDs) are different between regions
|
|
270
|
+
- Instance types may not be available in all regions
|
|
271
|
+
- Slower API responses and instance provisioning
|
|
272
|
+
- More complex authentication setup
|
|
273
|
+
|
|
274
|
+
For these reasons, when using GMAB with AWS we recommend:
|
|
275
|
+
- Stick to one region for all your instances
|
|
276
|
+
- Make sure your chosen AMI ID exists in your region
|
|
277
|
+
- Use modern instance types (t3.micro instead of t2.micro) for better region compatibility
|
|
278
|
+
- Configure your AWS credentials properly with sufficient permissions for VPC/networking
|
|
279
|
+
- Be patient as instance creation takes longer than other providers
|
|
280
|
+
|
|
281
|
+
If you're just getting started with GMAB, we recommend beginning with Linode or Hetzner for the simplest experience.
|
|
282
|
+
|
|
283
|
+
## Example configuration session:
|
|
284
|
+
```bash
|
|
285
|
+
$ gmab configure
|
|
286
|
+
Using config directory: /home/user/.config/gmab
|
|
287
|
+
|
|
288
|
+
Configuring general settings:
|
|
289
|
+
SSH public key path [~/.ssh/id_ed25519.pub]:
|
|
290
|
+
Default instance lifetime (minutes) [60]:
|
|
291
|
+
Default provider (linode, aws, hetzner) [linode]:
|
|
292
|
+
|
|
293
|
+
Do you want to configure linode? [Y/n]: y
|
|
294
|
+
|
|
295
|
+
Configuring linode provider:
|
|
296
|
+
API Key: your-api-key-here
|
|
297
|
+
Default region [nl-ams]:
|
|
298
|
+
Default instance type [g6-nanode-1]:
|
|
299
|
+
Default image [linode/ubuntu22.04]:
|
|
300
|
+
Default root password: your-root-password
|
|
301
|
+
|
|
302
|
+
Do you want to configure aws? [Y/n]: y
|
|
303
|
+
|
|
304
|
+
Configuring aws provider:
|
|
305
|
+
Access Key: your-access-key
|
|
306
|
+
Secret Key: your-secret-key
|
|
307
|
+
Default region [eu-west-1]:
|
|
308
|
+
Default image [ami-12345678]:
|
|
309
|
+
Default instance type [t2.micro]:
|
|
310
|
+
|
|
311
|
+
Do you want to configure hetzner? [Y/n]: n
|
|
312
|
+
|
|
313
|
+
Configuration completed successfully!
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Contributing
|
|
317
|
+
|
|
318
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
319
|
+
|
|
320
|
+
## License
|
|
321
|
+
|
|
322
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|