AWS Multi-AZ and Self-Healing Atlassian Jira with Docker

Deploying Multi-AZ and Self-Healing Atlassian Jira with Docker

This reference architecture provides a set of YAML templates for deploying the following AWS services :

  • Amazon IAM
  • Amazon S3
  • Amazon VPC
  • Amazon Security Group & NACL
  • Amazon RDS
  • Amazon ELB
  • Amazon AutoScaling
  • Amazon Route53

Prerequisites Notes

The Cloudformation Security Group IP address is open by default (testing purpose). You should update the Security Group Access with your own IP Address to ensure your instances security.

Before you can deploy this process, you need the following:

  • Your AWS account must have one VPC available to be created in the selected region
  • Amazon EC2 key pair
  • Installed Domain in Route 53.
  • Installed Certificate (in your selected region & also one in us-east-1)

Tested on the following Region:

  • US East (N. Virginia)


The repository consists of a set of nested templates that deploy the following:

Why use AWS CloudFormation with Amazon ECS?

Using CloudFormation to deploy and manage services with ECS has a number of nice benefits over more traditional methods (AWS CLI, scripting, etc.).


A template can be used repeatedly to create identical copies of the same stack (or to use as a foundation to start a new stack). Templates are simple YAML- or JSON-formatted text files that can be placed under your normal source control mechanisms, stored in private or public locations such as Amazon S3, and exchanged via email. With CloudFormation, you can see exactly which AWS resources make up a stack. You retain full control and have the ability to modify any of the AWS resources created as part of a stack.


Fed up with outdated documentation on your infrastructure or environments? Still keep manual documentation of IP ranges, security group rules, etc.?

With CloudFormation, your template becomes your documentation. Want to see exactly what you have deployed? Just look at your template. If you keep it in source control, then you can also look back at exactly which changes were made and by whom.

Intelligent updating & rollback

CloudFormation not only handles the initial deployment of your infrastructure and environments, but it can also manage the whole lifecycle, including future updates. During updates, you have fine-grained control and visibility over how changes are applied, using functionality such as change sets, rolling update policies and stack policies.

Template details

The templates below are included in this repository and reference architecture:

Template Description
master.yaml   This is the master template - deploy it to CloudFormation and it includes all of the nested templates automatically.
infrastructure/atlassian-iam.yaml   This template deploys will create policy to allow EC2 instance full access to S3 & CloudWatch, and VPC Logs to CloudWatch.
infrastructure/atlassian-s3bucket.yaml   This template deploys Backup Data Bucket with security data at rest and archive objects greater than 60 days, and ELB logging.
infrastructure/atlassian-vpc.yaml   This template deploys a VPC with a pair of public and private subnets spread across two Availability Zones. It deploys an Internet gateway, with a default route on the public subnets. It deploys 2 NAT gateways, and default routes for them in the private subnets.
infrastructure/atlassian-securitygroup.yaml   This template contains the security groups and Network ACLs required by the entire stack.
infrastructure/atlassian-rds.yaml   This template deploys a (Mysql) Relational Database Service.
infrastructure/atlassian-elb.yaml   This template deploys a Elastic Load Balancer that exposes http and https.
infrastructure/atlassian-autoscaling-jira.yaml   This template deploys an Jira Docker to the private subnets using an Auto Scaling group.
infrastructure/atlassian-route53.yaml   This template deploys Route 53 recordset to update ELB Alias.

After the CloudFormation templates have been deployed, the stack outputs contain a link to the site URLs.


How do I…?

Get started and deploy this into my AWS account

You can launch this CloudFormation stack in your account:

Example using AWS CLI Command :

  1. First Download this code into your workstation, make your own changes and make the prerequisites updates.
    • Your AWS account must have one VPC available to be created in the selected region.
    • Create Amazon EC2 key pair
    • Install a domain in Route 53.
    • Install a certificate (in your selected region & also one in us-east-1)
  2. Next install AWS CLI in your workstation.

  3. Upload the files in the “infrastructure” directory into to your own S3 bucket.
    • Eg. aws s3 cp –recursive infrastructure/ s3://cf-templates-19sg5y0d6d084-ap-southeast-1/
  4. You can run the master.yaml file from your workstation.
Example Setup:

Stage1 (~ 25 - 35 minutes)
To create a environment :
aws cloudformation create-stack \
--stack-name <env> \
--capabilities=CAPABILITY_IAM \
--template-body file:////path_to_template//cloudformation-jira//master.yaml

To update a environment :
aws cloudformation update-stack \
--stack-name <env> \
--capabilities=CAPABILITY_IAM \
--template-body file:////path_to_template//cloudformation-jira//master.yaml

To delete a environment :
aws cloudformation delete-stack --stack-name <env>

<env> - Note :stack-name that can be used are (dev, staging, prod)

Example :
aws cloudformation create-stack \
--stack-name dev \
--capabilities=CAPABILITY_IAM \
--parameters ParameterKey=DomainJiraPrefix, \
--parameters ParameterKey=DomainRdsPrefix, \
--parameters ParameterKey=InstanceType,ParameterValue=t2.medium \
--parameters ParameterKey=PMDatabasePassword,ParameterValue=xxxxxxx \
--parameters ParameterKey=PMDatabaseUsername,ParameterValue=jirastartadmin \
--parameters ParameterKey=PMHostedZone, \
--parameters ParameterKey=PMKeyName_NV,ParameterValue=mykey_nv \
--parameters ParameterKey=PMOWNIP,ParameterValue=192.xx.xx.xx/32 \
--parameters ParameterKey=PMPrivateSubnet1CIDR,ParameterValue= \
--parameters ParameterKey=PMPrivateSubnet2CIDR,ParameterValue= \
--parameters ParameterKey=PMPublicSubnet1CIDR,ParameterValue= \
--parameters ParameterKey=PMPublicSubnet2CIDR,ParameterValue= \
--parameters ParameterKey=PMVpcCIDR,ParameterValue= \
--template-body file:////path_to_template//cloudformation-jira//master.yaml

Deploy multiple environments (e.g., dev, staging, production)

Deploy another CloudFormation stack from the same set of templates to create a new environment. The stack name provided when deploying the stack is prefixed to all taggable resources (e.g., EC2 instances, VPCs, etc.) so you can distinguish the different environment resources in the AWS Management Console.

Change the VPC or subnet IP ranges

This set of templates deploys the following network design:

Item CIDR Range Usable IPs Description
VPC 65,536 The whole range used for the VPC and all subnets
Public Subnet 1 251 The public subnet in the first Availability Zone
Public Subnet 2 251 The public subnet in the second Availability Zone
Private Subnet 1 251 The private subnet in the first Availability Zone
Private Subnet 2 251 The private subnet in the second Availability Zone

You can adjust the following section of the master.yaml template:

comments powered by Disqus