cloudx-proxy 0.8.2__tar.gz → 0.8.3__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.
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/CHANGELOG.md +2 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/CLAUDE.md +35 -5
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/PKG-INFO +183 -16
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/README.md +182 -15
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy/_version.py +2 -2
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy.egg-info/PKG-INFO +183 -16
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/.clinerules +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/.envrc +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/.github/dependabot.yml +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/.github/workflows/release.yml +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/.gitignore +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/.releaserc +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/CONTRIBUTING.md +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/LICENSE +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/NOTICE +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy/_1password.py +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy/__init__.py +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy/cli.py +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy/core.py +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy/setup.py +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy.egg-info/SOURCES.txt +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy.egg-info/dependency_links.txt +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy.egg-info/entry_points.txt +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy.egg-info/requires.txt +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/cloudx_proxy.egg-info/top_level.txt +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/pyproject.toml +0 -0
- {cloudx_proxy-0.8.2 → cloudx_proxy-0.8.3}/setup.cfg +0 -0
@@ -88,11 +88,41 @@ Commit message format affects version bumps:
|
|
88
88
|
|
89
89
|
### 1Password Integration
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
-
|
95
|
-
-
|
91
|
+
The `--1password` flag enables comprehensive SSH key management through 1Password's secure vault system and SSH agent. This integration provides a complete workflow for creating, managing, and using SSH keys without exposing private keys to the filesystem.
|
92
|
+
|
93
|
+
#### Prerequisites
|
94
|
+
- 1Password CLI installed and available in PATH
|
95
|
+
- User authenticated to 1Password (`op account list` succeeds)
|
96
|
+
- 1Password SSH agent enabled and running (`~/.1password/agent.sock` exists)
|
97
|
+
|
98
|
+
#### Key Discovery and Management Workflow
|
99
|
+
1. **Existing Key Search**: Searches all 1Password vaults for SSH keys matching the specified name
|
100
|
+
2. **Key Naming Convention**: Uses consistent naming with prefix "cloudX SSH Key - {keyname}"
|
101
|
+
3. **Vault Selection**:
|
102
|
+
- If vault specified via `--1password VaultName`, uses that vault
|
103
|
+
- If specified vault not found, prompts user to select from available vaults
|
104
|
+
- In interactive mode, displays all available vaults for selection
|
105
|
+
4. **Key Creation**: Creates new SSH key pair directly in 1Password vault if no existing key found
|
106
|
+
5. **Public Key Export**: Exports public key to filesystem at expected SSH config location
|
107
|
+
|
108
|
+
#### SSH Configuration Generated
|
109
|
+
When using 1Password integration, the SSH configuration includes:
|
110
|
+
- `IdentityAgent ~/.1password/agent.sock` - Points to 1Password SSH agent
|
111
|
+
- `IdentityFile {keyfile}.pub` - References public key file to limit key search
|
112
|
+
- `IdentitiesOnly yes` - Prevents SSH from trying other keys in agent
|
113
|
+
|
114
|
+
#### Error Handling and Fallbacks
|
115
|
+
- If 1Password CLI unavailable: Prompts user to continue with standard SSH key setup
|
116
|
+
- If authentication fails: Provides setup instructions and troubleshooting guidance
|
117
|
+
- If key creation fails: Falls back to standard SSH key generation
|
118
|
+
- If SSH agent unavailable: Warns user and provides configuration guidance
|
119
|
+
|
120
|
+
#### Security Benefits
|
121
|
+
- Private keys never touch the filesystem
|
122
|
+
- Centralized key management across devices
|
123
|
+
- Audit trail through 1Password logging
|
124
|
+
- Automatic key rotation capabilities
|
125
|
+
- Integration with 1Password's biometric authentication
|
96
126
|
|
97
127
|
### AWS Environment Support
|
98
128
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: cloudx-proxy
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.3
|
4
4
|
Summary: SSH proxy command to connect VSCode with Cloud9/CloudX instance using AWS Systems Manager
|
5
5
|
Author-email: easytocloud <info@easytocloud.com>
|
6
6
|
License: MIT License
|
@@ -73,25 +73,62 @@ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using
|
|
73
73
|
- SSH tunneling through AWS Systems Manager
|
74
74
|
- Cross-platform support (Windows, macOS, Linux)
|
75
75
|
|
76
|
+
## Quick Start
|
77
|
+
|
78
|
+
**TL;DR for experienced users:**
|
79
|
+
|
80
|
+
1. **Install Prerequisites:**
|
81
|
+
```bash
|
82
|
+
# Install Python 3.9+, AWS CLI v2, Session Manager plugin
|
83
|
+
pip install uv
|
84
|
+
```
|
85
|
+
|
86
|
+
2. **Run Setup:**
|
87
|
+
```bash
|
88
|
+
# Basic setup (will prompt for AWS profile, instance ID, etc.)
|
89
|
+
uvx cloudx-proxy setup
|
90
|
+
|
91
|
+
# Or non-interactive with all parameters
|
92
|
+
uvx cloudx-proxy setup --profile myprofile --instance i-1234567890abcdef0 --hostname myserver --yes
|
93
|
+
```
|
94
|
+
|
95
|
+
3. **Configure VSCode:**
|
96
|
+
- Install "Remote - SSH" extension
|
97
|
+
- Add to settings.json: `"remote.SSH.configFile": "~/.ssh/vscode/config"`
|
98
|
+
- Set SSH timeout: `"remote.SSH.connectTimeout": 90`
|
99
|
+
|
100
|
+
4. **Connect:**
|
101
|
+
- Open VSCode Remote Explorer → SSH Targets
|
102
|
+
- Connect to `cloudx-{env}-{hostname}` (e.g., `cloudx-dev-myserver`)
|
103
|
+
|
104
|
+
**First connection takes 2-3 minutes (instance startup + VSCode server install). Subsequent connections are much faster (~30s).**
|
105
|
+
|
106
|
+
---
|
107
|
+
|
76
108
|
## Prerequisites
|
77
109
|
|
78
|
-
1. **
|
110
|
+
1. **Python 3.9+** - Required for cloudX-proxy and uv package manager
|
111
|
+
- [Python Installation Guide](https://www.python.org/downloads/)
|
112
|
+
- Check your version: `python --version` or `python3 --version`
|
113
|
+
- Supports Python 3.9, 3.10, 3.11, 3.12+
|
114
|
+
|
115
|
+
2. **AWS CLI v2** - Used to configure AWS profiles and credentials
|
79
116
|
- [Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
|
80
117
|
- Required for `aws configure` during setup
|
81
118
|
- Handles AWS credentials and region configuration
|
82
119
|
|
83
|
-
|
120
|
+
3. **AWS Session Manager Plugin** - Enables secure tunneling through AWS Systems Manager
|
84
121
|
- [Installation Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
|
85
122
|
- Provides the secure connection channel
|
86
123
|
- No need for public IP addresses or direct SSH access
|
87
124
|
|
88
|
-
|
125
|
+
4. **OpenSSH Client** - Handles SSH key management and connections
|
89
126
|
- Windows: [Microsoft's OpenSSH Installation Guide](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui)
|
90
127
|
- macOS/Linux: Usually pre-installed
|
91
128
|
- Manages SSH keys and configurations
|
92
129
|
- Provides the SSH client for VSCode Remote
|
93
130
|
|
94
|
-
|
131
|
+
5. **uv** - Modern Python package installer and virtual environment manager
|
95
132
|
```bash
|
96
133
|
pip install uv
|
97
134
|
```
|
@@ -102,7 +139,7 @@ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using
|
|
102
139
|
|
103
140
|
This means you can run cloudX-proxy directly with `uvx cloudx-proxy` without manually managing virtual environments or dependencies.
|
104
141
|
|
105
|
-
|
142
|
+
6. **VSCode with Remote SSH Extension** - Your development environment
|
106
143
|
- Provides the integrated development environment
|
107
144
|
- Uses the SSH configuration to connect to instances
|
108
145
|
- Handles file synchronization and terminal sessions
|
@@ -265,15 +302,91 @@ This architecture means that:
|
|
265
302
|
|
266
303
|
### VSCode Configuration
|
267
304
|
|
268
|
-
|
269
|
-
|
305
|
+
After completing the setup, configure VSCode to use the SSH configuration created by cloudX-proxy:
|
306
|
+
|
307
|
+
1. **Install VSCode Extensions:**
|
308
|
+
- Install the "Remote - SSH" extension from the VSCode marketplace
|
309
|
+
- Optionally install "Remote Explorer" for better visualization
|
310
|
+
|
311
|
+
2. **Configure VSCode Settings:**
|
312
|
+
Add these settings to your VSCode settings.json (Command Palette → "Preferences: Open Settings (JSON)"):
|
270
313
|
```json
|
271
314
|
{
|
272
315
|
"remote.SSH.configFile": "~/.ssh/vscode/config",
|
273
|
-
"remote.SSH.connectTimeout": 90
|
316
|
+
"remote.SSH.connectTimeout": 90,
|
317
|
+
"remote.SSH.serverInstallTimeout": 120,
|
318
|
+
"remote.SSH.showLoginTerminal": true,
|
319
|
+
"remote.SSH.remotePlatform": {
|
320
|
+
"cloudx-*": "linux"
|
321
|
+
}
|
274
322
|
}
|
275
323
|
```
|
276
|
-
|
324
|
+
|
325
|
+
3. **Configuration Explanations:**
|
326
|
+
- `configFile`: Points to the SSH config created by cloudX-proxy setup
|
327
|
+
- `connectTimeout`: Extended timeout (90s) for instance startup and connection establishment
|
328
|
+
- `serverInstallTimeout`: Additional time (120s) for VSCode server installation on first connect
|
329
|
+
- `showLoginTerminal`: Shows connection progress for troubleshooting
|
330
|
+
- `remotePlatform`: Tells VSCode that cloudx hosts are Linux systems
|
331
|
+
|
332
|
+
4. **Custom SSH Config Location:**
|
333
|
+
If you used `--ssh-config` during setup, update the `configFile` path accordingly:
|
334
|
+
```json
|
335
|
+
{
|
336
|
+
"remote.SSH.configFile": "~/.ssh/cloudx/config"
|
337
|
+
}
|
338
|
+
```
|
339
|
+
|
340
|
+
### How Connections Work
|
341
|
+
|
342
|
+
Understanding the connection flow helps with troubleshooting and explains why certain timeouts are necessary:
|
343
|
+
|
344
|
+
#### Step-by-Step Connection Process
|
345
|
+
|
346
|
+
1. **VSCode Initiates SSH Connection**
|
347
|
+
- User clicks "Connect" or runs `ssh cloudx-{env}-{hostname}`
|
348
|
+
- SSH reads the configuration and calls cloudX-proxy as ProxyCommand
|
349
|
+
|
350
|
+
2. **AWS Authentication & Instance Check**
|
351
|
+
- cloudX-proxy authenticates using the specified AWS profile
|
352
|
+
- Checks if the target EC2 instance exists and is accessible
|
353
|
+
- Verifies SSM agent is installed and running on the instance
|
354
|
+
|
355
|
+
3. **Instance Startup (if needed)**
|
356
|
+
- If instance is stopped, cloudX-proxy starts it automatically
|
357
|
+
- Waits for instance to reach "running" state (typically 30-60 seconds)
|
358
|
+
- Monitors SSM connectivity until agent responds
|
359
|
+
|
360
|
+
4. **SSH Key Distribution**
|
361
|
+
- Reads the public SSH key from the local filesystem
|
362
|
+
- Pushes the public key to the instance using EC2 Instance Connect
|
363
|
+
- Key is temporarily authorized for the current session (60 seconds)
|
364
|
+
|
365
|
+
5. **SSM Tunnel Establishment**
|
366
|
+
- Creates a secure tunnel through AWS Systems Manager
|
367
|
+
- Port forwards local port to instance port 22 (SSH)
|
368
|
+
- Tunnel handles all network traffic encryption
|
369
|
+
|
370
|
+
6. **SSH Connection Completion**
|
371
|
+
- SSH client connects through the established tunnel
|
372
|
+
- Authenticates using the private SSH key
|
373
|
+
- VSCode completes the remote connection setup
|
374
|
+
|
375
|
+
#### Why Timeouts Are Important
|
376
|
+
|
377
|
+
- **Connect Timeout (90s)**: Accounts for instance startup + tunnel establishment
|
378
|
+
- **Server Install Timeout (120s)**: VSCode server download and installation on first connect
|
379
|
+
- **Instance startup can take 30-90 seconds** depending on instance type and size
|
380
|
+
- **Network conditions** may require additional time for AWS API calls
|
381
|
+
|
382
|
+
#### Connection Indicators
|
383
|
+
|
384
|
+
- **"Starting instance..."** - EC2 instance is being started
|
385
|
+
- **"Waiting for SSM connectivity..."** - Instance is starting, SSM agent not ready yet
|
386
|
+
- **"Pushing SSH key..."** - Distributing public key via EC2 Instance Connect
|
387
|
+
- **"Starting session..."** - Creating SSM tunnel
|
388
|
+
- **VSCode "Installing server..."** - First-time setup of VSCode remote server
|
389
|
+
|
277
390
|
## Usage
|
278
391
|
|
279
392
|
### Command Line Options
|
@@ -287,7 +400,7 @@ Options:
|
|
287
400
|
- `--profile` (default: vscode): AWS profile to use. The profile's IAM user should follow the format cloudX-{env}-{user}. The environment part will be used as the default environment during setup.
|
288
401
|
- `--ssh-key` (default: vscode): Name of the SSH key to create/use. The key will be stored in the SSH config directory. This same name can be used in the connect command.
|
289
402
|
- `--ssh-config` (optional): Path to the SSH config file to use. If specified, configuration and keys will be stored in this location. Default is ~/.ssh/vscode/config.
|
290
|
-
- `--1password` (optional): Enable 1Password SSH agent integration. Can be used as a flag or with a vault name (e.g., `--1password Private`).
|
403
|
+
- `--1password` (optional): Enable 1Password SSH agent integration. Can be used as a flag or with a vault name (e.g., `--1password Private`). First searches all vaults for existing keys with name "cloudX SSH Key - {keyname}". If no existing key found, creates new keys directly in the specified (or selected) 1Password vault and configures SSH to use the 1Password SSH agent. If a vault name is specified, that vault will be used for key storage; otherwise, prompts user to select from available vaults. By default, the "Private" vault is used when no vault specified. Note that only the "Private" vault is enabled for SSH by default in 1Password settings - other vaults must be manually enabled in 1Password SSH agent settings.
|
291
404
|
- `--aws-env` (optional): AWS environment directory to use. If specified, AWS configuration and credentials will be read from ~/.aws/aws-envs/{env}/.
|
292
405
|
- `--instance` (optional): EC2 instance ID to set up connection for. If provided, skips the instance ID prompt.
|
293
406
|
- `--hostname` (optional): Hostname to use for SSH configuration. If not provided, a hostname will be generated from the instance ID in non-interactive mode or prompted for in interactive mode.
|
@@ -405,20 +518,36 @@ These permissions are required to bootstrap the instance, so that after creation
|
|
405
518
|
|
406
519
|
## Troubleshooting
|
407
520
|
|
408
|
-
|
521
|
+
### Common Issues
|
522
|
+
|
523
|
+
1. **Python/Installation Issues**
|
524
|
+
- **Error: "python not found"** - Ensure Python 3.9+ is installed and in PATH
|
525
|
+
- **Error: "uvx command not found"** - Install uv: `pip install uv`
|
526
|
+
- **Error: "Package not found"** - Try updating uv: `pip install --upgrade uv`
|
527
|
+
- **ImportError/ModuleNotFoundError** - Check Python version compatibility (`python --version`)
|
528
|
+
|
529
|
+
2. **Setup Issues**
|
409
530
|
- If AWS profile validation fails, ensure your user ARN matches the cloudX-{env}-{user} format
|
410
531
|
- For 1Password integration, ensure the CLI is installed and you're signed in
|
411
532
|
- Check that ~/.ssh/vscode directory has proper permissions (700)
|
412
533
|
- Verify main ~/.ssh/config is writable
|
413
534
|
|
414
|
-
2. **Connection
|
535
|
+
2. **VSCode Connection Issues**
|
536
|
+
- **Error: "Could not establish connection"** - Check VSCode SSH config file path in settings
|
537
|
+
- **Error: "Host not found"** - Run `uvx cloudx-proxy list` to verify host configuration
|
538
|
+
- **Timeout during connection** - Instance may be starting up (wait 2-3 minutes)
|
539
|
+
- **"Installing server" hangs** - Increase `serverInstallTimeout` to 180+ seconds
|
540
|
+
- **Connection works in terminal but not VSCode** - Verify `remote.SSH.configFile` setting
|
541
|
+
|
542
|
+
3. **Connection Timeout**
|
415
543
|
- Ensure the instance has the SSM agent installed and running
|
416
544
|
- Check that your AWS credentials have the required permissions
|
417
545
|
- Verify the instance ID is correct
|
418
546
|
- Increase the VSCode SSH timeout if needed
|
419
547
|
- Check if the instance is starting up (can take several minutes)
|
548
|
+
- **Region mismatch** - Ensure AWS profile region matches instance location
|
420
549
|
|
421
|
-
|
550
|
+
4. **SSH Key Issues**
|
422
551
|
- If using 1Password SSH agent, verify agent is running (~/.1password/agent.sock exists)
|
423
552
|
- Check file permissions (600 for private key, 644 for public key)
|
424
553
|
- Verify the public key is being successfully pushed to the instance
|
@@ -427,21 +556,59 @@ These permissions are required to bootstrap the instance, so that after creation
|
|
427
556
|
* SSH agent is enabled in 1Password settings
|
428
557
|
* Keys are added to the SSH agent in 1Password
|
429
558
|
* The key is visible with `op item list --categories "SSH Key"`
|
559
|
+
* Keys follow the naming convention "cloudX SSH Key - {keyname}" for automatic discovery
|
430
560
|
* If using a vault other than "Private", ensure that vault is enabled for SSH in 1Password settings
|
431
561
|
* By default, only the "Private" vault is enabled for SSH in 1Password
|
432
562
|
|
433
|
-
|
563
|
+
5. **AWS CLI and Credentials Issues**
|
564
|
+
- **Error: "aws command not found"** - Install AWS CLI v2 (not v1)
|
565
|
+
- **Error: "Unable to locate credentials"** - Run `aws configure` to set up credentials
|
566
|
+
- **Error: "Access Denied"** - Check IAM permissions and user ARN format
|
567
|
+
- **Error: "Region not specified"** - Set default region in AWS profile or use `--region`
|
568
|
+
- **Profile not found** - Verify profile exists: `aws configure list-profiles`
|
569
|
+
- **Session token expired** - For SSO/temporary credentials, re-authenticate
|
570
|
+
|
571
|
+
6. **AWS Configuration**
|
434
572
|
- Confirm AWS CLI is configured with valid credentials
|
435
573
|
- Default region is eu-west-1 if not specified in profile or command line
|
436
574
|
- If using AWS profile organizer, ensure your environment directory exists at `~/.aws/aws-envs/<environment>/`
|
437
575
|
- Verify the Session Manager plugin is installed correctly
|
438
576
|
- Check that the instance has the required IAM role for SSM
|
439
577
|
|
440
|
-
|
578
|
+
7. **Session Manager Plugin Issues**
|
579
|
+
- **Error: "Session Manager plugin not found"** - Install the Session Manager plugin
|
580
|
+
- **Error: "Invalid session"** - Check SSM agent status on instance: `sudo systemctl status amazon-ssm-agent`
|
581
|
+
- **Plugin installation on macOS** - May need to add plugin to PATH manually
|
582
|
+
- **Plugin installation on Windows** - Restart terminal after installation
|
583
|
+
|
584
|
+
8. **Instance Setup Status**
|
441
585
|
- If setup appears stuck, check /home/ec2-user/.install-running exists
|
442
586
|
- Verify /home/ec2-user/.install-done is created upon completion
|
443
587
|
- Check instance system logs for setup script errors
|
444
588
|
|
589
|
+
### Diagnostic Commands
|
590
|
+
|
591
|
+
If you're experiencing issues, run these commands to gather diagnostic information:
|
592
|
+
|
593
|
+
```bash
|
594
|
+
# Check Python and uv versions
|
595
|
+
python --version
|
596
|
+
uvx --version
|
597
|
+
|
598
|
+
# Verify AWS CLI and credentials
|
599
|
+
aws --version
|
600
|
+
aws sts get-caller-identity --profile your-profile
|
601
|
+
|
602
|
+
# Test Session Manager plugin
|
603
|
+
aws ssm start-session --target i-1234567890abcdef0 --profile your-profile
|
604
|
+
|
605
|
+
# List configured SSH hosts
|
606
|
+
uvx cloudx-proxy list --detailed
|
607
|
+
|
608
|
+
# Test direct connection (replace with your values)
|
609
|
+
uvx cloudx-proxy connect i-1234567890abcdef0 22 --profile your-profile
|
610
|
+
```
|
611
|
+
|
445
612
|
## License
|
446
613
|
|
447
614
|
MIT License - see LICENSE file for details
|
@@ -20,25 +20,62 @@ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using
|
|
20
20
|
- SSH tunneling through AWS Systems Manager
|
21
21
|
- Cross-platform support (Windows, macOS, Linux)
|
22
22
|
|
23
|
+
## Quick Start
|
24
|
+
|
25
|
+
**TL;DR for experienced users:**
|
26
|
+
|
27
|
+
1. **Install Prerequisites:**
|
28
|
+
```bash
|
29
|
+
# Install Python 3.9+, AWS CLI v2, Session Manager plugin
|
30
|
+
pip install uv
|
31
|
+
```
|
32
|
+
|
33
|
+
2. **Run Setup:**
|
34
|
+
```bash
|
35
|
+
# Basic setup (will prompt for AWS profile, instance ID, etc.)
|
36
|
+
uvx cloudx-proxy setup
|
37
|
+
|
38
|
+
# Or non-interactive with all parameters
|
39
|
+
uvx cloudx-proxy setup --profile myprofile --instance i-1234567890abcdef0 --hostname myserver --yes
|
40
|
+
```
|
41
|
+
|
42
|
+
3. **Configure VSCode:**
|
43
|
+
- Install "Remote - SSH" extension
|
44
|
+
- Add to settings.json: `"remote.SSH.configFile": "~/.ssh/vscode/config"`
|
45
|
+
- Set SSH timeout: `"remote.SSH.connectTimeout": 90`
|
46
|
+
|
47
|
+
4. **Connect:**
|
48
|
+
- Open VSCode Remote Explorer → SSH Targets
|
49
|
+
- Connect to `cloudx-{env}-{hostname}` (e.g., `cloudx-dev-myserver`)
|
50
|
+
|
51
|
+
**First connection takes 2-3 minutes (instance startup + VSCode server install). Subsequent connections are much faster (~30s).**
|
52
|
+
|
53
|
+
---
|
54
|
+
|
23
55
|
## Prerequisites
|
24
56
|
|
25
|
-
1. **
|
57
|
+
1. **Python 3.9+** - Required for cloudX-proxy and uv package manager
|
58
|
+
- [Python Installation Guide](https://www.python.org/downloads/)
|
59
|
+
- Check your version: `python --version` or `python3 --version`
|
60
|
+
- Supports Python 3.9, 3.10, 3.11, 3.12+
|
61
|
+
|
62
|
+
2. **AWS CLI v2** - Used to configure AWS profiles and credentials
|
26
63
|
- [Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
|
27
64
|
- Required for `aws configure` during setup
|
28
65
|
- Handles AWS credentials and region configuration
|
29
66
|
|
30
|
-
|
67
|
+
3. **AWS Session Manager Plugin** - Enables secure tunneling through AWS Systems Manager
|
31
68
|
- [Installation Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
|
32
69
|
- Provides the secure connection channel
|
33
70
|
- No need for public IP addresses or direct SSH access
|
34
71
|
|
35
|
-
|
72
|
+
4. **OpenSSH Client** - Handles SSH key management and connections
|
36
73
|
- Windows: [Microsoft's OpenSSH Installation Guide](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui)
|
37
74
|
- macOS/Linux: Usually pre-installed
|
38
75
|
- Manages SSH keys and configurations
|
39
76
|
- Provides the SSH client for VSCode Remote
|
40
77
|
|
41
|
-
|
78
|
+
5. **uv** - Modern Python package installer and virtual environment manager
|
42
79
|
```bash
|
43
80
|
pip install uv
|
44
81
|
```
|
@@ -49,7 +86,7 @@ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using
|
|
49
86
|
|
50
87
|
This means you can run cloudX-proxy directly with `uvx cloudx-proxy` without manually managing virtual environments or dependencies.
|
51
88
|
|
52
|
-
|
89
|
+
6. **VSCode with Remote SSH Extension** - Your development environment
|
53
90
|
- Provides the integrated development environment
|
54
91
|
- Uses the SSH configuration to connect to instances
|
55
92
|
- Handles file synchronization and terminal sessions
|
@@ -212,15 +249,91 @@ This architecture means that:
|
|
212
249
|
|
213
250
|
### VSCode Configuration
|
214
251
|
|
215
|
-
|
216
|
-
|
252
|
+
After completing the setup, configure VSCode to use the SSH configuration created by cloudX-proxy:
|
253
|
+
|
254
|
+
1. **Install VSCode Extensions:**
|
255
|
+
- Install the "Remote - SSH" extension from the VSCode marketplace
|
256
|
+
- Optionally install "Remote Explorer" for better visualization
|
257
|
+
|
258
|
+
2. **Configure VSCode Settings:**
|
259
|
+
Add these settings to your VSCode settings.json (Command Palette → "Preferences: Open Settings (JSON)"):
|
217
260
|
```json
|
218
261
|
{
|
219
262
|
"remote.SSH.configFile": "~/.ssh/vscode/config",
|
220
|
-
"remote.SSH.connectTimeout": 90
|
263
|
+
"remote.SSH.connectTimeout": 90,
|
264
|
+
"remote.SSH.serverInstallTimeout": 120,
|
265
|
+
"remote.SSH.showLoginTerminal": true,
|
266
|
+
"remote.SSH.remotePlatform": {
|
267
|
+
"cloudx-*": "linux"
|
268
|
+
}
|
221
269
|
}
|
222
270
|
```
|
223
|
-
|
271
|
+
|
272
|
+
3. **Configuration Explanations:**
|
273
|
+
- `configFile`: Points to the SSH config created by cloudX-proxy setup
|
274
|
+
- `connectTimeout`: Extended timeout (90s) for instance startup and connection establishment
|
275
|
+
- `serverInstallTimeout`: Additional time (120s) for VSCode server installation on first connect
|
276
|
+
- `showLoginTerminal`: Shows connection progress for troubleshooting
|
277
|
+
- `remotePlatform`: Tells VSCode that cloudx hosts are Linux systems
|
278
|
+
|
279
|
+
4. **Custom SSH Config Location:**
|
280
|
+
If you used `--ssh-config` during setup, update the `configFile` path accordingly:
|
281
|
+
```json
|
282
|
+
{
|
283
|
+
"remote.SSH.configFile": "~/.ssh/cloudx/config"
|
284
|
+
}
|
285
|
+
```
|
286
|
+
|
287
|
+
### How Connections Work
|
288
|
+
|
289
|
+
Understanding the connection flow helps with troubleshooting and explains why certain timeouts are necessary:
|
290
|
+
|
291
|
+
#### Step-by-Step Connection Process
|
292
|
+
|
293
|
+
1. **VSCode Initiates SSH Connection**
|
294
|
+
- User clicks "Connect" or runs `ssh cloudx-{env}-{hostname}`
|
295
|
+
- SSH reads the configuration and calls cloudX-proxy as ProxyCommand
|
296
|
+
|
297
|
+
2. **AWS Authentication & Instance Check**
|
298
|
+
- cloudX-proxy authenticates using the specified AWS profile
|
299
|
+
- Checks if the target EC2 instance exists and is accessible
|
300
|
+
- Verifies SSM agent is installed and running on the instance
|
301
|
+
|
302
|
+
3. **Instance Startup (if needed)**
|
303
|
+
- If instance is stopped, cloudX-proxy starts it automatically
|
304
|
+
- Waits for instance to reach "running" state (typically 30-60 seconds)
|
305
|
+
- Monitors SSM connectivity until agent responds
|
306
|
+
|
307
|
+
4. **SSH Key Distribution**
|
308
|
+
- Reads the public SSH key from the local filesystem
|
309
|
+
- Pushes the public key to the instance using EC2 Instance Connect
|
310
|
+
- Key is temporarily authorized for the current session (60 seconds)
|
311
|
+
|
312
|
+
5. **SSM Tunnel Establishment**
|
313
|
+
- Creates a secure tunnel through AWS Systems Manager
|
314
|
+
- Port forwards local port to instance port 22 (SSH)
|
315
|
+
- Tunnel handles all network traffic encryption
|
316
|
+
|
317
|
+
6. **SSH Connection Completion**
|
318
|
+
- SSH client connects through the established tunnel
|
319
|
+
- Authenticates using the private SSH key
|
320
|
+
- VSCode completes the remote connection setup
|
321
|
+
|
322
|
+
#### Why Timeouts Are Important
|
323
|
+
|
324
|
+
- **Connect Timeout (90s)**: Accounts for instance startup + tunnel establishment
|
325
|
+
- **Server Install Timeout (120s)**: VSCode server download and installation on first connect
|
326
|
+
- **Instance startup can take 30-90 seconds** depending on instance type and size
|
327
|
+
- **Network conditions** may require additional time for AWS API calls
|
328
|
+
|
329
|
+
#### Connection Indicators
|
330
|
+
|
331
|
+
- **"Starting instance..."** - EC2 instance is being started
|
332
|
+
- **"Waiting for SSM connectivity..."** - Instance is starting, SSM agent not ready yet
|
333
|
+
- **"Pushing SSH key..."** - Distributing public key via EC2 Instance Connect
|
334
|
+
- **"Starting session..."** - Creating SSM tunnel
|
335
|
+
- **VSCode "Installing server..."** - First-time setup of VSCode remote server
|
336
|
+
|
224
337
|
## Usage
|
225
338
|
|
226
339
|
### Command Line Options
|
@@ -234,7 +347,7 @@ Options:
|
|
234
347
|
- `--profile` (default: vscode): AWS profile to use. The profile's IAM user should follow the format cloudX-{env}-{user}. The environment part will be used as the default environment during setup.
|
235
348
|
- `--ssh-key` (default: vscode): Name of the SSH key to create/use. The key will be stored in the SSH config directory. This same name can be used in the connect command.
|
236
349
|
- `--ssh-config` (optional): Path to the SSH config file to use. If specified, configuration and keys will be stored in this location. Default is ~/.ssh/vscode/config.
|
237
|
-
- `--1password` (optional): Enable 1Password SSH agent integration. Can be used as a flag or with a vault name (e.g., `--1password Private`).
|
350
|
+
- `--1password` (optional): Enable 1Password SSH agent integration. Can be used as a flag or with a vault name (e.g., `--1password Private`). First searches all vaults for existing keys with name "cloudX SSH Key - {keyname}". If no existing key found, creates new keys directly in the specified (or selected) 1Password vault and configures SSH to use the 1Password SSH agent. If a vault name is specified, that vault will be used for key storage; otherwise, prompts user to select from available vaults. By default, the "Private" vault is used when no vault specified. Note that only the "Private" vault is enabled for SSH by default in 1Password settings - other vaults must be manually enabled in 1Password SSH agent settings.
|
238
351
|
- `--aws-env` (optional): AWS environment directory to use. If specified, AWS configuration and credentials will be read from ~/.aws/aws-envs/{env}/.
|
239
352
|
- `--instance` (optional): EC2 instance ID to set up connection for. If provided, skips the instance ID prompt.
|
240
353
|
- `--hostname` (optional): Hostname to use for SSH configuration. If not provided, a hostname will be generated from the instance ID in non-interactive mode or prompted for in interactive mode.
|
@@ -352,20 +465,36 @@ These permissions are required to bootstrap the instance, so that after creation
|
|
352
465
|
|
353
466
|
## Troubleshooting
|
354
467
|
|
355
|
-
|
468
|
+
### Common Issues
|
469
|
+
|
470
|
+
1. **Python/Installation Issues**
|
471
|
+
- **Error: "python not found"** - Ensure Python 3.9+ is installed and in PATH
|
472
|
+
- **Error: "uvx command not found"** - Install uv: `pip install uv`
|
473
|
+
- **Error: "Package not found"** - Try updating uv: `pip install --upgrade uv`
|
474
|
+
- **ImportError/ModuleNotFoundError** - Check Python version compatibility (`python --version`)
|
475
|
+
|
476
|
+
2. **Setup Issues**
|
356
477
|
- If AWS profile validation fails, ensure your user ARN matches the cloudX-{env}-{user} format
|
357
478
|
- For 1Password integration, ensure the CLI is installed and you're signed in
|
358
479
|
- Check that ~/.ssh/vscode directory has proper permissions (700)
|
359
480
|
- Verify main ~/.ssh/config is writable
|
360
481
|
|
361
|
-
2. **Connection
|
482
|
+
2. **VSCode Connection Issues**
|
483
|
+
- **Error: "Could not establish connection"** - Check VSCode SSH config file path in settings
|
484
|
+
- **Error: "Host not found"** - Run `uvx cloudx-proxy list` to verify host configuration
|
485
|
+
- **Timeout during connection** - Instance may be starting up (wait 2-3 minutes)
|
486
|
+
- **"Installing server" hangs** - Increase `serverInstallTimeout` to 180+ seconds
|
487
|
+
- **Connection works in terminal but not VSCode** - Verify `remote.SSH.configFile` setting
|
488
|
+
|
489
|
+
3. **Connection Timeout**
|
362
490
|
- Ensure the instance has the SSM agent installed and running
|
363
491
|
- Check that your AWS credentials have the required permissions
|
364
492
|
- Verify the instance ID is correct
|
365
493
|
- Increase the VSCode SSH timeout if needed
|
366
494
|
- Check if the instance is starting up (can take several minutes)
|
495
|
+
- **Region mismatch** - Ensure AWS profile region matches instance location
|
367
496
|
|
368
|
-
|
497
|
+
4. **SSH Key Issues**
|
369
498
|
- If using 1Password SSH agent, verify agent is running (~/.1password/agent.sock exists)
|
370
499
|
- Check file permissions (600 for private key, 644 for public key)
|
371
500
|
- Verify the public key is being successfully pushed to the instance
|
@@ -374,21 +503,59 @@ These permissions are required to bootstrap the instance, so that after creation
|
|
374
503
|
* SSH agent is enabled in 1Password settings
|
375
504
|
* Keys are added to the SSH agent in 1Password
|
376
505
|
* The key is visible with `op item list --categories "SSH Key"`
|
506
|
+
* Keys follow the naming convention "cloudX SSH Key - {keyname}" for automatic discovery
|
377
507
|
* If using a vault other than "Private", ensure that vault is enabled for SSH in 1Password settings
|
378
508
|
* By default, only the "Private" vault is enabled for SSH in 1Password
|
379
509
|
|
380
|
-
|
510
|
+
5. **AWS CLI and Credentials Issues**
|
511
|
+
- **Error: "aws command not found"** - Install AWS CLI v2 (not v1)
|
512
|
+
- **Error: "Unable to locate credentials"** - Run `aws configure` to set up credentials
|
513
|
+
- **Error: "Access Denied"** - Check IAM permissions and user ARN format
|
514
|
+
- **Error: "Region not specified"** - Set default region in AWS profile or use `--region`
|
515
|
+
- **Profile not found** - Verify profile exists: `aws configure list-profiles`
|
516
|
+
- **Session token expired** - For SSO/temporary credentials, re-authenticate
|
517
|
+
|
518
|
+
6. **AWS Configuration**
|
381
519
|
- Confirm AWS CLI is configured with valid credentials
|
382
520
|
- Default region is eu-west-1 if not specified in profile or command line
|
383
521
|
- If using AWS profile organizer, ensure your environment directory exists at `~/.aws/aws-envs/<environment>/`
|
384
522
|
- Verify the Session Manager plugin is installed correctly
|
385
523
|
- Check that the instance has the required IAM role for SSM
|
386
524
|
|
387
|
-
|
525
|
+
7. **Session Manager Plugin Issues**
|
526
|
+
- **Error: "Session Manager plugin not found"** - Install the Session Manager plugin
|
527
|
+
- **Error: "Invalid session"** - Check SSM agent status on instance: `sudo systemctl status amazon-ssm-agent`
|
528
|
+
- **Plugin installation on macOS** - May need to add plugin to PATH manually
|
529
|
+
- **Plugin installation on Windows** - Restart terminal after installation
|
530
|
+
|
531
|
+
8. **Instance Setup Status**
|
388
532
|
- If setup appears stuck, check /home/ec2-user/.install-running exists
|
389
533
|
- Verify /home/ec2-user/.install-done is created upon completion
|
390
534
|
- Check instance system logs for setup script errors
|
391
535
|
|
536
|
+
### Diagnostic Commands
|
537
|
+
|
538
|
+
If you're experiencing issues, run these commands to gather diagnostic information:
|
539
|
+
|
540
|
+
```bash
|
541
|
+
# Check Python and uv versions
|
542
|
+
python --version
|
543
|
+
uvx --version
|
544
|
+
|
545
|
+
# Verify AWS CLI and credentials
|
546
|
+
aws --version
|
547
|
+
aws sts get-caller-identity --profile your-profile
|
548
|
+
|
549
|
+
# Test Session Manager plugin
|
550
|
+
aws ssm start-session --target i-1234567890abcdef0 --profile your-profile
|
551
|
+
|
552
|
+
# List configured SSH hosts
|
553
|
+
uvx cloudx-proxy list --detailed
|
554
|
+
|
555
|
+
# Test direct connection (replace with your values)
|
556
|
+
uvx cloudx-proxy connect i-1234567890abcdef0 22 --profile your-profile
|
557
|
+
```
|
558
|
+
|
392
559
|
## License
|
393
560
|
|
394
561
|
MIT License - see LICENSE file for details
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '0.8.
|
32
|
-
__version_tuple__ = version_tuple = (0, 8,
|
31
|
+
__version__ = version = '0.8.3'
|
32
|
+
__version_tuple__ = version_tuple = (0, 8, 3)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: cloudx-proxy
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.3
|
4
4
|
Summary: SSH proxy command to connect VSCode with Cloud9/CloudX instance using AWS Systems Manager
|
5
5
|
Author-email: easytocloud <info@easytocloud.com>
|
6
6
|
License: MIT License
|
@@ -73,25 +73,62 @@ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using
|
|
73
73
|
- SSH tunneling through AWS Systems Manager
|
74
74
|
- Cross-platform support (Windows, macOS, Linux)
|
75
75
|
|
76
|
+
## Quick Start
|
77
|
+
|
78
|
+
**TL;DR for experienced users:**
|
79
|
+
|
80
|
+
1. **Install Prerequisites:**
|
81
|
+
```bash
|
82
|
+
# Install Python 3.9+, AWS CLI v2, Session Manager plugin
|
83
|
+
pip install uv
|
84
|
+
```
|
85
|
+
|
86
|
+
2. **Run Setup:**
|
87
|
+
```bash
|
88
|
+
# Basic setup (will prompt for AWS profile, instance ID, etc.)
|
89
|
+
uvx cloudx-proxy setup
|
90
|
+
|
91
|
+
# Or non-interactive with all parameters
|
92
|
+
uvx cloudx-proxy setup --profile myprofile --instance i-1234567890abcdef0 --hostname myserver --yes
|
93
|
+
```
|
94
|
+
|
95
|
+
3. **Configure VSCode:**
|
96
|
+
- Install "Remote - SSH" extension
|
97
|
+
- Add to settings.json: `"remote.SSH.configFile": "~/.ssh/vscode/config"`
|
98
|
+
- Set SSH timeout: `"remote.SSH.connectTimeout": 90`
|
99
|
+
|
100
|
+
4. **Connect:**
|
101
|
+
- Open VSCode Remote Explorer → SSH Targets
|
102
|
+
- Connect to `cloudx-{env}-{hostname}` (e.g., `cloudx-dev-myserver`)
|
103
|
+
|
104
|
+
**First connection takes 2-3 minutes (instance startup + VSCode server install). Subsequent connections are much faster (~30s).**
|
105
|
+
|
106
|
+
---
|
107
|
+
|
76
108
|
## Prerequisites
|
77
109
|
|
78
|
-
1. **
|
110
|
+
1. **Python 3.9+** - Required for cloudX-proxy and uv package manager
|
111
|
+
- [Python Installation Guide](https://www.python.org/downloads/)
|
112
|
+
- Check your version: `python --version` or `python3 --version`
|
113
|
+
- Supports Python 3.9, 3.10, 3.11, 3.12+
|
114
|
+
|
115
|
+
2. **AWS CLI v2** - Used to configure AWS profiles and credentials
|
79
116
|
- [Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
|
80
117
|
- Required for `aws configure` during setup
|
81
118
|
- Handles AWS credentials and region configuration
|
82
119
|
|
83
|
-
|
120
|
+
3. **AWS Session Manager Plugin** - Enables secure tunneling through AWS Systems Manager
|
84
121
|
- [Installation Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
|
85
122
|
- Provides the secure connection channel
|
86
123
|
- No need for public IP addresses or direct SSH access
|
87
124
|
|
88
|
-
|
125
|
+
4. **OpenSSH Client** - Handles SSH key management and connections
|
89
126
|
- Windows: [Microsoft's OpenSSH Installation Guide](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui)
|
90
127
|
- macOS/Linux: Usually pre-installed
|
91
128
|
- Manages SSH keys and configurations
|
92
129
|
- Provides the SSH client for VSCode Remote
|
93
130
|
|
94
|
-
|
131
|
+
5. **uv** - Modern Python package installer and virtual environment manager
|
95
132
|
```bash
|
96
133
|
pip install uv
|
97
134
|
```
|
@@ -102,7 +139,7 @@ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using
|
|
102
139
|
|
103
140
|
This means you can run cloudX-proxy directly with `uvx cloudx-proxy` without manually managing virtual environments or dependencies.
|
104
141
|
|
105
|
-
|
142
|
+
6. **VSCode with Remote SSH Extension** - Your development environment
|
106
143
|
- Provides the integrated development environment
|
107
144
|
- Uses the SSH configuration to connect to instances
|
108
145
|
- Handles file synchronization and terminal sessions
|
@@ -265,15 +302,91 @@ This architecture means that:
|
|
265
302
|
|
266
303
|
### VSCode Configuration
|
267
304
|
|
268
|
-
|
269
|
-
|
305
|
+
After completing the setup, configure VSCode to use the SSH configuration created by cloudX-proxy:
|
306
|
+
|
307
|
+
1. **Install VSCode Extensions:**
|
308
|
+
- Install the "Remote - SSH" extension from the VSCode marketplace
|
309
|
+
- Optionally install "Remote Explorer" for better visualization
|
310
|
+
|
311
|
+
2. **Configure VSCode Settings:**
|
312
|
+
Add these settings to your VSCode settings.json (Command Palette → "Preferences: Open Settings (JSON)"):
|
270
313
|
```json
|
271
314
|
{
|
272
315
|
"remote.SSH.configFile": "~/.ssh/vscode/config",
|
273
|
-
"remote.SSH.connectTimeout": 90
|
316
|
+
"remote.SSH.connectTimeout": 90,
|
317
|
+
"remote.SSH.serverInstallTimeout": 120,
|
318
|
+
"remote.SSH.showLoginTerminal": true,
|
319
|
+
"remote.SSH.remotePlatform": {
|
320
|
+
"cloudx-*": "linux"
|
321
|
+
}
|
274
322
|
}
|
275
323
|
```
|
276
|
-
|
324
|
+
|
325
|
+
3. **Configuration Explanations:**
|
326
|
+
- `configFile`: Points to the SSH config created by cloudX-proxy setup
|
327
|
+
- `connectTimeout`: Extended timeout (90s) for instance startup and connection establishment
|
328
|
+
- `serverInstallTimeout`: Additional time (120s) for VSCode server installation on first connect
|
329
|
+
- `showLoginTerminal`: Shows connection progress for troubleshooting
|
330
|
+
- `remotePlatform`: Tells VSCode that cloudx hosts are Linux systems
|
331
|
+
|
332
|
+
4. **Custom SSH Config Location:**
|
333
|
+
If you used `--ssh-config` during setup, update the `configFile` path accordingly:
|
334
|
+
```json
|
335
|
+
{
|
336
|
+
"remote.SSH.configFile": "~/.ssh/cloudx/config"
|
337
|
+
}
|
338
|
+
```
|
339
|
+
|
340
|
+
### How Connections Work
|
341
|
+
|
342
|
+
Understanding the connection flow helps with troubleshooting and explains why certain timeouts are necessary:
|
343
|
+
|
344
|
+
#### Step-by-Step Connection Process
|
345
|
+
|
346
|
+
1. **VSCode Initiates SSH Connection**
|
347
|
+
- User clicks "Connect" or runs `ssh cloudx-{env}-{hostname}`
|
348
|
+
- SSH reads the configuration and calls cloudX-proxy as ProxyCommand
|
349
|
+
|
350
|
+
2. **AWS Authentication & Instance Check**
|
351
|
+
- cloudX-proxy authenticates using the specified AWS profile
|
352
|
+
- Checks if the target EC2 instance exists and is accessible
|
353
|
+
- Verifies SSM agent is installed and running on the instance
|
354
|
+
|
355
|
+
3. **Instance Startup (if needed)**
|
356
|
+
- If instance is stopped, cloudX-proxy starts it automatically
|
357
|
+
- Waits for instance to reach "running" state (typically 30-60 seconds)
|
358
|
+
- Monitors SSM connectivity until agent responds
|
359
|
+
|
360
|
+
4. **SSH Key Distribution**
|
361
|
+
- Reads the public SSH key from the local filesystem
|
362
|
+
- Pushes the public key to the instance using EC2 Instance Connect
|
363
|
+
- Key is temporarily authorized for the current session (60 seconds)
|
364
|
+
|
365
|
+
5. **SSM Tunnel Establishment**
|
366
|
+
- Creates a secure tunnel through AWS Systems Manager
|
367
|
+
- Port forwards local port to instance port 22 (SSH)
|
368
|
+
- Tunnel handles all network traffic encryption
|
369
|
+
|
370
|
+
6. **SSH Connection Completion**
|
371
|
+
- SSH client connects through the established tunnel
|
372
|
+
- Authenticates using the private SSH key
|
373
|
+
- VSCode completes the remote connection setup
|
374
|
+
|
375
|
+
#### Why Timeouts Are Important
|
376
|
+
|
377
|
+
- **Connect Timeout (90s)**: Accounts for instance startup + tunnel establishment
|
378
|
+
- **Server Install Timeout (120s)**: VSCode server download and installation on first connect
|
379
|
+
- **Instance startup can take 30-90 seconds** depending on instance type and size
|
380
|
+
- **Network conditions** may require additional time for AWS API calls
|
381
|
+
|
382
|
+
#### Connection Indicators
|
383
|
+
|
384
|
+
- **"Starting instance..."** - EC2 instance is being started
|
385
|
+
- **"Waiting for SSM connectivity..."** - Instance is starting, SSM agent not ready yet
|
386
|
+
- **"Pushing SSH key..."** - Distributing public key via EC2 Instance Connect
|
387
|
+
- **"Starting session..."** - Creating SSM tunnel
|
388
|
+
- **VSCode "Installing server..."** - First-time setup of VSCode remote server
|
389
|
+
|
277
390
|
## Usage
|
278
391
|
|
279
392
|
### Command Line Options
|
@@ -287,7 +400,7 @@ Options:
|
|
287
400
|
- `--profile` (default: vscode): AWS profile to use. The profile's IAM user should follow the format cloudX-{env}-{user}. The environment part will be used as the default environment during setup.
|
288
401
|
- `--ssh-key` (default: vscode): Name of the SSH key to create/use. The key will be stored in the SSH config directory. This same name can be used in the connect command.
|
289
402
|
- `--ssh-config` (optional): Path to the SSH config file to use. If specified, configuration and keys will be stored in this location. Default is ~/.ssh/vscode/config.
|
290
|
-
- `--1password` (optional): Enable 1Password SSH agent integration. Can be used as a flag or with a vault name (e.g., `--1password Private`).
|
403
|
+
- `--1password` (optional): Enable 1Password SSH agent integration. Can be used as a flag or with a vault name (e.g., `--1password Private`). First searches all vaults for existing keys with name "cloudX SSH Key - {keyname}". If no existing key found, creates new keys directly in the specified (or selected) 1Password vault and configures SSH to use the 1Password SSH agent. If a vault name is specified, that vault will be used for key storage; otherwise, prompts user to select from available vaults. By default, the "Private" vault is used when no vault specified. Note that only the "Private" vault is enabled for SSH by default in 1Password settings - other vaults must be manually enabled in 1Password SSH agent settings.
|
291
404
|
- `--aws-env` (optional): AWS environment directory to use. If specified, AWS configuration and credentials will be read from ~/.aws/aws-envs/{env}/.
|
292
405
|
- `--instance` (optional): EC2 instance ID to set up connection for. If provided, skips the instance ID prompt.
|
293
406
|
- `--hostname` (optional): Hostname to use for SSH configuration. If not provided, a hostname will be generated from the instance ID in non-interactive mode or prompted for in interactive mode.
|
@@ -405,20 +518,36 @@ These permissions are required to bootstrap the instance, so that after creation
|
|
405
518
|
|
406
519
|
## Troubleshooting
|
407
520
|
|
408
|
-
|
521
|
+
### Common Issues
|
522
|
+
|
523
|
+
1. **Python/Installation Issues**
|
524
|
+
- **Error: "python not found"** - Ensure Python 3.9+ is installed and in PATH
|
525
|
+
- **Error: "uvx command not found"** - Install uv: `pip install uv`
|
526
|
+
- **Error: "Package not found"** - Try updating uv: `pip install --upgrade uv`
|
527
|
+
- **ImportError/ModuleNotFoundError** - Check Python version compatibility (`python --version`)
|
528
|
+
|
529
|
+
2. **Setup Issues**
|
409
530
|
- If AWS profile validation fails, ensure your user ARN matches the cloudX-{env}-{user} format
|
410
531
|
- For 1Password integration, ensure the CLI is installed and you're signed in
|
411
532
|
- Check that ~/.ssh/vscode directory has proper permissions (700)
|
412
533
|
- Verify main ~/.ssh/config is writable
|
413
534
|
|
414
|
-
2. **Connection
|
535
|
+
2. **VSCode Connection Issues**
|
536
|
+
- **Error: "Could not establish connection"** - Check VSCode SSH config file path in settings
|
537
|
+
- **Error: "Host not found"** - Run `uvx cloudx-proxy list` to verify host configuration
|
538
|
+
- **Timeout during connection** - Instance may be starting up (wait 2-3 minutes)
|
539
|
+
- **"Installing server" hangs** - Increase `serverInstallTimeout` to 180+ seconds
|
540
|
+
- **Connection works in terminal but not VSCode** - Verify `remote.SSH.configFile` setting
|
541
|
+
|
542
|
+
3. **Connection Timeout**
|
415
543
|
- Ensure the instance has the SSM agent installed and running
|
416
544
|
- Check that your AWS credentials have the required permissions
|
417
545
|
- Verify the instance ID is correct
|
418
546
|
- Increase the VSCode SSH timeout if needed
|
419
547
|
- Check if the instance is starting up (can take several minutes)
|
548
|
+
- **Region mismatch** - Ensure AWS profile region matches instance location
|
420
549
|
|
421
|
-
|
550
|
+
4. **SSH Key Issues**
|
422
551
|
- If using 1Password SSH agent, verify agent is running (~/.1password/agent.sock exists)
|
423
552
|
- Check file permissions (600 for private key, 644 for public key)
|
424
553
|
- Verify the public key is being successfully pushed to the instance
|
@@ -427,21 +556,59 @@ These permissions are required to bootstrap the instance, so that after creation
|
|
427
556
|
* SSH agent is enabled in 1Password settings
|
428
557
|
* Keys are added to the SSH agent in 1Password
|
429
558
|
* The key is visible with `op item list --categories "SSH Key"`
|
559
|
+
* Keys follow the naming convention "cloudX SSH Key - {keyname}" for automatic discovery
|
430
560
|
* If using a vault other than "Private", ensure that vault is enabled for SSH in 1Password settings
|
431
561
|
* By default, only the "Private" vault is enabled for SSH in 1Password
|
432
562
|
|
433
|
-
|
563
|
+
5. **AWS CLI and Credentials Issues**
|
564
|
+
- **Error: "aws command not found"** - Install AWS CLI v2 (not v1)
|
565
|
+
- **Error: "Unable to locate credentials"** - Run `aws configure` to set up credentials
|
566
|
+
- **Error: "Access Denied"** - Check IAM permissions and user ARN format
|
567
|
+
- **Error: "Region not specified"** - Set default region in AWS profile or use `--region`
|
568
|
+
- **Profile not found** - Verify profile exists: `aws configure list-profiles`
|
569
|
+
- **Session token expired** - For SSO/temporary credentials, re-authenticate
|
570
|
+
|
571
|
+
6. **AWS Configuration**
|
434
572
|
- Confirm AWS CLI is configured with valid credentials
|
435
573
|
- Default region is eu-west-1 if not specified in profile or command line
|
436
574
|
- If using AWS profile organizer, ensure your environment directory exists at `~/.aws/aws-envs/<environment>/`
|
437
575
|
- Verify the Session Manager plugin is installed correctly
|
438
576
|
- Check that the instance has the required IAM role for SSM
|
439
577
|
|
440
|
-
|
578
|
+
7. **Session Manager Plugin Issues**
|
579
|
+
- **Error: "Session Manager plugin not found"** - Install the Session Manager plugin
|
580
|
+
- **Error: "Invalid session"** - Check SSM agent status on instance: `sudo systemctl status amazon-ssm-agent`
|
581
|
+
- **Plugin installation on macOS** - May need to add plugin to PATH manually
|
582
|
+
- **Plugin installation on Windows** - Restart terminal after installation
|
583
|
+
|
584
|
+
8. **Instance Setup Status**
|
441
585
|
- If setup appears stuck, check /home/ec2-user/.install-running exists
|
442
586
|
- Verify /home/ec2-user/.install-done is created upon completion
|
443
587
|
- Check instance system logs for setup script errors
|
444
588
|
|
589
|
+
### Diagnostic Commands
|
590
|
+
|
591
|
+
If you're experiencing issues, run these commands to gather diagnostic information:
|
592
|
+
|
593
|
+
```bash
|
594
|
+
# Check Python and uv versions
|
595
|
+
python --version
|
596
|
+
uvx --version
|
597
|
+
|
598
|
+
# Verify AWS CLI and credentials
|
599
|
+
aws --version
|
600
|
+
aws sts get-caller-identity --profile your-profile
|
601
|
+
|
602
|
+
# Test Session Manager plugin
|
603
|
+
aws ssm start-session --target i-1234567890abcdef0 --profile your-profile
|
604
|
+
|
605
|
+
# List configured SSH hosts
|
606
|
+
uvx cloudx-proxy list --detailed
|
607
|
+
|
608
|
+
# Test direct connection (replace with your values)
|
609
|
+
uvx cloudx-proxy connect i-1234567890abcdef0 22 --profile your-profile
|
610
|
+
```
|
611
|
+
|
445
612
|
## License
|
446
613
|
|
447
614
|
MIT License - see LICENSE file for details
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|