# Install Kali on AWS

#### **Chapter 6: Installing Kali Linux on AWS**

Installing Kali Linux on AWS allows you to leverage cloud resources for scalable and remote security testing. This guide covers setting up Kali Linux on AWS and installing the desktop environment separately for GUI access.

**Step-by-Step Guide to Install Kali Linux on AWS**

**1. Prerequisites**

* **AWS Account**: You need an active AWS account. Create one at [aws.amazon.com](https://aws.amazon.com/).
* **Familiarity with AWS**: Basic knowledge of AWS services, including EC2.

**2. Launching a Kali Linux Instance on AWS**

1. **Log in to AWS Management Console**:
   * Navigate to the EC2 dashboard.
2. **Launch Instance**:
   * Click “Launch Instance” and choose an Amazon Machine Image (AMI).
3. **Choose an AMI**:
   * Search for “Kali Linux” in the AWS Marketplace and select the latest official Kali Linux AMI.
4. **Choose an Instance Type**:
   * Select an instance type suitable for your workload (e.g., t2.medium or larger).
5. **Configure Instance Details**:
   * Set up network settings like VPC, Subnet, and Security Group rules (allow SSH access on port 22).
6. **Add Storage**:
   * Use the default storage or increase it as needed (minimum 20GB).
7. **Configure Security Group**:
   * Ensure inbound rules for SSH (port 22) and, later, remote desktop access are allowed.
8. **Launch the Instance**:
   * Review and launch the instance, selecting or creating a key pair for SSH access.

**3. Connecting to Your Kali Instance**

1. **Connect via SSH**:
   *   Use your key pair to connect:

       ```bash
       ssh -i "your-key.pem" kali@your-public-ip
       ```

**4. Installing a Desktop Environment on AWS Kali Linux**

The AWS AMIs typically include only the command line. Follow these steps to add a GUI.

1.  **Update the System**:

    ```bash
    sudo apt update && sudo apt upgrade
    ```
2.  **Install XFCE Desktop Environment**:

    ```bash
    sudo apt install -y kali-desktop-xfce
    ```
3.  **Install VNC Server**:

    ```bash
    sudo apt install -y tightvncserver
    ```
4. **Configure VNC Server**:
   *   Set a VNC password and start the server:

       ```bash
       vncserver :1
       ```
5. **Connect to the Desktop**:
   * Use a VNC viewer on your local machine and connect to `your-public-ip:1`.

**5. Post-Installation Configuration**

* **Secure VNC Connection**: Use SSH tunnelling to secure VNC traffic.
* **Firewall Rules**: Modify security group settings to allow VNC access if needed.

**6. Troubleshooting Tips**

* **Performance Issues**: Resize the instance for better performance.
* **Connection Errors**: Check security groups and firewall settings.
