How to setup AWS ELB to proxy requests for Bitbucket Server
Purpose
This guide will help to setup and configure an Elastic Load Balancer in AWS to proxy requests to Bitbucket Server.
Solution
AWS Configuration
- Create an EC2 instance and install Bitbucket Server as directed in our Getting started guide
Under the EC2 page in AWS, navigate to
Load Balancing >> Load Balancers
and create a new load balancer with the following basic configurationLoad Balancer name Unique name for the load balancer Create LB Inside Note the VPC used here as we'll use it later Listener Configuration
Load Balancer Protocol Load Balancer Port Instance Protocol Instance Port HTTP 80 HTTP 7990 TCP 22 TCP 7999 - Create a new Security Group that allows inbound traffic on ports 22 and 80 from the appropriate sources
Use the following configuration for the Health Check
Ping Protocol HTTP Ping Port 7990 Ping Path /status - Select the appropriate EC2 instances to associate with this ELB instance
- Save the ELB
- Navigate to your EC2 instances and modify the Security Group to allow inbound connections on port 7990 and 7999 with the ELB VPC as the source (configured in the initial setup of the ELB)
Bitbucket Server Configuration
Set the Base URL
Under Administration >> Server Settings
set the Base URL to the ELB address, i.e. http://bitbucket-elb.us-west-2.elb.amazonaws.com
Also, set the SSH base URL, i.e. ssh://bitbucket-elb.us-west-2.elb.amazonaws.com
Configure the Tomcat Connector
For more details on configuring the proxy see Proxy and secure Bitbucket.
Troubleshooting
Windows
Verify that ports 7990 and 7999 are open in the Windows Firewall.