> For the complete documentation index, see [llms.txt](https://docs.hivel.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hivel.ai/self-managed-hivel-deployment/virtual-private-cloud/aws/hivel-on-premises-deployment-guide-aws/aws-infrastructure-setup-and-aws-cli-configuration.md).

# AWS Infrastructure Setup and AWS CLI Configuration

Set up your EC2 instance and configure the AWS CLI to authenticate with Hivel's container registry.

**Provision EC2 Instance**

1. In AWS Console, launch a new EC2 instance.
2. Choose **Ubuntu 22.04 LTS or later.**
3. Instance type: **t3.xlarge** (4 vCPU, 16GB RAM).
4. Storage: **50GB gp3** EBS volume.
5. Security group: Allow inbound on ports **22**, **80**, **443**, **3000**, **4317 (required only if integrating Claude Code)** and **5432**.
6. Note the instance's public/private IP address.
7. SSH into the instance to confirm access.

### **Install Required Software**

SSH into your instance and run:

{% code expandable="true" %}

```
# Update system and install postgres, unzip
sudo apt update && sudo apt upgrade -y
sudo apt install -y postgresql postgresql-contrib
sudo apt install -y unzip

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

# Install PostgreSQL client (needed to test RDS connectivity and create the database)
sudo apt install -y postgresql-client

# Verify installations
docker --version
docker-compose --version
aws --version
psql --version

# Log out and back in for Docker group changes to take effect
```

{% endcode %}

### **Verify Software Installation**

After logging back in, each --version command should print a version string with no errors. If `docker` commands still ask for sudo after logging back in, run `newgrp docker` or reboot the instance.

### **Configure AWS CLI**

1. Run `aws configure` on the VM.
2. Enter the values when prompted:
   * **AWS Access Key ID:** \[Hivel-provided access key]
   * **AWS Secret Access Key:** \[Hivel-provided secret key]
   * **Default region name:** `ap-south-1`
   * **Default output format:** `json`

### Verify AWS CLI Configuration

```
# Test AWS CLI access
aws sts get-caller-identity
# This should return your AWS account details
```

This should return a JSON object with your AWS account details (Account, UserId, Arn). If it fails with "Unable to locate credentials," re-run `aws configure` and verify with `cat ~/.aws/credentials`.

<br>

{% columns %}
{% column %} <a href="/self-managed-hivel-deployment/virtual-private-cloud/aws/hivel-on-premises-deployment-guide-aws.md" class="button primary" data-icon="backward">Back to Hivel On-Premises Deployment Guide (AWS)</a>
{% endcolumn %}

{% column %}

{% endcolumn %}

{% column %} <a href="/self-managed-hivel-deployment/virtual-private-cloud/aws/hivel-on-premises-deployment-guide-aws/prerequisites-overview.md" class="button primary" data-icon="forward">Prerequisites - Overview</a>
{% endcolumn %}
{% endcolumns %}

\
\ <br>
