Skip to content

Commit b5a5fb3

Browse files
author
EC2 Default User
committed
Add Linux development environment setup guide
- Comprehensive guide for setting up EC2-based development environment - Includes EC2 instance configuration, SSH setup, and development tools - Covers VSCode remote development setup - Provides verification steps for the development environment
1 parent 71a40d0 commit b5a5fb3

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Development Environment Setup Guide
2+
3+
## Step 1: Launch EC2 Instance
4+
5+
### 1.1 Navigate to EC2 Console
6+
1. Log into [AWS Management Console](https://console.aws.amazon.com/)
7+
2. Navigate to EC2 service
8+
3. Click Launch Instance
9+
10+
### 1.2 Configure Instance Settings
11+
Name: genai-idp-dev-environment
12+
AMI Selection:
13+
**Amazon Linux 2023**
14+
• Search: "Amazon Linux 2023 AMI"
15+
• Architecture: 64-bit (x86)
16+
Instance Type:
17+
• Heavy development: t3.xlarge (4 vCPU, 16 GB RAM)
18+
19+
### 1.3 Key Pair Setup
20+
1. Click Create new key pair (or select existing)
21+
2. Name: genai-idp-dev-key
22+
3. Type: RSA
23+
4. Format: .pem
24+
5. Download and save the .pem file securely
25+
26+
### 1.4 Network Settings
27+
Security Group Configuration:
28+
1. Create new security group: genai-idp-dev-sg
29+
2. Add these inbound rules:
30+
**SSH**: Port 22, Source: My IP
31+
32+
### 1.5 Storage Configuration
33+
• Size: 30 GiB (minimum 20GB)
34+
• Type: gp3
35+
• Delete on termination: Yes
36+
37+
### 1.6 Launch
38+
Click Launch instance and wait for it to reach "Running" state.
39+
40+
## Step 2: Connect to Your Instance
41+
42+
### Get Connection Info
43+
1. Select your instance in EC2 console
44+
2. Note the Public IPv4 address
45+
46+
### SSH Connection Command
47+
48+
For Amazon Linux 2023:
49+
```bash
50+
# Command Prompt
51+
ssh -i /path/to/genai-idp-dev-key.pem ec2-user@YOUR_INSTANCE_IP
52+
53+
# Windows PowerShell:
54+
ssh -i C:\path\to\genai-idp-dev-key.pem ec2-user@YOUR_INSTANCE_IP
55+
```
56+
57+
## Step 3: Install Development Tools
58+
Once connected, run these commands:
59+
60+
### 3.1 Verify User Data Results
61+
62+
```bash
63+
# Check versions
64+
python3 --version # Should be 3.13.x
65+
aws --version # Should be aws-cli/2.x
66+
```
67+
68+
### 3.2 Install Build Tools
69+
```bash
70+
# Amazon Linux 2023:
71+
sudo yum groupinstall -y "Development Tools"
72+
sudo yum install -y make gcc gcc-c++ jq
73+
```
74+
75+
### 3.3 Generate an SSH key
76+
```bash
77+
# Run the following command to generate an ECDSA key:
78+
ssh-keygen -t ecdsa -b 521 -C "[email protected]"
79+
```
80+
81+
Press Enter to save the key as ~/.ssh/id_ecdsa. Optionally, add a passphrase.
82+
83+
### 3.4 Initialize the key with AWS GitLab
84+
```bash
85+
# Register your SSH public key with GitLab:
86+
mwinit -k ~/.ssh/id_ecdsa.pub
87+
```
88+
89+
### 3.5 Test the connection
90+
```bash
91+
# Verify that you can connect to GitLab over SSH:
92+
ssh -T ssh.gitlab.aws.dev
93+
```
94+
95+
Expected output:
96+
```
97+
Welcome to GitLab, @your-username!
98+
```
99+
100+
### 3.6 Setup Python Environment
101+
```bash
102+
# Create and activate virtual environment
103+
python3 -m venv venv
104+
source venv/bin/activate
105+
106+
# Install dependencies
107+
pip install --upgrade pip
108+
cd lib/idp_common_pkg
109+
pip install -e .
110+
cd ../..
111+
```
112+
113+
## Step 4: VSCode Remote Development Setup
114+
115+
### 4.1 Install VSCode Extension (Local Machine)
116+
1. Open VSCode on your local computer
117+
2. Install Remote - SSH extension (by Microsoft)
118+
119+
### Clone your repository
120+
Once connected, clone repositories using SSH:
121+
```bash
122+
git clone [email protected]:your-group/your-repo.git
123+
```
124+
125+
### 4.2 Connect via VSCode: Update your SSH config
126+
Press Ctrl+Shift+P for commands
127+
Append the following block to your ~/.ssh/config file:
128+
129+
```
130+
Host genai-idp-dev
131+
HostName YOUR_INSTANCE_PUBLIC_IP
132+
User ec2-user
133+
IdentityFile /path/to/genai-idp-dev-key.pem
134+
Port 22
135+
```
136+
137+
### 4.3 Connect via VSCode
138+
1. Press Ctrl+Shift+P
139+
2. Type "Remote-SSH: Connect to Host"
140+
3. Select "genai-idp-dev"
141+
4. Open folder: /home/ec2-user/genaiic-idp-accelerator
142+
143+
## Step 5: Verify Setup
144+
145+
### Test Development Environment
146+
```bash
147+
# Activate virtual environment
148+
source venv/bin/activate
149+
```
150+
151+
### Test Build Process
152+
```bash
153+
# Test publish script help
154+
./scripts/publish.sh --help
155+
156+
# Test build (this will take 10-15 minutes)
157+
./scripts/publish.sh --build-only --region us-east-1
158+
```

0 commit comments

Comments
 (0)