cloudx-proxy 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.
@@ -0,0 +1,67 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+
7
+ jobs:
8
+ release:
9
+ name: Release
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout
13
+ uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
16
+
17
+ - name: Setup Node.js
18
+ uses: actions/setup-node@v3
19
+ with:
20
+ node-version: "lts/*"
21
+
22
+ - name: Setup Python
23
+ uses: actions/setup-python@v4
24
+ with:
25
+ python-version: '3.x'
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install build twine
31
+
32
+ - name: Install semantic-release
33
+ run: |
34
+ npm install -g semantic-release @semantic-release/changelog @semantic-release/git
35
+
36
+ - name: Get Version
37
+ id: semantic
38
+ env:
39
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40
+ run: |
41
+ version=$(npx semantic-release --dry-run --initial-version 2025.1.0 | grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+' || echo "")
42
+ if [ -n "$version" ]; then
43
+ echo "new_release_version=$version" >> $GITHUB_OUTPUT
44
+ echo "Version to be released: $version"
45
+ else
46
+ echo "No new version to be released"
47
+ exit 0
48
+ fi
49
+
50
+ - name: Create Release
51
+ if: steps.semantic.outputs.new_release_version != ''
52
+ env:
53
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
+ run: npx semantic-release --initial-version 2025.1.0
55
+
56
+ - name: Build package
57
+ if: steps.semantic.outputs.new_release_version != ''
58
+ env:
59
+ SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.semantic.outputs.new_release_version }}
60
+ run: python -m build
61
+
62
+ - name: Publish to PyPI
63
+ if: steps.semantic.outputs.new_release_version != ''
64
+ env:
65
+ TWINE_USERNAME: __token__
66
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
67
+ run: twine upload dist/*
@@ -0,0 +1,39 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Version file generated by setuptools_scm
24
+ cloudx_client/_version.py
25
+
26
+ # Virtual Environment
27
+ venv/
28
+ env/
29
+ ENV/
30
+
31
+ # IDE
32
+ .idea/
33
+ .vscode/
34
+ *.swp
35
+ *.swo
36
+
37
+ # OS
38
+ .DS_Store
39
+ Thumbs.db
@@ -0,0 +1,38 @@
1
+ {
2
+ "branches": ["main"],
3
+ "tagFormat": "v${version}",
4
+ "repositoryUrl": "https://github.com/easytocloud/cloudX-proxy.git",
5
+ "plugins": [
6
+ ["@semantic-release/commit-analyzer", {
7
+ "preset": "angular",
8
+ "releaseRules": [
9
+ {"type": "feat", "release": "minor"},
10
+ {"type": "fix", "release": "patch"},
11
+ {"type": "docs", "release": "patch"},
12
+ {"type": "style", "release": "patch"},
13
+ {"type": "refactor", "release": "patch"},
14
+ {"type": "perf", "release": "patch"},
15
+ {"type": "test", "release": "patch"},
16
+ {"type": "build", "release": "patch"},
17
+ {"type": "ci", "release": "patch"},
18
+ {"type": "chore", "release": "patch"}
19
+ ]
20
+ }],
21
+ "@semantic-release/release-notes-generator",
22
+ [
23
+ "@semantic-release/changelog",
24
+ {
25
+ "changelogFile": "CHANGELOG.md"
26
+ }
27
+ ],
28
+ [
29
+ "@semantic-release/git",
30
+ {
31
+ "assets": [
32
+ "CHANGELOG.md"
33
+ ]
34
+ }
35
+ ],
36
+ "@semantic-release/github"
37
+ ]
38
+ }
@@ -0,0 +1,21 @@
1
+ ## [0.1.1](https://github.com/easytocloud/cloudX-proxy/compare/v0.1.0...v0.1.1) (2025-02-09)
2
+
3
+ # Changelog
4
+
5
+ All notable changes to this project will be documented in this file.
6
+
7
+ ## [0.1.0](https://github.com/easytocloud/cloudX-proxy/releases/tag/v0.1.0) (2025-02-09)
8
+
9
+ Initial release with core functionality:
10
+
11
+ ### Features
12
+
13
+ * SSH proxy command for connecting VSCode to EC2 instances via SSM
14
+ * AWS profile configuration with cloudX-{env}-{user} format
15
+ * SSH key management with 1Password integration
16
+ * Environment-specific SSH config generation
17
+ * Instance setup status verification
18
+ * Cross-platform support (Windows, macOS, Linux)
19
+ * Automatic instance startup if stopped
20
+ * SSH key distribution via EC2 Instance Connect
21
+ * SSH tunneling through AWS Systems Manager
@@ -0,0 +1,27 @@
1
+ # Contributing to cloudX-proxy
2
+
3
+ ## Development Setup
4
+
5
+ 1. Clone the repository
6
+ 2. Install development dependencies:
7
+ ```bash
8
+ pip install -e ".[dev]"
9
+ ```
10
+
11
+ ## Publishing to PyPI
12
+
13
+ The package is automatically published to PyPI via GitHub Actions when a new release is created. Setup:
14
+
15
+ 1. Register project on PyPI
16
+ 2. Generate API token in PyPI (Account Settings → API tokens)
17
+ 3. Add token as GitHub secret named `PYPI_TOKEN`
18
+
19
+ ## Versioning
20
+
21
+ The project uses semantic-release for versioning, starting at version 2025.1.0. Version numbers are automatically determined based on commit messages following the conventional commits specification.
22
+
23
+ The GitHub Actions workflow will:
24
+ 1. Determine next version based on commits
25
+ 2. Update CHANGELOG.md
26
+ 3. Create GitHub release
27
+ 4. Publish to PyPI
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 easytocloud
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.
@@ -0,0 +1,253 @@
1
+ Metadata-Version: 2.2
2
+ Name: cloudx-proxy
3
+ Version: 0.1.1
4
+ Summary: SSH proxy command to connect VSCode with Cloud9/CloudX instance using AWS Systems Manager
5
+ Author-email: easytocloud <info@easytocloud.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 easytocloud
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/easytocloud/cloudX-proxy
29
+ Project-URL: Repository, https://github.com/easytocloud/cloudX-proxy
30
+ Project-URL: Issues, https://github.com/easytocloud/cloudX-proxy/issues
31
+ Project-URL: Changelog, https://github.com/easytocloud/cloudX-proxy/blob/main/CHANGELOG.md
32
+ Keywords: aws,vscode,cloud9,cloudX,ssm,ssh,proxy
33
+ Classifier: Development Status :: 5 - Production/Stable
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.8
40
+ Classifier: Programming Language :: Python :: 3.9
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Topic :: Software Development :: Build Tools
44
+ Classifier: Topic :: System :: Systems Administration
45
+ Requires-Python: >=3.8
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Requires-Dist: boto3>=1.34.0
49
+ Requires-Dist: click>=8.1.0
50
+
51
+ # cloudX-proxy
52
+
53
+ A cross-platform SSH proxy command for connecting VSCode to CloudX/Cloud9 EC2 instances using AWS Systems Manager Session Manager.
54
+
55
+ ## Overview
56
+
57
+ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using AWS Systems Manager Session Manager, eliminating the need for direct SSH access or public IP addresses. It handles:
58
+
59
+ - Automatic instance startup if stopped
60
+ - SSH key distribution via EC2 Instance Connect
61
+ - SSH tunneling through AWS Systems Manager
62
+ - Cross-platform support (Windows, macOS, Linux)
63
+
64
+ ## Prerequisites
65
+
66
+ 1. **AWS CLI v2** - [Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
67
+ 2. **AWS Session Manager Plugin** - [Installation Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
68
+ 3. **OpenSSH Client**
69
+ - Windows: [Microsoft's OpenSSH Installation Guide](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui)
70
+ - macOS/Linux: Usually pre-installed
71
+ 4. **uv** - Python package installer and resolver
72
+ ```bash
73
+ pip install uv
74
+ ```
75
+ 5. **VSCode with Remote SSH Extension** installed
76
+
77
+ ## AWS Credentials Setup
78
+
79
+ The proxy expects to find AWS credentials in a profile named 'vscode' by default. These credentials should be the Access Key and Secret Key that were created by deploying the cloudX-user stack in your AWS account. The cloudX-user stack creates an IAM user with the minimal permissions required for:
80
+ - Starting/stopping EC2 instances
81
+ - Establishing SSM sessions
82
+ - Pushing SSH keys via EC2 Instance Connect
83
+
84
+ Once the SSH session is established, the user has to further configure the instance using `generate-sso-config` tool. This is a one-time setup unless the user's access to AWS accounts changes, in which case the user should re-run the `generate-sso-config` tool.
85
+
86
+ It is recommended to use --generate-directories and --use-ou-structure to create working directories for each account the user has access to.
87
+
88
+ Everytime the user connects to the instance, `ssostart` will authenticate the user with AWS SSO and generate temporary credentials.
89
+
90
+ This ensures you have the appropriate AWS access both for connecting to the instance and for working within it.
91
+
92
+ The proxy also supports easytocloud's AWS profile organizer. If you use multiple AWS environments, you can store your AWS configuration and credentials in `~/.aws/aws-envs/<environment>` directories and use the `--aws-env` option to specify which environment to use.
93
+
94
+ ## Setup
95
+
96
+ cloudX-proxy now includes a setup command that automates the entire configuration process:
97
+
98
+ ```bash
99
+ # Basic setup with defaults (vscode profile and key)
100
+ uvx cloudx-proxy setup
101
+
102
+ # Setup with custom profile and key
103
+ uvx cloudx-proxy setup --profile myprofile --ssh-key mykey
104
+
105
+ # Setup with AWS environment
106
+ uvx cloudx-proxy setup --aws-env prod
107
+ ```
108
+
109
+ The setup command will:
110
+
111
+ 1. Configure AWS Profile:
112
+ - Creates/validates AWS profile with cloudX-{env}-{user} format
113
+ - Supports AWS environment directories via --aws-env
114
+ - Uses aws configure for credential input
115
+
116
+ 2. Manage SSH Keys:
117
+ - Creates new SSH key pair if needed
118
+ - Offers 1Password integration options:
119
+ * Using 1Password SSH agent
120
+ * Storing private key as 1Password document
121
+
122
+ 3. Configure SSH:
123
+ - Creates ~/.ssh/vscode/config with proper settings
124
+ - Sets up environment-specific configurations
125
+ - Configures ProxyCommand with all necessary parameters
126
+ - Ensures main ~/.ssh/config includes the configuration
127
+
128
+ 4. Verify Instance Setup:
129
+ - Checks instance setup status
130
+ - Offers to wait for setup completion
131
+ - Monitors setup progress
132
+
133
+ ### Example SSH Configuration
134
+
135
+ The setup command generates a configuration structure like this:
136
+
137
+ ```
138
+ # Base environment config (created once per environment)
139
+ Host cloudx-{env}-*
140
+ User ec2-user
141
+ IdentityAgent ~/.1password/agent.sock # If using 1Password
142
+ IdentityFile ~/.ssh/vscode/key.pub # .pub for 1Password, no .pub otherwise
143
+ IdentitiesOnly yes # If using 1Password
144
+ ProxyCommand uvx cloudx-proxy connect %h %p --profile profile --aws-env env
145
+
146
+ # Host entries (added for each instance)
147
+ Host cloudx-{env}-hostname
148
+ HostName i-1234567890
149
+ ```
150
+
151
+ When adding new instances to an existing environment, the setup command will only add the specific host entry, preserving the existing environment configuration.
152
+
153
+ ### VSCode Configuration
154
+
155
+ 1. Install the "Remote - SSH" extension in VSCode
156
+ 2. Configure VSCode settings:
157
+ ```json
158
+ {
159
+ "remote.SSH.configFile": "~/.ssh/vscode/config",
160
+ "remote.SSH.connectTimeout": 90
161
+ }
162
+ ```
163
+
164
+ ## Usage
165
+
166
+ ### Command Line
167
+
168
+ ```bash
169
+ # Setup new environment and instance
170
+ uvx cloudx-proxy setup --profile myprofile --aws-env prod
171
+
172
+ # Add instance to existing environment
173
+ uvx cloudx-proxy setup --profile myprofile --aws-env prod
174
+
175
+ # Connect to instance
176
+ uvx cloudx-proxy connect i-0123456789abcdef0 22 --profile myprofile --aws-env prod
177
+
178
+ # Connect with custom port
179
+ uvx cloudx-proxy connect i-0123456789abcdef0 2222 --profile myprofile
180
+
181
+ # Connect with different region
182
+ uvx cloudx-proxy connect i-0123456789abcdef0 22 --region us-east-1
183
+
184
+ # Connect with custom key
185
+ uvx cloudx-proxy connect i-0123456789abcdef0 22 --key-path ~/.ssh/custom_key.pub
186
+ ```
187
+
188
+ ### VSCode
189
+
190
+ 1. Click the "Remote Explorer" icon in the VSCode sidebar
191
+ 2. Select "SSH Targets" from the dropdown
192
+ 3. Your configured hosts will appear (e.g., cloudx-dev)
193
+ 4. Click the "+" icon next to a host to connect
194
+ 5. VSCode will handle the rest, using cloudX-proxy to establish the connection
195
+
196
+ ## AWS Permissions
197
+
198
+ The AWS user/role needs these permissions:
199
+
200
+ ```json
201
+ {
202
+ "Version": "2012-10-17",
203
+ "Statement": [
204
+ {
205
+ "Effect": "Allow",
206
+ "Action": [
207
+ "ec2:StartInstances",
208
+ "ec2:DescribeInstances",
209
+ "ssm:StartSession",
210
+ "ssm:DescribeInstanceInformation",
211
+ "ec2-instance-connect:SendSSHPublicKey"
212
+ ],
213
+ "Resource": "*"
214
+ }
215
+ ]
216
+ }
217
+ ```
218
+
219
+ ## Troubleshooting
220
+
221
+ 1. **Setup Issues**
222
+ - If AWS profile validation fails, ensure your user ARN matches the cloudX-{env}-{user} format
223
+ - For 1Password integration, ensure the CLI is installed and you're signed in
224
+ - Check that ~/.ssh/vscode directory has proper permissions (700)
225
+ - Verify main ~/.ssh/config is writable
226
+
227
+ 2. **Connection Timeout**
228
+ - Ensure the instance has the SSM agent installed and running
229
+ - Check that your AWS credentials have the required permissions
230
+ - Verify the instance ID is correct
231
+ - Increase the VSCode SSH timeout if needed
232
+
233
+ 3. **SSH Key Issues**
234
+ - If using 1Password SSH agent, verify agent is running (~/.1password/agent.sock exists)
235
+ - Check file permissions (600 for private key, 644 for public key)
236
+ - Verify the public key is being successfully pushed to the instance
237
+ - For stored keys in 1Password, ensure you can access them via the CLI
238
+
239
+ 4. **AWS Configuration**
240
+ - Confirm AWS CLI is configured with valid credentials
241
+ - Default region is eu-west-1 if not specified in profile or command line
242
+ - If using AWS profile organizer, ensure your environment directory exists at `~/.aws/aws-envs/<environment>/`
243
+ - Verify the Session Manager plugin is installed correctly
244
+ - Check that the instance has the required IAM role for SSM
245
+
246
+ 5. **Instance Setup Status**
247
+ - If setup appears stuck, check /home/ec2-user/.install-running exists
248
+ - Verify /home/ec2-user/.install-done is created upon completion
249
+ - Check instance system logs for setup script errors
250
+
251
+ ## License
252
+
253
+ MIT License - see LICENSE file for details
@@ -0,0 +1,203 @@
1
+ # cloudX-proxy
2
+
3
+ A cross-platform SSH proxy command for connecting VSCode to CloudX/Cloud9 EC2 instances using AWS Systems Manager Session Manager.
4
+
5
+ ## Overview
6
+
7
+ cloudX-proxy enables seamless SSH connections from VSCode to EC2 instances using AWS Systems Manager Session Manager, eliminating the need for direct SSH access or public IP addresses. It handles:
8
+
9
+ - Automatic instance startup if stopped
10
+ - SSH key distribution via EC2 Instance Connect
11
+ - SSH tunneling through AWS Systems Manager
12
+ - Cross-platform support (Windows, macOS, Linux)
13
+
14
+ ## Prerequisites
15
+
16
+ 1. **AWS CLI v2** - [Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
17
+ 2. **AWS Session Manager Plugin** - [Installation Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
18
+ 3. **OpenSSH Client**
19
+ - Windows: [Microsoft's OpenSSH Installation Guide](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui)
20
+ - macOS/Linux: Usually pre-installed
21
+ 4. **uv** - Python package installer and resolver
22
+ ```bash
23
+ pip install uv
24
+ ```
25
+ 5. **VSCode with Remote SSH Extension** installed
26
+
27
+ ## AWS Credentials Setup
28
+
29
+ The proxy expects to find AWS credentials in a profile named 'vscode' by default. These credentials should be the Access Key and Secret Key that were created by deploying the cloudX-user stack in your AWS account. The cloudX-user stack creates an IAM user with the minimal permissions required for:
30
+ - Starting/stopping EC2 instances
31
+ - Establishing SSM sessions
32
+ - Pushing SSH keys via EC2 Instance Connect
33
+
34
+ Once the SSH session is established, the user has to further configure the instance using `generate-sso-config` tool. This is a one-time setup unless the user's access to AWS accounts changes, in which case the user should re-run the `generate-sso-config` tool.
35
+
36
+ It is recommended to use --generate-directories and --use-ou-structure to create working directories for each account the user has access to.
37
+
38
+ Everytime the user connects to the instance, `ssostart` will authenticate the user with AWS SSO and generate temporary credentials.
39
+
40
+ This ensures you have the appropriate AWS access both for connecting to the instance and for working within it.
41
+
42
+ The proxy also supports easytocloud's AWS profile organizer. If you use multiple AWS environments, you can store your AWS configuration and credentials in `~/.aws/aws-envs/<environment>` directories and use the `--aws-env` option to specify which environment to use.
43
+
44
+ ## Setup
45
+
46
+ cloudX-proxy now includes a setup command that automates the entire configuration process:
47
+
48
+ ```bash
49
+ # Basic setup with defaults (vscode profile and key)
50
+ uvx cloudx-proxy setup
51
+
52
+ # Setup with custom profile and key
53
+ uvx cloudx-proxy setup --profile myprofile --ssh-key mykey
54
+
55
+ # Setup with AWS environment
56
+ uvx cloudx-proxy setup --aws-env prod
57
+ ```
58
+
59
+ The setup command will:
60
+
61
+ 1. Configure AWS Profile:
62
+ - Creates/validates AWS profile with cloudX-{env}-{user} format
63
+ - Supports AWS environment directories via --aws-env
64
+ - Uses aws configure for credential input
65
+
66
+ 2. Manage SSH Keys:
67
+ - Creates new SSH key pair if needed
68
+ - Offers 1Password integration options:
69
+ * Using 1Password SSH agent
70
+ * Storing private key as 1Password document
71
+
72
+ 3. Configure SSH:
73
+ - Creates ~/.ssh/vscode/config with proper settings
74
+ - Sets up environment-specific configurations
75
+ - Configures ProxyCommand with all necessary parameters
76
+ - Ensures main ~/.ssh/config includes the configuration
77
+
78
+ 4. Verify Instance Setup:
79
+ - Checks instance setup status
80
+ - Offers to wait for setup completion
81
+ - Monitors setup progress
82
+
83
+ ### Example SSH Configuration
84
+
85
+ The setup command generates a configuration structure like this:
86
+
87
+ ```
88
+ # Base environment config (created once per environment)
89
+ Host cloudx-{env}-*
90
+ User ec2-user
91
+ IdentityAgent ~/.1password/agent.sock # If using 1Password
92
+ IdentityFile ~/.ssh/vscode/key.pub # .pub for 1Password, no .pub otherwise
93
+ IdentitiesOnly yes # If using 1Password
94
+ ProxyCommand uvx cloudx-proxy connect %h %p --profile profile --aws-env env
95
+
96
+ # Host entries (added for each instance)
97
+ Host cloudx-{env}-hostname
98
+ HostName i-1234567890
99
+ ```
100
+
101
+ When adding new instances to an existing environment, the setup command will only add the specific host entry, preserving the existing environment configuration.
102
+
103
+ ### VSCode Configuration
104
+
105
+ 1. Install the "Remote - SSH" extension in VSCode
106
+ 2. Configure VSCode settings:
107
+ ```json
108
+ {
109
+ "remote.SSH.configFile": "~/.ssh/vscode/config",
110
+ "remote.SSH.connectTimeout": 90
111
+ }
112
+ ```
113
+
114
+ ## Usage
115
+
116
+ ### Command Line
117
+
118
+ ```bash
119
+ # Setup new environment and instance
120
+ uvx cloudx-proxy setup --profile myprofile --aws-env prod
121
+
122
+ # Add instance to existing environment
123
+ uvx cloudx-proxy setup --profile myprofile --aws-env prod
124
+
125
+ # Connect to instance
126
+ uvx cloudx-proxy connect i-0123456789abcdef0 22 --profile myprofile --aws-env prod
127
+
128
+ # Connect with custom port
129
+ uvx cloudx-proxy connect i-0123456789abcdef0 2222 --profile myprofile
130
+
131
+ # Connect with different region
132
+ uvx cloudx-proxy connect i-0123456789abcdef0 22 --region us-east-1
133
+
134
+ # Connect with custom key
135
+ uvx cloudx-proxy connect i-0123456789abcdef0 22 --key-path ~/.ssh/custom_key.pub
136
+ ```
137
+
138
+ ### VSCode
139
+
140
+ 1. Click the "Remote Explorer" icon in the VSCode sidebar
141
+ 2. Select "SSH Targets" from the dropdown
142
+ 3. Your configured hosts will appear (e.g., cloudx-dev)
143
+ 4. Click the "+" icon next to a host to connect
144
+ 5. VSCode will handle the rest, using cloudX-proxy to establish the connection
145
+
146
+ ## AWS Permissions
147
+
148
+ The AWS user/role needs these permissions:
149
+
150
+ ```json
151
+ {
152
+ "Version": "2012-10-17",
153
+ "Statement": [
154
+ {
155
+ "Effect": "Allow",
156
+ "Action": [
157
+ "ec2:StartInstances",
158
+ "ec2:DescribeInstances",
159
+ "ssm:StartSession",
160
+ "ssm:DescribeInstanceInformation",
161
+ "ec2-instance-connect:SendSSHPublicKey"
162
+ ],
163
+ "Resource": "*"
164
+ }
165
+ ]
166
+ }
167
+ ```
168
+
169
+ ## Troubleshooting
170
+
171
+ 1. **Setup Issues**
172
+ - If AWS profile validation fails, ensure your user ARN matches the cloudX-{env}-{user} format
173
+ - For 1Password integration, ensure the CLI is installed and you're signed in
174
+ - Check that ~/.ssh/vscode directory has proper permissions (700)
175
+ - Verify main ~/.ssh/config is writable
176
+
177
+ 2. **Connection Timeout**
178
+ - Ensure the instance has the SSM agent installed and running
179
+ - Check that your AWS credentials have the required permissions
180
+ - Verify the instance ID is correct
181
+ - Increase the VSCode SSH timeout if needed
182
+
183
+ 3. **SSH Key Issues**
184
+ - If using 1Password SSH agent, verify agent is running (~/.1password/agent.sock exists)
185
+ - Check file permissions (600 for private key, 644 for public key)
186
+ - Verify the public key is being successfully pushed to the instance
187
+ - For stored keys in 1Password, ensure you can access them via the CLI
188
+
189
+ 4. **AWS Configuration**
190
+ - Confirm AWS CLI is configured with valid credentials
191
+ - Default region is eu-west-1 if not specified in profile or command line
192
+ - If using AWS profile organizer, ensure your environment directory exists at `~/.aws/aws-envs/<environment>/`
193
+ - Verify the Session Manager plugin is installed correctly
194
+ - Check that the instance has the required IAM role for SSM
195
+
196
+ 5. **Instance Setup Status**
197
+ - If setup appears stuck, check /home/ec2-user/.install-running exists
198
+ - Verify /home/ec2-user/.install-done is created upon completion
199
+ - Check instance system logs for setup script errors
200
+
201
+ ## License
202
+
203
+ MIT License - see LICENSE file for details
@@ -0,0 +1,3 @@
1
+ from ._version import __version__
2
+
3
+ __all__ = ['__version__']