☁️

DigitalOcean

2 notes  •  Cloud Computing

DigitalOcean Load Balancer Health Check Configuration

When you change the port that backend Droplets (instances) listen on, you must also update the Load Balancer's health check port to match — otherwise the load balancer marks all backends as unhealthy and stops forwarding traffic.

When this occurs

If you move Apache or Nginx from port 80 to a custom port (e.g., 8080) behind the load balancer, and forget to update the health check, traffic stops flowing even though the application is running fine.

How to fix

  1. In the DigitalOcean Control Panel, go to Networking → Load Balancers.
  2. Select the load balancer.
  3. Click Settings → scroll to Health Checks.
  4. Update the Port to match the new backend port (e.g., 8080).
  5. Save. The load balancer will re-check backends within a few seconds.

Recommended health check settings

  • Protocol: HTTP
  • Port: same as your backend application port
  • Path: / or a dedicated health endpoint (e.g., /health)
  • Check interval: 10s, Unhealthy threshold: 3

Upload Files to DigitalOcean Spaces with s3cmd

DigitalOcean Spaces is S3-compatible object storage. You can use s3cmd — a command-line tool for Amazon S3 — to upload, download, and manage files in Spaces.

Step 1 – Install s3cmd

sudo apt-get install -y s3cmd

Step 2 – Configure s3cmd for DigitalOcean Spaces

s3cmd --configure

Enter the following when prompted:

  • Access Key: your Spaces access key (from DO Control Panel → API → Spaces Keys)
  • Secret Key: your Spaces secret key
  • Default Region: leave blank or enter your region (e.g., nyc3)
  • S3 Endpoint: nyc3.digitaloceanspaces.com (replace nyc3 with your region)
  • DNS-style bucket+hostname: %(bucket)s.nyc3.digitaloceanspaces.com
  • Use HTTPS: Yes

Step 3 – Common s3cmd operations

# List your Spaces (buckets)
s3cmd ls

# Upload a single file
s3cmd put local-file.jpg s3://my-space/

# Upload a directory recursively
s3cmd put --recursive ./images/ s3://my-space/images/

# Sync a directory (upload only changed files)
s3cmd sync ./local-dir/ s3://my-space/dir/

# Make an uploaded file publicly accessible
s3cmd put --acl-public image.jpg s3://my-space/

# Download a file
s3cmd get s3://my-space/file.txt ./

Note

The Spaces API is interoperable with the AWS S3 API, so most S3-compatible tools (AWS CLI, boto3, s3cmd) work with DigitalOcean Spaces by changing the endpoint URL.