Development Tools

Visual Studio Code User Guide

| Product: Visual Studio Code

Overview

This guide provides comprehensive instructions for deploying and using the cloudimg Visual Studio Code AMI on Amazon Web Services. The AMI delivers a fully preconfigured Windows Server instance with Visual Studio Code installed and ready to use, enabling you to begin coding immediately after launch.

Visual Studio Code (VS Code) is a free, open source code editor developed by Microsoft. It provides a lightweight yet powerful development environment with features such as IntelliSense code completion, integrated debugging, built in Git support, syntax highlighting for hundreds of programming languages, and a vast ecosystem of extensions available through the Visual Studio Marketplace. VS Code supports development in virtually every programming language including Python, JavaScript, TypeScript, C#, Java, Go, Rust, PHP, and many more.

This AMI is ideal for developers who need a cloud based development environment accessible from anywhere, teams that require a consistent development setup across members, or organizations that want to centralize development workstations on AWS. Running VS Code on an AWS instance provides access to scalable compute resources, low latency connections to AWS services, and the flexibility to develop from any device with an RDP client.

For any issues encountered while following this guide, please contact support@cloudimg.co.uk.


Prerequisites

Before launching the Visual Studio Code AMI, ensure you have the following in place.

AWS Account You need an active AWS account with permissions to launch EC2 instances, manage security groups, and access the AWS Marketplace.

EC2 Key Pair Create or identify an existing EC2 key pair in the region where you plan to launch the instance. This key pair is required to decrypt the Windows Administrator password after launch.

Security Group Prepare a security group that allows inbound RDP access. The required rule is outlined below.

Protocol Type Port Description
RDP TCP 3389 Remote Desktop Access

It is strongly recommended to restrict the source IP range for RDP access to your known IP addresses or corporate CIDR blocks rather than allowing access from 0.0.0.0/0.

Remote Desktop Client Install a Remote Desktop Protocol client on your local machine. Options include Microsoft Remote Desktop (available for Windows and macOS), Remmina (Linux), or any other RDP compatible client.

Minimum Instance Requirements

Minimum CPU Minimum RAM Required Disk Space
1 vCPU 1 GB 30 GB

While the minimum requirements above will allow the instance to run, a t3.small or t3.medium is recommended for a comfortable development experience. If you plan to run development servers, build tools, or work with large projects, a t3.medium or larger will provide better performance.


Step by Step Setup

Follow the steps below to launch and connect to your Visual Studio Code instance.

Step 1: Launch the Instance

  1. Log in to your AWS account and navigate to the AWS Marketplace.
  2. Search for the cloudimg Visual Studio Code AMI.
  3. Select your desired instance type (t3.small or larger is recommended).
  4. Choose your preferred region and VPC configuration.
  5. Select the EC2 key pair you created in the prerequisites.
  6. Assign the security group with RDP access on port 3389.
  7. Configure storage (30 GB minimum on the root volume).
  8. Launch the instance.

Step 2: Wait for Status Checks

After launching the instance, navigate to the EC2 console and wait for the instance to show 2/2 status checks passing. This ensures the instance has fully booted and Windows has completed its initial setup. This process typically takes between 3 and 10 minutes.

Step 3: Retrieve the Administrator Password

  1. Open the EC2 console in the AWS region where you launched the instance.
  2. Select Instances from the left navigation panel.
  3. Locate and select your newly launched instance.
  4. Click Actions at the top of the page.
  5. Navigate to Security and then select Get Windows password.
  6. Click Browse and upload the private key file (.pem) from the key pair you selected during launch.
  7. Click Decrypt password.
  8. Copy the decrypted password and store it securely. This is your Administrator password.

Step 4: Connect via Remote Desktop

  1. Open your Remote Desktop client application.
  2. Create a new connection using the public IP address of your EC2 instance (or the private IP if connecting through a VPN or from within the same VPC).
  3. Enter the following credentials when prompted:
  4. Username: Administrator
  5. Password: The decrypted value from Step 3
  6. If a certificate warning appears, click Continue to proceed. This is expected for new connections.
  7. You will be connected to the Windows Server desktop.

Step 5: Launch Visual Studio Code

Once connected to the desktop, locate the Visual Studio Code shortcut icon on the desktop and double click it to launch the application. VS Code is preinstalled and ready for use immediately.


Server Components

The following software components are preinstalled on this AMI.

Component Version
Visual Studio Code Latest

The AMI is built on Windows Server and includes the base operating system along with Visual Studio Code preinstalled and configured. VS Code includes its built in terminal, Git integration, and the ability to install extensions for additional language support and tooling.


Filesystem Layout

The instance uses a single volume configuration.

Drive Purpose Minimum Size
C:\ Operating system and application 30 GB

Key directory locations on the instance:

Path Description
C:\Program Files\Microsoft VS Code\ VS Code installation directory
C:\Users\Administrator\Desktop\ Desktop with VS Code shortcut
C:\Users\Administrator.vscode\ Extensions directory
C:\Users\Administrator\AppData\Roaming\Code\ User settings, keybindings, and state
C:\Users\Administrator\Documents\ Recommended location for project files

If you work with large projects or many extensions, consider attaching an additional EBS volume and using it for your project workspace to keep the system drive from filling up.


Managing the Application

Opening a Project Folder

  1. Launch VS Code from the desktop shortcut.
  2. Click File then Open Folder.
  3. Navigate to the folder containing your project files and click Select Folder.
  4. VS Code will open the folder and display the file tree in the Explorer panel on the left.

Alternatively, you can open VS Code from the command line. Open the Command Prompt and run:

code C:\path\to\your\project

Installing Extensions

VS Code's functionality can be greatly expanded through extensions. To install an extension:

  1. Click the Extensions icon in the Activity Bar on the left side of the window (or press Ctrl+Shift+X).
  2. Search for the extension you want to install (for example, Python, C#, ESLint, Prettier).
  3. Click Install on the extension you want.
  4. Some extensions may require a reload of VS Code to activate.

Popular extensions for common development workflows include:

  • Python by Microsoft for Python development with IntelliSense and debugging
  • C# by Microsoft for .NET development
  • ESLint for JavaScript and TypeScript linting
  • Prettier for code formatting
  • GitLens for enhanced Git capabilities
  • Remote SSH for connecting to remote servers
  • Docker for container management
  • AWS Toolkit for interacting with AWS services

Using the Integrated Terminal

VS Code includes a built in terminal that you can use without leaving the editor:

  1. Open the terminal by pressing Ctrl+` (backtick) or navigating to Terminal then New Terminal.
  2. The terminal opens at the bottom of the VS Code window.
  3. You can run commands, scripts, and build tools directly from the integrated terminal.
  4. Multiple terminal instances can be created by clicking the + button in the terminal panel.

Using Git Integration

VS Code has built in Git support:

  1. Open a project folder that is a Git repository (or initialize one with git init).
  2. Click the Source Control icon in the Activity Bar (or press Ctrl+Shift+G).
  3. View changed files, stage changes, write commit messages, and commit directly from the VS Code interface.
  4. Push, pull, and sync with remote repositories using the options in the Source Control panel.

If Git is not already installed on the instance, you can download and install it from the official Git website using the built in browser.

Configuring Settings

VS Code settings can be customized to match your preferences:

  1. Open Settings by pressing Ctrl+, or navigating to File then Preferences then Settings.
  2. Search for settings by name or browse categories.
  3. Changes are saved automatically and apply immediately.
  4. For advanced configuration, click the Open Settings (JSON) icon in the top right to edit the settings file directly.

Using IntelliSense

IntelliSense provides intelligent code completion, parameter info, quick info, and member lists:

  1. Start typing in the editor and IntelliSense suggestions will appear automatically.
  2. Press Ctrl+Space to trigger IntelliSense manually.
  3. Use the arrow keys to navigate suggestions and Tab or Enter to accept.
  4. Install language specific extensions for enhanced IntelliSense support.

Debugging

VS Code includes a powerful debugger:

  1. Open the file you want to debug.
  2. Set breakpoints by clicking in the gutter next to line numbers.
  3. Click the Run and Debug icon in the Activity Bar (or press Ctrl+Shift+D).
  4. Configure a launch configuration if prompted (VS Code provides templates for common scenarios).
  5. Click the green play button to start debugging.
  6. Use the debug toolbar to step through code, inspect variables, and evaluate expressions.

Using the Command Palette

The Command Palette provides access to all VS Code commands:

  1. Press Ctrl+Shift+P to open the Command Palette.
  2. Type the name of the command you want to execute.
  3. Select the command from the list and press Enter.

Scripts and Logs

VS Code Logs

VS Code generates log files that are useful for diagnosing application issues.

Log Location Description
C:\Users\Administrator\AppData\Roaming\Code\logs\ VS Code application logs
C:\Users\Administrator.vscode\extensions\ Installed extensions directory

To view VS Code logs from within the application, open the Command Palette (Ctrl+Shift+P) and type Developer: Open Logs Folder to navigate directly to the log directory.

Extension Output

Many extensions provide output in the Output panel:

  1. Navigate to View then Output (or press Ctrl+Shift+U).
  2. Select the extension or channel from the dropdown to view its output.

Windows Event Logs

For system level diagnostics, use the Windows Event Viewer. Press the Windows key, search for Event Viewer, and open it to review application and system logs.


Troubleshooting

Cannot connect via RDP

  • Verify that the instance has passed 2/2 status checks in the EC2 console.
  • Confirm that your security group allows inbound TCP traffic on port 3389 from your IP address.
  • Ensure you are using the correct public IP address. If the instance was stopped and started, the public IP may have changed unless you are using an Elastic IP.
  • Check that your local firewall or corporate network is not blocking outbound RDP connections.

Password decryption fails

  • Ensure you are uploading the correct .pem file that matches the key pair selected during instance launch.
  • The password may take up to 15 minutes to become available after the first launch. Wait and try again if the option is greyed out.

VS Code does not launch or crashes

  • Try launching VS Code again from the desktop shortcut or by running code from the Command Prompt.
  • Delete the VS Code state directory at C:\Users\Administrator\AppData\Roaming\Code\ and restart the application if it is corrupted.
  • Check the Windows Event Viewer for application error messages.
  • Verify the C: drive has sufficient free space.

Extensions fail to install

  • Ensure the instance has outbound internet access on port 443 (HTTPS) so VS Code can reach the Visual Studio Marketplace.
  • If the instance is in a private subnet, configure a NAT gateway to allow outbound traffic.
  • Try installing the extension from the command line using code --install-extension <extension_id>.

IntelliSense is not working

  • Ensure the appropriate language extension is installed (for example, the Python extension for .py files).
  • Some languages require additional runtime installations. For example, Python IntelliSense requires Python to be installed on the system.
  • Reload VS Code by pressing Ctrl+Shift+P and typing Developer: Reload Window.

Integrated terminal does not open

  • Try opening a new terminal from the menu bar: Terminal then New Terminal.
  • If PowerShell is not available, switch the default shell to Command Prompt in the VS Code settings by searching for terminal.integrated.defaultProfile.windows.

VS Code performance is poor

  • Consider upgrading to a larger instance type with more CPU and RAM.
  • Disable extensions that you are not actively using to reduce resource consumption.
  • Close files and editor tabs that are not needed.
  • Reduce the number of open terminal instances.

Insufficient disk space

  • Extensions and their dependencies can consume significant disk space. Remove unused extensions from the Extensions panel.
  • Monitor the C: drive usage through Windows Explorer.
  • Attach an additional EBS volume for project files.

RDP session disconnects frequently

  • Check your network connection stability.
  • Adjust the RDP client settings to reduce bandwidth requirements by lowering the display quality or disabling visual effects.
  • Ensure the instance is not running out of memory, which could cause Windows to become unresponsive.

Security Recommendations

Change the Administrator Password

After your first login, change the default Administrator password to a strong, unique password. Open the Windows command prompt or PowerShell and run:

net user Administrator YourNewStrongPassword

Note that once you change the password, the original decrypted password from the AWS console will no longer be valid.

Restrict RDP Access

Limit the security group rule for port 3389 to only your specific IP addresses or a trusted CIDR range. Avoid using 0.0.0.0/0, which would expose the instance to RDP brute force attacks from the entire internet.

Install Only Trusted Extensions

Only install extensions from verified publishers on the Visual Studio Marketplace. Extensions have access to files on the system and can execute code, so ensure you trust the source before installing.

Use IAM Roles for AWS Development

If you use the AWS Toolkit extension or develop applications that interact with AWS services, attach an IAM role to the EC2 instance rather than storing AWS access keys on the server. This provides automatic credential rotation and eliminates the risk of credential leakage.

Enable Windows Firewall Rules

Review and configure the Windows Firewall to restrict inbound and outbound traffic to only what is necessary for your development workflow.

Keep Software Updated

Regularly update VS Code and Windows Server to ensure you have the latest security patches and bug fixes. VS Code checks for updates automatically and will notify you when a new version is available.

Secure Source Code

If you are working with proprietary source code on this instance, ensure appropriate access controls are in place. Use private Git repositories and authenticate with SSH keys or personal access tokens.

Use an Elastic IP

Assign an Elastic IP to your instance to maintain a consistent IP address across stop and start cycles. This allows you to maintain consistent firewall rules and simplifies access management.

Enable CloudWatch Monitoring

Configure Amazon CloudWatch to monitor your instance metrics such as CPU utilization, memory usage, and disk space. Set up alarms to notify you if resources are running low.

Back Up Your Work

Use Git to commit and push your code to a remote repository regularly. Additionally, use EBS snapshots to create periodic backups of the instance volume. This provides protection against accidental data loss.


Support

If you encounter any issues not covered in this guide, the cloudimg support team is available to help.

  • Email: support@cloudimg.co.uk
  • Phone: (+44) 02045382725
  • Website: www.cloudimg.co.uk
  • Address: 3rd Floor, 86 90 Paul Street, London, EC2A 4NE

Support is available for any issues related to the AMI, including connectivity problems, software configuration, and general guidance on using the preconfigured environment.

When contacting support, please include your EC2 instance ID, the AWS region, and a description of the issue along with any relevant error messages or screenshots.