Development Environment Setup Guide on Linux
Development Environment Setup Guide on Linux
Section titled “Development Environment Setup Guide on Linux”Introduction
Section titled “Introduction”This guide establishes a cloud-based development environment using Amazon Linux 2023 or Ubuntu 24.04 on AWS EC2, specifically designed for the GenAI IDP accelerator.
Purpose: Provides a standardized, scalable development infrastructure that combines the familiar VSCode interface on your local machine with powerful cloud compute resources. This approach eliminates local environment configuration issues while ensuring consistent development experiences across team members.
When to use this guide:
- You need a new development environment
- Your current setup has configuration issues
- You prefer cloud-based development with scalable resources
- You want a clean, isolated environment for this project
What you’ll achieve:
A hybrid development setup where your code runs on a pre-configured Amazon Linux EC2 instance while you work through VS Code on your local machine, providing both performance and consistency.
Step 1: Launch EC2 Instance
Section titled “Step 1: Launch EC2 Instance”1.1 Navigate to EC2 Console
Section titled “1.1 Navigate to EC2 Console”- Log into AWS Management Console
- Navigate to EC2 service
- Click Launch Instance
1.2 Configure Instance Settings
Section titled “1.2 Configure Instance Settings”Name: genai-idp-dev-environment(example)
AMI Selection (choose one):
Option 1: Amazon Linux 2023
Option 2: Ubuntu 24.04
Instance Type:
- Heavy development: t3.2xlarge (8 vCPU, 32 GB RAM)(recommended)
(Other instance types will also work, but this is one we tested)
1.3 Key Pair Setup
Section titled “1.3 Key Pair Setup”- Click Create new key pair (or select existing)
- Name: genai-idp-dev-key (example)
- Type: RSA
- Format: .pem
- Download and save the .pem file securely
1.4 Network Settings
Section titled “1.4 Network Settings”Security Group Configuration:
- Create new security group
- Add these inbound rules:
- SSH: Port 22, Source: My IP
1.5 Storage Configuration
Section titled “1.5 Storage Configuration”- Size: 720 GiB
- Type: gp3
- Delete on termination: Yes
1.6 Launch
Section titled “1.6 Launch”Click Launch instance and wait for it to reach “Running” state.
Step 2: Connect to Your Instance
Section titled “Step 2: Connect to Your Instance”Get Connection Info
Section titled “Get Connection Info”- Select your instance in EC2 console
- Note the Public IPv4 address
SSH Connection Command
Section titled “SSH Connection Command”On local machine:
CMD Terminal
Section titled “CMD Terminal”ssh -i /path/to/genai-idp-dev-key.pem ec2-user@YOUR_INSTANCE_IP
To install git run this command on EC2 Instance
Section titled “To install git run this command on EC2 Instance”For Amazon Linux 2023:
sudo dnf install git -yFor Ubuntu 24.04:
sudo apt update && sudo apt install git -yClone Repository
Section titled “Clone Repository”git clone https://github.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws
Go to directory
Section titled “Go to directory”cd accelerated-intelligent-document-processing-on-aws/
Run the setup script for development tools which is scripts directory
Section titled “Run the setup script for development tools which is scripts directory”cd scripts
For Amazon Linux 2023:
chmod +x ./dev_setup_al2023.sh./dev_setup_al2023.shFor Ubuntu 24.04:
chmod +x ./dev_setup_ubuntu.sh./dev_setup_ubuntu.shTo upgrade the python version run this command on EC2 instance
Section titled “To upgrade the python version run this command on EC2 instance”For Amazon Linux 2023:
source /home/ec2-user/miniconda/bin/activate baseFor Ubuntu 24.04:
source /home/ubuntu/miniconda/bin/activate baseStep 4: Install Visual Studio Code on Local Machine
Section titled “Step 4: Install Visual Studio Code on Local Machine”4.1 Visit the official website: Go to https://code.visualstudio.com/
Section titled “4.1 Visit the official website: Go to https://code.visualstudio.com/”Download: Click the “Download for Windows” button
- This will download the User Installer (recommended for most users)
- File name will be something like VSCodeUserSetup-x64-1.x.x.exe
Install:
- Run the downloaded installer
- Choose installation location (default is recommended)
Launch: Click “Launch Visual Studio Code” when installation completes
Install Remote - SSH extension (by Microsoft)
4.2 Connect via VSCode: Update your SSH config
Section titled “4.2 Connect via VSCode: Update your SSH config”To open “SSH Config” go to “Remote Explorer” option on left bar
You can open and edit “SSH config” file by settings option on “SSH” Tab
For Amazon Linux 2023:
Host genai-idp-dev HostName YOUR_INSTANCE_PUBLIC_IP User ec2-user IdentityFile /path/to/genai-idp-dev-key.pem Port 22For Ubuntu 24.04:
Host genai-idp-dev-ubuntu HostName YOUR_INSTANCE_PUBLIC_IP User ubuntu IdentityFile /path/to/genai-idp-dev-key.pem Port 224.3 Connect via VSCode
Section titled “4.3 Connect via VSCode”- Press Ctrl+Shift+P
- Type “Remote-SSH: Connect to Host”
- Select “genai-idp-dev” (Amazon Linux) or “genai-idp-dev-ubuntu” (Ubuntu)
- Open folder:
- Amazon Linux:
/home/ec2-user/accelerated-intelligent-document-processing-on-aws - Ubuntu:
/home/ubuntu/accelerated-intelligent-document-processing-on-aws
- Amazon Linux:
Step 5: AWS Configure
Section titled “Step 5: AWS Configure”Refer this link for AWS configure
Section titled “Refer this link for AWS configure”https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html
Step 6: Install the IDP CLI
Section titled “Step 6: Install the IDP CLI”Install the CLI and Dependencies
Section titled “Install the CLI and Dependencies”make setup-venvsource .venv/bin/activateNote: This installs the
idp-clicommand along with all required Python dependencies.
Step 7: Test the Build
Section titled “Step 7: Test the Build”Using idp-cli publish
Section titled “Using idp-cli publish”Test CLI help
Section titled “Test CLI help”idp-cli publish --helpTest build
Section titled “Test build”Standard build and publish:
idp-cli publish --source-dir . --region us-east-1Pattern-2 container images are built automatically when Pattern-2 changes are detected. Ensure Docker is running and you have ECR permissions.
Troubleshooting Build Issues
Section titled “Troubleshooting Build Issues”If the build fails, use the --verbose flag to see detailed error messages:
idp-cli publish --source-dir . --region us-east-1 --verboseThe verbose flag will show:
- Exact SAM build commands being executed
- Complete error output from failed builds
- Python version compatibility issues
- Missing dependencies or configuration problems
Note: The legacy
publish.pyscript is deprecated. Useidp-cli publishfor all new builds.
Step 7: Cline & Q Developer installation
Section titled “Step 7: Cline & Q Developer installation”What it is: An AI coding assistant that runs as a VS Code extension, powered by various LLMs (Claude, GPT, etc.)
Key capabilities:
- Autonomous code editing across multiple files
- Executes terminal commands and reads file outputs
- Can browse the web for documentation/research
- Maintains context across entire codebases
- Handles complex, multi-step development tasks
Why it’s helpful: Acts like an AI pair programmer that can actually write, test, and debug code independently while you supervise.
- You can install it from “Extensions” tab on VSCode.
Amazon Q Developer
Section titled “Amazon Q Developer”What it is: AWS’s AI coding assistant integrated into IDEs, specifically designed for AWS development
Key capabilities:
- Code suggestions and completions optimized for AWS services
- Security vulnerability scanning and fixes
- AWS best practices recommendations
- Infrastructure as Code (CloudFormation, CDK) assistance
- Direct integration with AWS documentation and services
Why it’s helpful: Specialized for AWS development with deep knowledge of AWS services, perfect for this GenAI-IDP project since it’s built entirely on AWS.
- You can install it from https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html