Skip to main content

Couchbase Server on EC2

Self-Hosted Alternative

Running Couchbase Server on EC2 gives you full control over your database infrastructure while leveraging AWS's reliable cloud platform. This is ideal for organizations that prefer self-managed deployments over Capella's managed service.

EC2 Instance Requirements

Instance Sizing

Instance Recommendations
  • Minimum: t3.small or t3.medium (avoid micro instances)
  • Recommended: t3.large or m5.large for better performance
  • Production: m5.xlarge or larger based on workload requirements

Why not micro instances?

  • Insufficient memory for Couchbase services
  • Poor I/O performance for database operations
  • May cause stability issues under load

Operating System Support

Couchbase Server supports multiple Linux distributions on EC2:

Amazon Linux 2 (Recommended for EC2)

  • Optimized for AWS infrastructure
  • Built-in AWS integrations
  • Regular security updates from AWS
Instance Type
Amazon Linux 2 AMI (HVM), SSD Volume Type
Instance: t3.large or larger
Storage: 20GB+ GP3 SSD

Security Group Configuration

Required Ports for Couchbase

Configure your EC2 security group to allow the following ports:

Critical Security Configuration

Properly configuring security groups is essential for both functionality and security. Missing ports will prevent FHIR CE from connecting to Couchbase.

Inbound Rules:

Port RangeProtocolSourcePurpose
8091-8096TCPCustom IP or 0.0.0.0/0Couchbase Web Console & APIs
11210-11211TCPFHIR Server IPCouchbase Client Connections
18091-18096TCPCustom IP or 0.0.0.0/0Couchbase SSL Ports (if using SSL)
80TCP0.0.0.0/0HTTP (for FHIR server communication)
443TCP0.0.0.0/0HTTPS (optional, for secure access)
22TCPYour IPSSH Access

For Development/Testing:

Source: 0.0.0.0/0 (Allow from anywhere)
  • Convenient for development and testing
  • Not recommended for production
  • Easy to set up and troubleshoot

Installation Process

Step 1: Download Couchbase Server

Visit the official Couchbase downloads page: https://www.couchbase.com/downloads/?family=couchbase-server

Choose the Enterprise Edition package that matches your EC2 instance's operating system.

Step 2: Install Based on OS

Install on Amazon Linux 2
# Download the RPM package (replace with latest version URL)
wget https://packages.couchbase.com/releases/7.2.4/couchbase-server-enterprise-7.2.4-amzn2.x86_64.rpm

# Install Couchbase Server
sudo rpm -ivh couchbase-server-enterprise-7.2.4-amzn2.x86_64.rpm

# Start Couchbase Service
sudo systemctl start couchbase-server
sudo systemctl enable couchbase-server

Couchbase Configuration

Access Web Console

After installation, access the Couchbase Web Console:

http://YOUR-EC2-PUBLIC-IP:8091
Getting Your EC2 Public IP

Find your instance's public IP in the AWS EC2 console or run:

curl http://checkip.amazonaws.com/

Setup Process

Same as Docker Setup

The Couchbase configuration process is identical to the Docker setup:

  1. Setup New Cluster
  2. Create Administrator Credentials
  3. Configure Services (Data, Query, Index, Search)
  4. Set Memory Quotas
  5. Create FHIR Bucket(s)

Follow the same steps as described in the Couchbase Docker guide for detailed configuration instructions.

EC2-Specific Considerations

Performance Optimization

Storage:

  • Use GP3 SSD for better IOPS performance
  • Allocate sufficient storage for your data volume
  • Consider separate volumes for data and logs

Networking:

  • Use Enhanced Networking for better network performance
  • Consider Placement Groups for multi-node deployments
  • Monitor network utilization and adjust instance types as needed

Monitoring & Maintenance

Useful Commands
# Check Couchbase service status
sudo systemctl status couchbase-server

# View Couchbase logs
sudo tail -f /opt/couchbase/var/lib/couchbase/logs/couchbase.log

# Check memory and disk usage
free -h
df -h

Backup Considerations

Data Protection
  • Set up regular EC2 snapshots for your instance
  • Configure Couchbase backup using cbbackup or Backup Service
  • Consider cross-region backup for disaster recovery

Network Access for FHIR CE

Connection from FHIR Server

Your FHIR CE server will need to connect to this EC2 instance. Ensure:

  1. Security Group allows traffic from FHIR server IP
  2. Network ACLs don't block the connection
  3. Route tables are properly configured
  4. DNS resolution works (use public IP or Route 53)
Connection String for FHIR CE

When configuring FHIR CE, use your EC2 instance's connection details:

connection:
connectionString: "couchbase://YOUR-EC2-PUBLIC-IP"
username: "Administrator"
password: "your-password"
serverType: "Server"
sslEnabled: false
Next Steps

Your EC2 Couchbase Server is ready! You can now proceed to install and configure FHIR CE to connect to this self-hosted Couchbase instance.