Bitbucket Data Center on the AWS Cloud

Quick Start Reference Deployment

QS

October 2020
Adam Brokes, Ben Partridge, Carlos Corredor, Chris Szmajda, Don Domingo, Dylan Rathbone, Felix Haehnel, Steve Smith, Varun Arbatti
Tony Vattathil - Principal Solutions Architect, AWS

Visit our GitHub repository for source files and to post feedback, report bugs, or submit feature ideas for this Quick Start.

This Quick Start was created by Atlassian in collaboration with Amazon Web Services (AWS). Quick Starts are automated reference deployments that use AWS CloudFormation templates to deploy key technologies on AWS, following AWS best practices.

Overview

This Quick Start is for users who want to deploy Bitbucket Data Center in a supported configuration in the AWS Cloud, following AWS and Atlassian best practices.

This Quick Start uses the Atlassian Standard Infrastructure (ASI) as a foundation. You can choose to build a new ASI for your deployment or deploy Bitbucket into your existing ASI. You can also deploy Jira, Confluence, and Crowd Data Center within the same ASI.

Amazon may share user-deployment information with the AWS Partner that collaborated with AWS on the Quick Start.

Bitbucket Data Center on AWS

Bitbucket Data Center is a Git repository management solution from Atlassian. It provides source code collaboration for enterprises that require high availability and performance at scale.

Please know that we may share who uses AWS Quick Starts with the AWS partner that collaborated with AWS on the content of the Quick Start.

AWS costs

You are responsible for the cost of the AWS services and any third-party licenses used while running this Quick Start. There is no additional cost for using the Quick Start.

The AWS CloudFormation templates for Quick Starts include configuration parameters that you can customize. Some of the settings, such as the instance type, affect the cost of deployment. For cost estimates, see the pricing pages for each AWS service you use. Prices are subject to change.

After you deploy the Quick Start, create AWS Cost and Usage Reports to deliver billing metrics to an Amazon Simple Storage Service (Amazon S3) bucket in your account. These reports provide cost estimates based on usage throughout each month and aggregate the data at the end of the month. For more information, see What are AWS Cost and Usage Reports?

Software licenses

This Quick Start deploys a cluster-ready infrastructure for Bitbucket. This requires a Bitbucket Data Center license. See the Atlassian pricing page for licensing information.

Architecture

Deploying this Quick Start for a new Atlassian Standard Infrastructure (ASI) with default parameters builds the following Bitbucket environment in the AWS Cloud.

Architecture
Figure 1. Quick Start architecture for Bitbucket on AWS

As shown in Figure 1, the Quick Start sets up the following:

  • A highly available architecture that spans two Availability Zones.

  • In the public subnets:

    • A network address translation (NAT) gateway to allow outbound internet access for resources in the private subnets.

    • A bastion host that enables secure access to Bitbucket without exposing it to the internet. For more information, see Bastion Hosts). You can choose not to provision a bastion host if you prefer to access Bitbucket nodes through the AWS Systems Manager.

  • In the private subnets:

    • A network file system (NFS) server instance. This provides a shared file system with an attached Amazon Elastic Block Store (Amazon EBS) volume for storing repositories.

    • Amazon Relational Database Service (Amazon RDS) for PostgreSQL in a high-availability (Multi-AZ) configuration, which mitigates failover if the master node fails. You can choose Amazon Aurora PostgreSQL instead.

  • Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling groups for scaling the bastion hosts in the public subnets and the Bitbucket nodes in the private subnets. The instances are based on Amazon Linux, a Linux server operating system from AWS, and use an Atlassian-provided Amazon Machine Image (AMI).

  • An Amazon Elastic Load Balancer, which works both as a load balancer and a Secure Sockets Layer (SSL) termination reverse proxy.

  • Amazon Elasticsearch Service (Amazon ES) for Elasticsearch 2.3 indexing and searching functionality.

  • Amazon CloudWatch for basic monitoring of all application and database nodes in your deployment. By default, CloudWatch collects and stores logs from each monitored node. Amazon CloudWatch is an optional component.

Amazon Elasticsearch

Bitbucket Data Center uses Elasticsearch 2.3 for indexing and searching. The Quick Start architecture uses the Amazon Elasticsearch Service (Amazon ES), which is a managed service that makes it easy to deploy, operate, and scale Elasticsearch in the AWS Cloud.

NFS for shared storage

Bitbucket Data Center uses a shared network file system (NFS) to store the repositories in a common location that is accessible to multiple Bitbucket nodes. The Quick Start architecture implements the shared file system in an Amazon Elastic Compute Cloud (Amazon EC2) instance with an attached Amazon Elastic Block Store (Amazon EBS) volume. We recommend that you create regular snapshots of the EBS volume at a frequency that meets the recovery point objective (RPO) of your organization. If using a single EBS volume doesn’t meet your availability and disaster recovery requirements, you should consider a highly available NFS implementation using AWS partner products.

Auto Scaling groups in this Quick Start

This Quick Start uses Auto Scaling groups to statically control the number of its nodes. Don’t use Auto Scaling to dynamically scale the size of your cluster. Adding an application node to the cluster usually takes more than 20 minutes, which isn’t fast enough to address sudden load spikes.

If you can identify periods of high and low loads, you can schedule the application node cluster to scale accordingly. For more information, see Scheduled Scaling for Amazon EC2 Auto Scaling.

To study trends in your organization’s load, be sure to monitor the performance of your deployment.

Amazon Aurora database for high availability

The Quick Start also allows you to deploy Bitbucket Data Center with an Amazon Aurora clustered database (instead of RDS).

You can also use this Quick Start to deploy Bitbucket Data Center with an Aurora clustered database that’s compatible with PostgreSQL. The cluster configuration is illustrated in Figure 2. It features a primary database writer that replicates to two database readers in a different Availability Zone. If the writer fails, Aurora promotes one of the readers to take its place with no downtime. For more information, see Amazon Aurora Features: PostgreSQLCompatible Edition.

The Aurora configuration with a single database writer and two readers is designed to provide high availability without degrading performance.

Amazon Aurora
Figure 2. Amazon Aurora reader/writer configuration

Amazon Aurora is supported on Bitbucket Data Center 6.7 and later.

Planning the deployment

Specialized knowledge

This deployment requires a moderate level of familiarity with AWS services. If you’re new to AWS, see Getting Started Resource Center and AWS Training and Certification. These sites provide materials for learning how to design, deploy, and operate your infrastructure and applications on the AWS Cloud.

This Quick Start assumes familiarity with managing Atlassian Bitbucket. Refer to the latest Atlassian documentation on Bitbucket for more information.

AWS account

If you don’t already have an AWS account, create one at https://aws.amazon.com by following the on-screen instructions. Part of the sign-up process involves receiving a phone call and entering a PIN using the phone keypad.

Your AWS account is automatically signed up for all AWS services. You are charged only for the services you use.

Technical requirements

Before you launch the Quick Start, review the following information and ensure that your account is properly configured. Otherwise, deployment might fail.

Resource quotas

If necessary, request service quota increases for the following resources. You might need to request increases if your existing deployment currently uses these resources and if this Quick Start deployment could result in exceeding the default quotas. The Service Quotas console displays your usage and quotas for some aspects of some services. For more information, see What is Service Quotas? and AWS service quotas.

Resource

This deployment uses

VPC (ASI)

1

Auto Scaling groups

1 (2 if a Bastion Host is provisioned)

Elastic Load Balancers

1

Elastic IP addresses

variable based on user configuration

AWS Identity and Access Management (IAM) security groups

variable based on user configuration

IAM roles

variable based on user configuration

EC2 instances

variable based on user configuration

Supported AWS Regions

For any Quick Start to work in a Region other than its default Region, all the services it deploys must be supported in that Region. You can launch a Quick Start in any Region and see if it works. If you get an error such as “Unrecognized resource type,” the Quick Start is not supported in that Region.

For an up-to-date list of AWS Regions and the AWS services they support, see AWS Regional Services.

Certain Regions are available on an opt-in basis. For more information, see Managing AWS Regions.

IAM permissions

Before launching the Quick Start, you must sign in to the AWS Management Console with IAM permissions for the resources that the templates deploy. The AdministratorAccess managed policy within IAM provides sufficient permissions, although your organization may choose to use a custom policy with more restrictions. For more information, see AWS managed policies for job functions.

Deployment options

This Quick Start includes two AWS CloudFormation templates. The first template builds the Atlassian Standard Infrastructure (ASI), which is a virtual private cloud (VPC) that contains the components required by all Atlassian applications, and then provisions Bitbucket into this ASI. The second template provisions Bitbucket in an existing ASI.

Using these templates, the Quick Start provides two deployment options:

  • Deploy Bitbucket Data Center into a new ASI (end-to-end deployment). Choose this option if you’re a new user. This option builds the Atlassian Standard Infrastructure (ASI), which is a VPC that consists of the subnets, NAT gateways, security groups, and other infrastructure components required by all Atlassian applications. It then deploys Bitbucket into this new VPC.

  • Deploy Bitbucket Data Center into an existing ASI. This option provisions Bitbucket in an existing ASI, and also offers more customizable parameters. Choose this option if you’ve already deployed the ASI separately by using the ASI Quick Start, or by deploying another Atlassian product from a Quick Start (Jira Software/Service Desk Data Center, Confluence Data Center, Bitbucket Data Center, or Crowd Data Center).

The Quick Start provides separate templates for these options. It also lets you configure Classless Inter-Domain Routing (CIDR) blocks, instance types, and Bitbucket settings, as discussed later in this guide.

Deployment steps

The fastest way to deploy Bitbucket with this Quick Start is directly through its AWS Quick Start interface. However, when you deploy Bitbucket this way, any updates that are made to the Quick Start templates propagate directly to your production deployment. These updates sometimes involve adding or removing parameters, which could introduce unexpected changes or break your deployment.

As a best practice, instead of deploying directly through the AWS Quick Start interface, clone the Bitbucket Quick Start templates to a custom Amazon Simple Storage Service (Amazon S3) bucket. Then, launch the templates directly from the S3 bucket. This practice lets you control when to apply the latest changes to your environment.

  1. Clone a local copy of the Quick Start templates (including all of its submodules). From the command line, run:

    git clone --recurse-submodules https://github.com/aws-quickstart/quickstart-atlassian-bitbucket.git
  2. (Optional) The Quick Start templates repository uses the directory structure required by the Quick Start interface. If needed (for example, to minimize storage costs), you can remove all other files except the following:

    quickstart-atlassian-bitbucket
    ├── submodules
    ├── quickstart-atlassian-services
    │   └── templates
    │       └── quickstart-vpc-for-atlassian-services.yaml
    └── templates
        ├── quickstart-bitbucket-dc-with-vpc.template.yaml
        └── quickstart-bitbucket-dc.template.yaml
  3. Install and set up the AWS Command Line Interface (CLI) so that you can create an S3 bucket and upload content to it.

  4. Create an S3 bucket in your Region:

    aws s3 mb s3://<BUCKET_NAME> --region <AWS_REGION>
  5. Choose which Quick Start template to use:

    • quickstart-bitbucket-master-with-vpc.template.yaml: Use this template for deploying Bitbucket into a new ASI (end-to-end deployment).

    • quickstart-bitbucket.template.yaml: Use this template for deploying Bitbucket into an existing ASI.

  6. In both templates, the QSS3BucketName default value is set to aws-quickstart. Replace this value with the name of the bucket you created earlier (<BUCKET_NAME>).

  7. Return to the parent directory of your local clone of the Quick Start templates. From there, upload all the files in your local clone to your S3 bucket:

    aws s3 cp quickstart-atlassian-bitbucket s3://<BUCKET_NAME> --recursive --acl public-read

After everything is uploaded, you can deploy your production stack from your S3 bucket.

  1. Sign in to your AWS account on the AWS Console.

  2. Check the AWS Region displayed in the upper-right corner of the navigation bar, and change it if necessary. This Region is where {product-partner-name-short} is built. The template is launched in the us-east-2 Region by default.

  3. Go to CloudFormation > Create Stack. When specifying a template, paste in the Object URL of the Quick Start template that you are using for the deployment. Choose Next to start configuring your deployment.

  4. On the Specify stack details page, change the stack name, if needed. Review the parameters for the template, and provide values for parameters that require input. For all other parameters, review the default settings and customize them as necessary. For details about each setting, refer to the section matching your deployment type:

    • [launch-into-a-new-vpc] (if you’re deploying an ASI with Bitbucket)

    • [launch-into-an-existing-vpc] (if you’re deploying Bitbucket into a new ASI)

      In the following tables, parameters are listed by category and described separately for the deployment options. When you finish reviewing and customizing the parameters, choose Next.

      Unless you are customizing the Quick Start templates for your own deployment projects, keep the default settings for the parameters Quick Start S3 bucket name, Quick Start S3 bucket Region, and Quick Start S3 key prefix. Changing these settings automatically updates code references to point to a new Quick Start location. For more information, see the AWS Quick Start Contributor’s Guide.

Launch into an existing VPC

Table 1. Bitbucket setup
Parameter label (name) Default value Description

Version * (BitbucketVersion)

7.6.5

Version of Bitbucket to install. Please use version 5.0.0 or higher. Find valid versions at http://go.atlassian.com/bbs-releases

Table 2. Cluster nodes
Parameter label (name) Default value Description

Enable CloudWatch integration (CloudWatchIntegration)

Metrics and Logs

Enables CloudWatch metrics with or without log gathering. If cost is an issue, you can disable this altogether.

Bitbucket cluster node instance type (ClusterNodeInstanceType)

c5.xlarge

Instance type for the cluster application nodes. See https://confluence.atlassian.com/x/GpdKLg for guidance

Maximum number of cluster nodes (ClusterNodeMax)

2

Maximum number of nodes in the cluster.

Minimum number of cluster nodes (ClusterNodeMin)

1

Set to 1 for new deployment. Can be updated post launch.

Cluster node instance volume size (ClusterNodeVolumeSize)

50

Size of Bitbucket web server cluster node volume in Gb

Deployment Automation Git Repository URL (DeploymentAutomationRepository)

https://bitbucket.org/atlassian/dc-deployments-automation.git

The deployment automation repository to use for per-node initialization. Leave this as default unless you have customizations.

Deployment Automation Branch (DeploymentAutomationBranch)

master

The deployment automation repository branch to pull from.

Ansible playbook to invoke during instance initialization (DeploymentAutomationPlaybook)

aws_bitbucket_dc_node.yml

The Ansible playbook to invoke to initialize the application node on first start.

SSH key name to use with the repository (DeploymentAutomationKeyName)

Blank string

Named Key Pair name to use with this repository. The key should be imported into the SSM parameter store. (Optional)

Custom command-line parameters for Ansible (DeploymentAutomationCustomParams)

Blank string

Additional command-line options for the ansible-playbook command. See https://bitbucket.org/atlassian/dc-deployments-automation/src/master/README.md for more information about overriding parameters. (Optional)

Table 3. File server
Parameter label (name) Default value Description

File server instance type (FileServerInstanceType)

m4.xlarge

Instance type for the file server hosting the Bitbucket shared home directory. See https://confluence.atlassian.com/x/GpdKLg for guidance

Home directory size (HomeSize)

100

Home directory storage size, in gigabytes (GB) (100 - 16384)

Home directory volume type (HomeVolumeType)

Provisioned IOPS

Bitbucket home storage type.

Home directory IOPS (HomeIops)

1000

Home directory IOPS (100 - 20000, only used with Provisioned IOPS). Note: The ratio of IOPS provisioned to the volume size requested can be a maximum of 50; for example, a volume with 5000 IOPS must be at least 100 GiB

Table 4. Database
Parameter label (name) Default value Description

The database engine to deploy with (DBEngine)

PostgreSQL

Database Engine to use. PostgreSQL or Amazon Aurora PostgreSQL

The database engine version to use (DBEngineVersion)

12

The database engine version to use; we’ll install a suitable minor version for your chosen engine. Make sure that the Bitbucket version you’re installing supports the database engine selected.

Database instance class (DBInstanceClass)

db.m4.large

RDS instance type (only r4 and r5 families are supported for Aurora).

RDS Provisioned IOPS (DBIops)

1000

Must be in the range of 1000 - 30000 and a multiple of 1000. This value is only used with Provisioned IOPS. Note: The ratio of IOPS per allocated-storage must be between 3.00 and 10.00. Not valid for Aurora

Master password * (DBMasterUserPassword)

Requires input

Password for the master ('postgres') account. Must be at least 8 characters and include 1 uppercase, 1 lowercase, 1 number, and 1 of the following symbols: ! # $ { * : [ = , ] - _ + % &

Enable RDS Multi-AZ deployment (DBMultiAZ)

true

Whether to provision a multi-AZ RDS instance.

Bitbucket database password * (DBPassword)

Requires input

Database password used by BitBucket. Must be at least 8 characters and include 1 uppercase, 1 lowercase, 1 number, and 1 of the following symbols: ! # $ { * : [ = , ] - _ @ + % &

Database storage (DBStorage)

100

Database allocated storage size, in gigabytes (GB). If you choose Provisioned IOPS, storage should be between 100 and 6144. Not used for Aurora.

Database storage type (DBStorageType)

General Purpose (SSD)

Database storage type

Table 5. Bastion host utilization
Parameter label (name) Default value Description

Use Bastion host (BastionHostRequired)

true

Whether to grant access to BitBucket EC2 instances through the ASI’s Bastion host (if it exists). If 'true', remember to provide an EC2 Key Pair. If your ASI does not have a Bastion host, set this to 'false'.

SSH Key Pair Name (KeyPairName)

Blank string

Public/private EC2 Key Pairs to allow you to securely access the Bastion host

Table 6. Elasticsearch
Parameter label (name) Default value Description

Elasticsearch master user password * (ElasticSearchPassword)

Requires input

Password for the elasticsearch master user, the username will be 'bitbucket'. If no password is specified, Bitbucket will authenticate with the elasticsearch cluster using IAM request signing (not recommended).

Elasticsearch instance type (ElasticsearchInstanceType)

m4.xlarge.elasticsearch

EC2 instance type for the Amazon Elasticsearch service to run on.

Elasticsearch disk space per node (GB) (ElasticsearchNodeVolumeSize)

100

The EBS volume size (in GB) of each Elasticsearch node.

Table 7. Networking
Parameter label (name) Default value Description

Permitted IP range * (CidrBlock)

Requires input

CIDR block allowed to access the Atlassian product. This should be set to a trusted IP range; if you want to give public access use '0.0.0.0/0'.

Make instance internet facing (InternetFacingLoadBalancer)

true

Controls whether the load balancer should be visible to the internet (true) or only within the VPC (false).

Existing DNS name (CustomDnsName)

Blank string

Use custom existing DNS name for your Data Center instance. Please note: you must own the domain and configure it to point at the load balancer.

SSL Certificate ARN (SSLCertificateARN)

Blank string

Amazon Resource Name (ARN) of your SSL certificate. If you want to use your own certificate that you generated outside of Amazon, you need to first import it to AWS Certificate Manager. After a successful import, you’ll receive the ARN. If you want to create a certificate with AWS Certificate Manager (ACM certificate), you will receive the ARN after it’s successfully created.

Table 8. Advanced (Optional)
Parameter label (name) Default value Description

Bitbucket properties (BitbucketProperties)

Blank string

A space-separated list of bitbucket properties in the form 'key1=value1 key2=value2 …​' Find documentation at https://confluence.atlassian.com/x/m5ZKLg

JVM Heap Size Override (JvmHeapOverride)

Blank string

Override the default amount of memory to allocate to the JVM for your instance type - set size in meg or gig e.g. 1024m or 1g

Additional JVM options (JvmSupportOpts)

Blank string

Pass in any additional JVM options to tune the Bitbucket instance

Create S3 bucket for Elasticsearch snapshots (CreateBucket)

true

Set to true to create the S3 bucket within this stack, must be used in conjunction with ESBucketName.

Bitbucket primary database (DBMaster)

Blank string

Database ARN of the RDS instance to replicate. Setting this parameter will bring up Bitbucket as a Disaster recovery standby, with an RDS read replica database. Not valid for Aurora.

Database snapshot ID to restore (DBSnapshotId)

Blank string

RDS snapshot ID of an existing backup to restore. Must be used in conjunction with HomeVolumeSnapshotId. Leave blank for a new instance. Not valid for Aurora.

Elasticsearch snapshot S3 bucket name (ESBucketName)

Blank string

Name of a new, or existing, S3 bucket configured for Elasticsearch snapshots.

Home volume snapshot ID to restore (HomeVolumeSnapshotId)

Blank string

EBS snapshot ID of an existing backup to restore as the home directory volume. Must be used in conjunction with DBSnapshotId. Leave blank for a new instance.

Delete Home on termination (HomeDeleteOnTermination)

true

Delete Bitbucket home directory volume when the file server instance is terminated. You must back up your data before terminating your file server instance if this option is set to 'true'

License Key for Bitbucket (if you have one) (BitbucketLicenseKey)

Blank string

(Optional) Provide a license key for Bitbucket Data Center if you have one.

Password for the administrator account (BitbucketAdminPassword)

Requires input

(Optional) Password for the Bitbucket administrator ('admin') account.

HTTP/HTTPS URL to download the Bitbucket Dataset (BitbucketDatasetURL)

Blank string

(Optional) Provide the HTTP/HTTPS URL for the dataset to restore. Refer https://confluence.atlassian.com/bitbucketserver/importing-957497836.html

Table 9. AWS Quick Start Configuration
Parameter label (name) Default value Description

Quick Start S3 Bucket Name (QSS3BucketName)

aws-quickstart

S3 bucket name for the Quick Start assets. Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-).

Quick Start S3 Key Prefix (QSS3KeyPrefix)

quickstart-atlassian-bitbucket/

S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/).

ASI identifier (ExportPrefix)

ATL-

Each Atlassian Standard Infrastructure (ASI) uses a unique identifier. If you have multiple ASIs within the same AWS region, use this field to specify where to deploy Bitbucket.

Launch into a new VPC

Table 10. Bitbucket setup
Parameter label (name) Default value Description

Version * (BitbucketVersion)

7.6.5

Version of Bitbucket to install. Please use version 5.0.0 or higher. Find valid versions at http://go.atlassian.com/bbs-releases

Table 11. Cluster nodes
Parameter label (name) Default value Description

Enable CloudWatch integration (CloudWatchIntegration)

Metrics and Logs

Enables CloudWatch metrics with or without log gathering. If cost is an issue, you can disable this altogether.

Bitbucket cluster node instance type (ClusterNodeInstanceType)

c5.xlarge

Instance type for the cluster application nodes. See https://confluence.atlassian.com/x/GpdKLg for guidance

Maximum number of cluster nodes (ClusterNodeMax)

2

Maximum number of nodes in the cluster.

Minimum number of cluster nodes (ClusterNodeMin)

1

Set to 1 for new deployment. Can be updated post launch.

Cluster node instance volume size (ClusterNodeVolumeSize)

50

Size of cluster node root volume in Gb

Deployment Automation Git Repository URL (DeploymentAutomationRepository)

https://bitbucket.org/atlassian/dc-deployments-automation.git

The deployment automation repository to use for per-node initialization. Leave this as default unless you have customizations.

Deployment Automation Branch (DeploymentAutomationBranch)

master

The deployment automation repository branch to pull from.

Ansible playbook to invoke during instance initialization (DeploymentAutomationPlaybook)

aws_bitbucket_dc_node.yml

The Ansible playbook to invoke to initialize the application node on first start.

Custom command-line parameters for Ansible (DeploymentAutomationCustomParams)

Blank string

Additional command-line options for the ansible-playbook command. See https://bitbucket.org/atlassian/dc-deployments-automation/src/master/README.md for more information about overriding parameters. (Optional)

SSH key name to use with the repository (DeploymentAutomationKeyName)

Blank string

Named Key Pair name to use with this repository. The key should be imported into the SSM parameter store. (Optional)

Table 12. File server
Parameter label (name) Default value Description

File server instance type (FileServerInstanceType)

m4.xlarge

Instance type for the file server hosting the Bitbucket shared home directory. See https://confluence.atlassian.com/x/GpdKLg for guidance

Home directory size (HomeSize)

100

Home directory storage size, in gigabytes (GB) (100 - 16384)

Home directory volume type (HomeVolumeType)

Provisioned IOPS

Bitbucket home storage type.

Home directory IOPS (HomeIops)

1000

Home directory IOPS (100 - 20000, only used with Provisioned IOPS). Note: The ratio of IOPS provisioned to the volume size requested can be a maximum of 50; for example, a volume with 5000 IOPS must be at least 100 GiB

Table 13. Database
Parameter label (name) Default value Description

The database engine to deploy with (DBEngine)

PostgreSQL

Database Engine to use. PostgreSQL or Amazon Aurora PostgreSQL

The database engine version to use (DBEngineVersion)

12

The database engine version to use; we’ll install a suitable minor version for your chosen engine. Make sure that the Bitbucket version you’re installing supports the database engine selected.

Database instance class (DBInstanceClass)

db.m4.large

RDS instance type (only r4 and r5 families are supported for Aurora).

RDS Provisioned IOPS (DBIops)

1000

Must be in the range of 1000 - 30000 and a multiple of 1000. This value is only used with Provisioned IOPS. Note: The ratio of IOPS per allocated-storage must be between 3.00 and 10.00. Not valid for Aurora

Master password * (DBMasterUserPassword)

Requires input

Password for the master ('postgres') account. Must be at least 8 characters and include 1 uppercase, 1 lowercase, 1 number, and 1 of the following symbols: ! # $ { * : [ = , ] - _ + % &

Enable RDS Multi-AZ deployment (DBMultiAZ)

true

Whether to provision a multi-AZ RDS instance.

Bitbucket database password * (DBPassword)

Requires input

Database password used by BitBucket. Must be at least 8 characters and include 1 uppercase, 1 lowercase, 1 number, and 1 of the following symbols: ! # $ { * : [ = , ] - _ @ + % &

Database storage (DBStorage)

100

Database allocated storage size, in gigabytes (GB). If you choose Provisioned IOPS, storage should be between 100 and 6144. Not used for Aurora.

Database storage type (DBStorageType)

General Purpose (SSD)

Database storage type

Table 14. Bastion host provisioning
Parameter label (name) Default value Description

Deploy Bastion host (BastionHostRequired)

true

Whether to provision a Bastion host instance. If 'true', then you need to provide an EC2 Key Pair (otherwise, you won’t be able to use the Bastion host to access BitBucket instances).

SSH Key Pair Name (KeyPairName)

Blank string

Public/private EC2 Key Pairs to allow you to securely access the Bastion host

Table 15. Elasticsearch
Parameter label (name) Default value Description

Elasticsearch master user password * (ElasticSearchPassword)

Requires input

Password for the elasticsearch master user, the username will be 'bitbucket'. If no password is specified, Bitbucket will authenticate with the elasticsearch cluster using IAM request signing (not recommended).

Elasticsearch instance type (ElasticsearchInstanceType)

m4.xlarge.elasticsearch

EC2 instance type for the Amazon Elasticsearch service to run on.

Elasticsearch disk space per node (GB) (ElasticsearchNodeVolumeSize)

100

The EBS volume size (in GB) of each Elasticsearch node.

Table 16. Networking
Parameter label (name) Default value Description

Trusted IP range * (AccessCIDR)

Requires input

CIDR block allowed to access the Atlassian product. This should be set to a trusted IP range; if you want to give public access use '0.0.0.0/0'.

Make instance internet facing (InternetFacingLoadBalancer)

true

Controls whether the load balancer should be visible to the internet (true) or only within the VPC (false).

Existing DNS name (CustomDnsName)

Blank string

Use custom existing DNS name for your Data Center instance. Please note: you must own the domain and configure it to point at the load balancer.

SSL Certificate ARN (SSLCertificateARN)

Blank string

Amazon Resource Name (ARN) of your SSL certificate. If you want to use your own certificate that you generated outside of Amazon, you need to first import it to AWS Certificate Manager. After a successful import, you’ll receive the ARN. If you want to create a certificate with AWS Certificate Manager (ACM certificate), you will receive the ARN after it’s successfully created.

IP address block for the VPC (VPCCIDR)

10.0.0.0/16

CIDR Block for the VPC

Availability Zones (AvailabilityZones)

Requires input

List of Availability Zones to use for the subnets in the VPC. Note: The logical order is preserved and only 2 AZs are used for this deployment.

AZ1 private IP address block (PrivateSubnet1CIDR)

10.0.0.0/19

CIDR block for private subnet 1 located in Availability Zone 1.

AZ2 private IP address block (PrivateSubnet2CIDR)

10.0.32.0/19

CIDR block for private subnet 2 located in Availability Zone 2.

AZ1 public IP address block (PublicSubnet1CIDR)

10.0.128.0/20

CIDR Block for the public DMZ subnet 1 located in Availability Zone 1

AZ2 public IP address block (PublicSubnet2CIDR)

10.0.144.0/20

CIDR Block for the public DMZ subnet 2 located in Availability Zone 2

Table 17. Advanced (Optional)
Parameter label (name) Default value Description

Bitbucket properties (BitbucketProperties)

Blank string

A space-separated list of bitbucket properties in the form 'key1=value1 key2=value2 …​' Find documentation at https://confluence.atlassian.com/x/m5ZKLg

JVM Heap Size Override (JvmHeapOverride)

Blank string

Override the default amount of memory to allocate to the JVM for your instance type - set size in meg or gig e.g. 1024m or 1g

Additional JVM options (JvmSupportOpts)

Blank string

Pass in any additional JVM options to tune the Bitbucket instance

Create S3 bucket for Elasticsearch snapshots (CreateBucket)

true

Set to true to create the S3 bucket within this stack, must be used in conjunction with ESBucketName.

Bitbucket primary database (DBMaster)

Blank string

Database ARN of the RDS instance to replicate. Setting this parameter will bring up Bitbucket as a Disaster recovery standby, with an RDS read replica database. Not valid for Aurora.

Database snapshot ID to restore (DBSnapshotId)

Blank string

RDS snapshot ID of an existing backup to restore. Must be used in conjunction with HomeVolumeSnapshotId. Leave blank for a new instance. Not valid for Aurora.

Elasticsearch snapshot S3 bucket name (ESBucketName)

Blank string

Name of a new, or existing, S3 bucket configured for Elasticsearch snapshots.

Home volume snapshot ID to restore (HomeVolumeSnapshotId)

Blank string

EBS snapshot ID of an existing backup to restore as the home directory volume. Must be used in conjunction with DBSnapshotId. Leave blank for a new instance.

Delete Home on termination (HomeDeleteOnTermination)

true

Delete Bitbucket home directory volume when the file server instance is terminated. You must back up your data before terminating your file server instance if this option is set to 'true'

License Key for Bitbucket (if you have one) (BitbucketLicenseKey)

Blank string

Provide a license key for Bitbucket Data Center if you have one.

Password for the administrator account (BitbucketAdminPassword)

Requires input

(Optional) Password for the Bitbucket administrator ('admin') account.

HTTP/HTTPS URL to download the Bitbucket Dataset (BitbucketDatasetURL)

Blank string

Provide the HTTP/HTTPS URL for the dataset to restore.

Table 18. AWS Quick Start Configuration
Parameter label (name) Default value Description

Quick Start S3 Bucket Name (QSS3BucketName)

aws-quickstart

S3 bucket name for the Quick Start assets. Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-).

Quick Start S3 Key Prefix (QSS3KeyPrefix)

quickstart-atlassian-bitbucket/

S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/).

ASI Exported Prefix (ExportPrefix)

ATL-

Each Atlassian Standard Infrastructure (ASI) uses a unique identifier. If you have multiple ASIs within the same AWS region, use this field to specify where to deploy Bitbucket.

+ . On the Configure stack options page, you can specify tags (key-value pairs) for resources in your stack and set advanced options. When you finish, choose Next. . On the Review page, review and confirm the template settings. Under Capabilities, select the two check boxes to acknowledge that the template creates IAM resources and might require the ability to automatically expand macros. . Choose Create stack to deploy the stack. . Monitor the status of the stack. When the status is CREATE_COMPLETE, the Bitbucket deployment is ready. . To view the created resources, see the values displayed in the Outputs tab for the stack.

Deploy with Control Tower

You can deploy Bitbucket in a customized AWS Control Tower environment to help you set up a secure, multi-account AWS environment using AWS best practices. For details, see Customizations for AWS Control Tower.

The root directory of the Bitbucket Quick Start repo includes a ct folder with a manifest.yaml file to assist you with the AWS Control Tower deployment. This file has been customized for the Bitbucket Data Center Quick Start.

In the following sections, you will review and update the settings in this file and then upload it to the S3 bucket that is used for the deployment.

Review the manifest.yaml file

  1. Navigate to the root directory of the Bitbucket Quick Start, and open the manifest.yaml file, located in the ct folder.

  2. Confirm that the region attribute references the Region where AWS Control Tower is deployed. The default Region is us-east-1. You will update the regions attribute (located in the resources section) in a later step.

  3. Confirm that the resource_file attribute points to the public S3 bucket for the Bitbucket Data Center Quick Start. Using a public S3 bucket ensures a consistent code base across the different deployment options.

    If you prefer to deploy from your own S3 bucket, update the path as needed.

  4. Review each of the parameters attributes and update them as needed to match the requirements of your deployment.

  5. Confirm that the deployment_targets attribute is configured for either your target accounts or organizational units (OUs).

  6. For the regions attribute, add the Region where you plan to deploy the Bitbucket Quick Start. The default Region is us-east-1.

Upload the manifest.yaml file

  1. Compress the manifest.yaml file and name it custom-control-tower-configuration.zip.

  2. Upload the custom-control-tower-configuration.zip file to the S3 bucket that was created for the AWS Control Tower deployment (custom-control-tower-configuration-<accountnumber>-<region>).

The file upload initiates the customized pipeline that deploys the Quick Start to your target accounts.

Configuring Bitbucket

The following procedure helps you set up your new Bitbucket deployment.

  1. Choose the URL that is displayed in the Outputs tab of the AWS CloudFormation stack to go to the Bitbucket configuration page.

    If you get an HTTP Error 503 response when you access the URL, it means that Bitbucket is still loading. This is expected, and you should wait a couple of minutes before trying again.
  2. On the Licensing and Settings page, enter a title for your Bitbucket deployment. Leave the base URL unchanged, and choose the appropriate licensing option. If you don’t have a valid license for Bitbucket Data Center, sign up for an evaluation license.

    qs bb config step2 licensing
    Figure 3. Licensing and settings
  3. To set up Bitbucket Data Center, you need to create an Administrator account and password. The Administrator account has full access to all data in Bitbucket, so we highly recommend that you choose a strong password for this account. Enter your Administrator’s user details in the Administrator account setup screen, and choose Go to Bitbucket.

    qs bb config step3 adminsetup
    Figure 4. Administrator account setup
  4. Log in with the user name and credentials you created in the previous step.

    qs bb config step4 login
    Figure 5. Log in
  5. Choose icon gear > Clustering. You should see the Figure 6 page, which shows that your cluster has one node.

    qs bb config step5 sndc
    Figure 6. Clustering (one node)

Your Bitbucket Data Center deployment is now in a state where you can add nodes that will automatically cluster with your existing node.

Adding nodes to the Bitbucket cluster

By default, your Quick Start deployment starts with a single Bitbucket node (Auto Scaling group of min=1 and max=1). When you’re ready to add nodes to your cluster, perform the following steps:

  1. Sign in to the AWS Management Console, use the Region selector in the navigation bar to choose the AWS Region for your deployment, and open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation/.

  2. Choose the Bitbucket stack. From the Actions list, choose Update Stack.

  3. On the Select Template page, leave Use current template selected, and then choose Next.

  4. On the Specify Details page, in the Bitbucket Setup section of Parameters, enter the number of cluster nodes in Minimum number of cluster nodes and Maximum number of cluster nodes, and then click through to update the stack. This step sets a static number of nodes in your cluster.

  5. After the stack finishes updating, verify the number of nodes in your Bitbucket cluster. Choose Clustering again from the administration console sidebar. The following example shows a cluster that is scaled up to three instances.

    qs bb config step6 clustered
    Figure 7. Clustering (multiple nodes)
You can also migrate Bitbucket data from an existing deployment to this one. For more information, see the migration guides on the Atlassian website.

Troubleshooting

Q. I encountered a CREATE_FAILED error when I launched the Quick Start.

A. If AWS CloudFormation fails to create the stack, relaunch the template with Rollback on failure set to Disabled. (This setting is under Advanced in the AWS CloudFormation console on the Options page.) With this setting, the stack’s state is retained and the instance is left running, so you can troubleshoot the issue. (Review the log files in /var/log/atl.log and /var/log/cfn-init.log.)

When you set Rollback on failure to Disabled, you continue to incur AWS charges for this stack. Ensure that you delete the stack when you finish troubleshooting.

For additional information, see Troubleshooting AWS CloudFormation on the AWS website.

Q. I encountered a size limitation error when I deployed the AWS CloudFormation templates.

A. Launch the Quick Start templates from the links in this guide or from another S3 bucket. If you deploy the templates from a local copy on your computer or from a location other than an S3 bucket, you might encounter template size limitations. For more information about AWS CloudFormation quotas, see the AWS documentation.

Customer responsibility

After you successfully deploy this Quick Start, confirm that your resources and services are updated and configured — including any required patches — to meet your security and other needs. For more information, see the AWS Shared Responsibility Model.

Send us feedback

To post feedback, submit feature ideas, or report bugs, use the Issues section of the GitHub repository for this Quick Start. To submit code, see the Quick Start Contributor’s Guide.

Quick Start reference deployments

GitHub repository

Visit our GitHub repository to download the templates and scripts for this Quick Start, to post your comments, and to share your customizations with others.


Notices

This document is provided for informational purposes only. It represents AWS’s current product offerings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS’s products or services, each of which is provided “as is” without warranty of any kind, whether expressed or implied. This document does not create any warranties, representations, contractual commitments, conditions, or assurances from AWS, its affiliates, suppliers, or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers.

The software included with this paper is licensed under the Apache License, version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the accompanying "license" file. This code is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for specific language governing permissions and limitations.