You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
instance-ami: # put your custom ami id here if you want to use it, otherwise it will using latest ubuntu AMI from aws
47
-
api-endpoint: # optional, put your API endpoint regional sub-domain here to test connectivity, like when the execute-api vpc endpoint is not in the same account as Gitpod
47
+
api-endpoint: # optional, put your API endpoint regional sub-domain here to test connectivity, like when the execute-api vpc endpoint is not in the same account as Gitpod
48
+
# lambda-role-arn: arn:aws:iam::123456789012:role/MyExistingLambdaRole # Optional: Use existing IAM Role for Lambda mode
49
+
# lambda-sg-id: sg-0123456789abcdef0 # Optional: Use existing Security Group for Lambda mode
48
50
```
49
51
50
-
note: if using a custom AMI, please ensure the [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/manually-install-ssm-agent-linux.html) and [curl](https://curl.se/) are both installed. We rely on SSM's [SendCommand](https://docs.aws.amazon.com/code-library/latest/ug/ssm_example_ssm_SendCommand_section.html) to test HTTPS connectivity.
52
+
**Note:** The `lambda-role-arn` and `lambda-sg-id` fields correspond to the `--lambda-role-arn` and `--lambda-sg-id` command-line flags, respectively. Setting them in the config file or via environment variables (e.g., `NTCHK_LAMBDA_ROLE_ARN`) achieves the same result.
53
+
54
+
**EC2 Mode Note:** If using a custom AMI (`instance-ami`), please ensure the [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/manually-install-ssm-agent-linux.html) and [curl](https://curl.se/) are both installed. We rely on SSM's [SendCommand](https://docs.aws.amazon.com/code-library/latest/ug/ssm_example_ssm_SendCommand_section.html) to test HTTPS connectivity in EC2 mode.
51
55
52
56
2. Run the network diagnosis
53
57
54
-
To start the diagnosis, the the command: `./gitpod-network-check diagnose`
58
+
The tool supports different modes for running the checks, specified by the `--mode` flag (`ec2`, `lambda`, `local`).
59
+
60
+
**Using EC2 Mode (Default):**
61
+
62
+
This mode launches temporary EC2 instances in your specified subnets to perform the network checks. This most closely simulates the environment where Gitpod components will run.
63
+
64
+
To start the diagnosis using EC2 mode: `./gitpod-network-check diagnose --mode ec2` (or simply `./gitpod-network-check diagnose` as EC2 is the default).
55
65
56
66
```console
57
-
./gitpod-network-check diagnose
67
+
# Example output for EC2 mode
68
+
./gitpod-network-check diagnose --mode ec2
58
69
INFO[0000] ℹ️ Running with region `eu-central-1`, main subnet `[subnet-0ed211f14362b224f subnet-041703e62a05d2024]`, pod subnet `[subnet-075c44edead3b062f subnet-06eb311c6b92e0f29]`, hosts `[accounts.google.com https://github.com]`, ami ``, and API endpoint ``
59
70
INFO[0000] ✅ Main Subnets are valid
60
71
INFO[0000] ✅ Pod Subnets are valid
@@ -116,22 +127,51 @@ A CLI to check if your network setup is suitable for the installation of Gitpod.
116
127
INFO[0306] ✅ Security group 'sg-00d4a66a7840ebd67' deleted
117
128
```
118
129
130
+
**Using Lambda Mode:**
131
+
132
+
This mode uses AWS Lambda functions deployed into your specified subnets to perform the network checks. It avoids the need to launch full EC2 instances but has its own prerequisites.
133
+
134
+
***Prerequisites for Lambda Mode:**
135
+
***IAM Permissions:** The AWS credentials used to run `gitpod-network-check` need permissions to manage Lambda functions, IAM roles, security groups, and CloudWatch Logs. Specifically, it needs to perform actions like: `lambda:CreateFunction`, `lambda:GetFunction`, `lambda:DeleteFunction`, `lambda:InvokeFunction`, `iam:CreateRole`, `iam:GetRole`, `iam:DeleteRole`, `iam:AttachRolePolicy`, `iam:DetachRolePolicy`, `ec2:CreateSecurityGroup`, `ec2:DescribeSecurityGroups`, `ec2:DeleteSecurityGroup`, `ec2:AuthorizeSecurityGroupEgress`, `ec2:DescribeSubnets`, `logs:DeleteLogGroup`.
136
+
***Network Connectivity:** Lambda functions running within a VPC need a route to the internet or required AWS service endpoints. This typically requires a **NAT Gateway** in your VPC or **VPC Endpoints** for all necessary services (e.g., STS, CloudWatch Logs, ECR, S3, DynamoDB, and any target HTTPS hosts). Without proper outbound connectivity, the Lambda checks will fail.
137
+
138
+
***Running Lambda Mode:**
139
+
To start the diagnosis using Lambda mode:
140
+
```bash
141
+
./gitpod-network-check diagnose --mode lambda
142
+
```
143
+
144
+
***Using Existing Resources (Lambda Mode):**
145
+
If you have pre-existing IAM roles or Security Groups you want the Lambda functions to use, you can specify them using flags. This will prevent the tool from creating or deleting these specific resources.
The output will be similar to EC2 mode but will show Lambda functioncreation/invocation instead of EC2 instance management.
154
+
155
+
**Using Local Mode:**
156
+
157
+
This mode runs the checks directly from the machine where you execute the CLI. It's useful for basic outbound connectivity tests but **does not** accurately reflect the network environment within your AWS subnets.
158
+
159
+
To start the diagnosis using local mode: `./gitpod-network-check diagnose --mode local`
160
+
119
161
3. Clean up after network diagnosis
120
162
121
-
Dianosis is designed to do clean-up before it finishes. However, if the process terminates unexpectedly, you may clean-up AWS resources it creates like so:
163
+
The `diagnose` command is designed to cleanup the AWS resources it creates (EC2 instances, Lambda functions, IAM roles, Security Groups, CloudWatch Log groups) before it finishes. However, if the process terminates unexpectedly, you can manually trigger cleanup using the `clean` command. This command respects the `--mode` flag to clean up resources specific to that mode.
122
164
123
-
```console
124
-
./gitpod-network-check clean
125
-
INFO[0000] ✅ Main Subnets are valid
126
-
INFO[0000] ✅ Pod Subnets are valid
127
-
INFO[0000] ✅ Instances terminated
128
-
INFO[0000] Cleaning up: Waiting for 2 minutes so network interfaces are deleted
129
-
INFO[0121] ✅ Role 'GitpodNetworkCheck' deleted
130
-
INFO[0121] ✅ Instance profile deleted
131
-
INFO[0122] ✅ Security group 'sg-0a6119dcb6a564fc1' deleted
132
-
INFO[0122] ✅ Security group 'sg-07373362953212e54' deleted
165
+
```bash
166
+
# Clean up resources potentially left by EC2 mode
167
+
./gitpod-network-check clean --mode ec2
168
+
169
+
# Clean up resources potentially left by Lambda mode
170
+
./gitpod-network-check clean --mode lambda
133
171
```
134
172
173
+
**Note:** The `clean` command will *not* delete IAM roles or Security Groups if they were provided using the `--lambda-role-arn` or `--lambda-sg-id` flags during the `diagnose` run.
174
+
135
175
## FAQ
136
176
137
177
If the EC2 instances are timing out, or you cannot connect to them with Session Manager, be sure to add the following policies.
0 commit comments