cloudx-proxy 0.8.1__py3-none-any.whl → 0.8.3__py3-none-any.whl

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/_version.py CHANGED
@@ -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.1'
32
- __version_tuple__ = version_tuple = (0, 8, 1)
31
+ __version__ = version = '0.8.3'
32
+ __version_tuple__ = version_tuple = (0, 8, 3)
33
33
 
34
34
  __commit_id__ = commit_id = None
cloudx_proxy/cli.py CHANGED
@@ -177,8 +177,8 @@ def list(ssh_config: str, environment: str, detailed: bool):
177
177
  config_content = config_file.read_text()
178
178
 
179
179
  # Parse hosts using regex
180
- # Match Host entries for cloudx hosts
181
- host_pattern = r'Host\s+(cloudx-[^\s]+)(?:\s*\n(?:(?!\s*Host\s+).)*?HostName\s+([^\s]+))?'
180
+ # Match Host entries for cloudx hosts (case-insensitive)
181
+ host_pattern = r'Host\s+(cloud[xX]-[^\s]+)(?:\s*\n(?:(?!\s*Host\s+).)*?(?i:hostname)\s+([^\s]+))?'
182
182
  hosts = re.finditer(host_pattern, config_content, re.DOTALL)
183
183
 
184
184
  # Group hosts by environment
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudx-proxy
3
- Version: 0.8.1
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. **AWS CLI v2** - Used to configure AWS profiles and credentials
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
- 2. **AWS Session Manager Plugin** - Enables secure tunneling through AWS Systems Manager
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
- 3. **OpenSSH Client** - Handles SSH key management and connections
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
- 4. **uv** - Modern Python package installer and virtual environment manager
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
- 5. **VSCode with Remote SSH Extension** - Your development environment
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
- 1. Install the "Remote - SSH" extension in VSCode
269
- 2. Configure VSCode settings:
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
- This extra long timeout is necessary to account for the time it takes to start the instance and establish the connection.
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`). Creates keys directly in 1Password and configures SSH to use the 1Password SSH agent. If a vault name is specified, that vault will be used for key storage. By default, the "Private" vault is used. Note that only the "Private" vault is enabled for SSH by default in 1Password settings.
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
- 1. **Setup Issues**
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 Timeout**
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
- 3. **SSH Key Issues**
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
- 4. **AWS Configuration**
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
- 5. **Instance Setup Status**
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
@@ -0,0 +1,13 @@
1
+ cloudx_proxy/_1password.py,sha256=uxyCfVvO1eQrOfYRojst_LN2DV4fIwxM5moaQTn3wQY,5853
2
+ cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
3
+ cloudx_proxy/_version.py,sha256=vG9GelPWtHXRUy7hmX4yak1DOSnho8XScbsq70cQTPY,704
4
+ cloudx_proxy/cli.py,sha256=vvPxNaixGdc_hirQrHgjxrmbiFtX-ugYoHGgR0zq79w,9934
5
+ cloudx_proxy/core.py,sha256=RF3bX5MQiokRKjYEPnfWdKywGdtoVUvV2xZqm9uOl1g,8135
6
+ cloudx_proxy/setup.py,sha256=CmUYr9EhtLoEpKU9jMEgxXtVMYlZTfPAJ-eQ59nr_bI,42785
7
+ cloudx_proxy-0.8.3.dist-info/licenses/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
8
+ cloudx_proxy-0.8.3.dist-info/licenses/NOTICE,sha256=JH0TVxH8Nkt3_CkL2-MEiJfVGvWYZ52H5uUxEq9p7rg,3223
9
+ cloudx_proxy-0.8.3.dist-info/METADATA,sha256=27ryptzr2p11KEcrfB72RUwY-jDgcSYVwI2npMJtEkk,29053
10
+ cloudx_proxy-0.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ cloudx_proxy-0.8.3.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
12
+ cloudx_proxy-0.8.3.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
13
+ cloudx_proxy-0.8.3.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- cloudx_proxy/_1password.py,sha256=uxyCfVvO1eQrOfYRojst_LN2DV4fIwxM5moaQTn3wQY,5853
2
- cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
3
- cloudx_proxy/_version.py,sha256=3xUKhXexSTpGjDP__-RnFbAaEHHySzOSJX6zocN6QZU,704
4
- cloudx_proxy/cli.py,sha256=prOTW9H8QloWuHqwFDy6fQg5-8CrG1RiEylIoNrjO5I,9907
5
- cloudx_proxy/core.py,sha256=RF3bX5MQiokRKjYEPnfWdKywGdtoVUvV2xZqm9uOl1g,8135
6
- cloudx_proxy/setup.py,sha256=CmUYr9EhtLoEpKU9jMEgxXtVMYlZTfPAJ-eQ59nr_bI,42785
7
- cloudx_proxy-0.8.1.dist-info/licenses/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
8
- cloudx_proxy-0.8.1.dist-info/licenses/NOTICE,sha256=JH0TVxH8Nkt3_CkL2-MEiJfVGvWYZ52H5uUxEq9p7rg,3223
9
- cloudx_proxy-0.8.1.dist-info/METADATA,sha256=OYDL-R4mzBxMffmB277gMPYcGPAdUCZcQKYwsvXudBE,21806
10
- cloudx_proxy-0.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- cloudx_proxy-0.8.1.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
12
- cloudx_proxy-0.8.1.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
13
- cloudx_proxy-0.8.1.dist-info/RECORD,,