Use terms primary/replica instead of master/slave

Bug: Issue 13651
Change-Id: I51a6ad170ae42c56c8281bad6c6448a64927d168
diff --git a/Configuration.md b/Configuration.md
index b7c7cf5..a32ec80 100644
--- a/Configuration.md
+++ b/Configuration.md
@@ -19,7 +19,7 @@
 * `AWS_PREFIX`: Optional. A string to prefix stacks and resources with. `gerrit` by default.
 * `DOCKER_REGISTRY_URI`: Mandatory. URI of the Docker registry. See the
   [prerequisites](Prerequisites.md) section for more details.
-* `SSL_CERTIFICATE_ARN`: Mandatory. ARN of the wildcard SSL Certificate, covering both master nodes.
+* `SSL_CERTIFICATE_ARN`: Mandatory. ARN of the wildcard SSL Certificate, covering both primary nodes.
 * `CLUSTER_STACK_NAME`: Optional. Name of the cluster stack. `gerrit-cluster` by default.
 * `DNS_ROUTING_STACK_NAME`: Optional. Name of the DNS routing stack. `gerrit-dns-routing` by default.
 * `HOSTED_ZONE_NAME`: Optional. Name of the hosted zone. `mycompany.com` by default.
@@ -43,9 +43,9 @@
 
 * `CLUSTER_INSTANCE_TYPE`: Optional. The EC2 instance Type used to run the cluster. The default value
 is recipe-specific:
-  * single-master: `m4.large`
-  * master-slave: `m4.xlarge`
-  * dual-master: `m4.2xlarge`
+  * single-primary: `m4.large`
+  * primary-replica: `m4.xlarge`
+  * dual-primary: `m4.2xlarge`
 * `GERRIT_RAM`: RAM allocated (MiB) to the Gerrit container. `6000` by default.
 * `GERRIT_CPU`: vCPU units allocated to the Gerrit container. `1024` by default.
 * `GERRIT_HEAP_LIMIT`: Maximum heap size of the Java process running Gerrit, in bytes.
diff --git a/Docker.md b/Docker.md
index 7214357..98d81dc 100644
--- a/Docker.md
+++ b/Docker.md
@@ -22,7 +22,7 @@
 publishing a new docker image will _not_ make it available to ECS, so it cannot be used for upgrading running instances.
 
 Note that you will need to _cd_ to the recipe directory before running any of the following and that the relevant image
-needs to exist for that specific recipe (for example you can't publish HAProxy from the single-master recipe).
+needs to exist for that specific recipe (for example you can't publish HAProxy from the single-primary recipe).
 
 * Gerrit: `make gerrit-publish`
 * SSH Agent: `make git-ssh-publish`
diff --git a/Makefile.common b/Makefile.common
index daa02e3..e5d0d8f 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -18,7 +18,7 @@
 	aws s3 cp ../common-templates/cf-gerrit-task-execution-role.yml s3://$(TEMPLATE_BUCKET_NAME)/
 	aws s3 cp ../common-templates/cf-gerrit-network-stack.yml s3://$(TEMPLATE_BUCKET_NAME)/
 	aws s3 cp ../common-templates/cf-gerrit-volume.yml s3://$(TEMPLATE_BUCKET_NAME)/
-	aws s3 cp ../common-templates/cf-master-asg.yml s3://$(TEMPLATE_BUCKET_NAME)/
+	aws s3 cp ../common-templates/cf-primary-asg.yml s3://$(TEMPLATE_BUCKET_NAME)/
 	aws s3 cp ../common-templates/cf-efs-stack.yml s3://$(TEMPLATE_BUCKET_NAME)/
 
 set-optional-params-metrics-cloudwatch:
@@ -83,14 +83,14 @@
 		$(eval JGIT_OPTIONAL_PARAMS := ParameterKey=JgitOpenFiles,ParameterValue=$(JGIT_OPEN_FILES))
 endif
 
-set-optional-gerrit-master-volume:
-	$(eval GERRIT_OPTIONAL_MASTER_VOLUME=)
+set-optional-gerrit-primary-volume:
+	$(eval GERRIT_OPTIONAL_PRIMARY_VOLUME=)
 ifdef GERRIT_VOLUME_ID
-		$(eval GERRIT_OPTIONAL_MASTER_VOLUME := $(GERRIT_OPTIONAL_MASTER_VOLUME) ParameterKey=GerritVolumeId,ParameterValue=$(GERRIT_VOLUME_ID))
+		$(eval GERRIT_OPTIONAL_PRIMARY_VOLUME := $(GERRIT_OPTIONAL_PRIMARY_VOLUME) ParameterKey=GerritVolumeId,ParameterValue=$(GERRIT_VOLUME_ID))
 endif
 ifdef GERRIT_VOLUME_SNAPSHOT_ID
-		$(eval GERRIT_OPTIONAL_MASTER_VOLUME := $(GERRIT_OPTIONAL_MASTER_VOLUME) ParameterKey=GerritVolumeSnapshotId,ParameterValue=$(GERRIT_VOLUME_SNAPSHOT_ID))
+		$(eval GERRIT_OPTIONAL_PRIMARY_VOLUME := $(GERRIT_OPTIONAL_PRIMARY_VOLUME) ParameterKey=GerritVolumeSnapshotId,ParameterValue=$(GERRIT_VOLUME_SNAPSHOT_ID))
 endif
 ifdef GERRIT_VOLUME_SIZE_IN_GIB
-		$(eval GERRIT_OPTIONAL_MASTER_VOLUME := $(GERRIT_OPTIONAL_MASTER_VOLUME) ParameterKey=GerritVolumeSizeInGiB,ParameterValue=$(GERRIT_VOLUME_SIZE_IN_GIB))
+		$(eval GERRIT_OPTIONAL_PRIMARY_VOLUME := $(GERRIT_OPTIONAL_PRIMARY_VOLUME) ParameterKey=GerritVolumeSizeInGiB,ParameterValue=$(GERRIT_VOLUME_SIZE_IN_GIB))
 endif
\ No newline at end of file
diff --git a/README.md b/README.md
index 4c91754..cd8fce3 100644
--- a/README.md
+++ b/README.md
@@ -37,9 +37,9 @@
 
 ## Templates
 
-* [Standalone Gerrit master sandbox with LDAP authentication](/single-master/README.md)
-* [Gerrit master and slave sandbox with LDAP authentication](/master-slave/README.md)
-* [Gerrit dual-master in HA sandbox with LDAP authentication](/dual-master/README.md)
+* [Standalone Gerrit primary sandbox with LDAP authentication](/single-primary/README.md)
+* [Gerrit primary and replica sandbox with LDAP authentication](/primary-replica/README.md)
+* [Gerrit dual-primary in HA sandbox with LDAP authentication](/dual-primary/README.md)
 
 ## External services
 
diff --git a/Secrets.md b/Secrets.md
index cb2fe9b..6489fc3 100644
--- a/Secrets.md
+++ b/Secrets.md
@@ -83,7 +83,7 @@
 ### Private/public SSH key for replication (required only for recipes involving replicas)
 
 You will also need to create private and public SSH keys used by the replication plugin to replicate
-from masters to replicas, for example:
+from primaries to replicas, for example:
 
 ```bash
 ssh-keygen -b 2048 -m PEM -t rsa -f /tmp/secrets/replication_user_id_rsa -q -N ""
diff --git a/common-templates/cf-efs-stack.yml b/common-templates/cf-efs-stack.yml
index 0635f39..3c465cc 100644
--- a/common-templates/cf-efs-stack.yml
+++ b/common-templates/cf-efs-stack.yml
@@ -28,7 +28,7 @@
       ProvisionedThroughputInMibps: !If [isProvisionedThroughput, !Ref ProvisionedThroughputInMibps, !Ref "AWS::NoValue"]
       FileSystemTags:
         - Key: Name
-          Value: "multi-master-git-repo"
+          Value: "multi-primary-git-repo"
 
   GitMountTarget:
     Type: AWS::EFS::MountTarget
diff --git a/common-templates/cf-master-asg.yml b/common-templates/cf-primary-asg.yml
similarity index 85%
rename from common-templates/cf-master-asg.yml
rename to common-templates/cf-primary-asg.yml
index 8224823..6d1b2b9 100644
--- a/common-templates/cf-master-asg.yml
+++ b/common-templates/cf-primary-asg.yml
@@ -1,11 +1,11 @@
 AWSTemplateFormatVersion: '2010-09-09'
-Description: Gerrit master launch configuration and autoscaling group
+Description: Gerrit primary launch configuration and autoscaling group
 Parameters:
   TemplateBucketName:
     Description: S3 bucket containing cloudformation templates
     Type: String
   EC2AMI:
-    Description: AMI ID for the EC2 instance hosting gerrit masters
+    Description: AMI ID for the EC2 instance hosting gerrit primaries
     Type: String
   InstanceType:
     Description: EC2 instance type
@@ -23,29 +23,29 @@
     Description: An environment name used to build the log stream names
     Type: String
   ECSCluster:
-    Description: The ECSCluster reference name to register gerrit masters to
+    Description: The ECSCluster reference name to register gerrit primaries to
     Type: String
   EC2SecurityGroup:
-    Description: security groups to assign to the instances in the Auto Scaling group hosting gerrit masters
+    Description: security groups to assign to the instances in the Auto Scaling group hosting gerrit primaries
     Type: String
   EC2InstanceProfile:
-    Description: The Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the EC2 instances running gerrit masters
+    Description: The Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the EC2 instances running gerrit primaries
     Type: String
   GerritInstanceNumber:
-    Description: Whether this is master1 or master2
+    Description: Whether this is primary1 or primary2
     Type: Number
     AllowedValues: [1,2]
   FileSystem:
-    Description: The ID of the filesystem to share git data between gerrit master instances
+    Description: The ID of the filesystem to share git data between gerrit primary instances
     Type: String
   SubnetId:
-    Description: The subnet ID where gerrit master in the Auto Scaling group can be created
+    Description: The subnet ID where gerrit primary in the Auto Scaling group can be created
     Type: String
   LogGroupName:
     Description: The log group name
     Type: String
-  MasterMaxCount:
-    Description: The maximum number of EC2 instances in the master autoscaling group
+  PrimaryMaxCount:
+    Description: The maximum number of EC2 instances in the primary autoscaling group
     Type: Number
   GerritVolumeSnapshotId:
     Description: Id of the EBS snapshot for Gerrit volume
@@ -61,14 +61,14 @@
     Type: Number
 
 Resources:
-  MasterECSAutoScalingGroup:
+  PrimaryECSAutoScalingGroup:
     Type: AWS::AutoScaling::AutoScalingGroup
     Properties:
       VPCZoneIdentifier:
         - !Ref SubnetId
-      LaunchConfigurationName: !Ref 'MasterLaunchConfiguration'
+      LaunchConfigurationName: !Ref 'PrimaryLaunchConfiguration'
       MinSize: '1'
-      MaxSize: !Ref MasterMaxCount
+      MaxSize: !Ref PrimaryMaxCount
       DesiredCapacity: '1'
     CreationPolicy:
       ResourceSignal:
@@ -77,7 +77,7 @@
       AutoScalingReplacingUpdate:
         WillReplace: 'true'
 
-  MasterLaunchConfiguration:
+  PrimaryLaunchConfiguration:
     Type: AWS::AutoScaling::LaunchConfiguration
     Properties:
       ImageId: !Ref 'EC2AMI'
@@ -88,9 +88,9 @@
       UserData:
         Fn::Base64: !Sub |
           #!/bin/bash -xe
-          export MASTER_ID=master-${GerritInstanceNumber}
+          export PRIMARY_ID=primary-${GerritInstanceNumber}
           echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
-          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"$MASTER_ID\"} >> /etc/ecs/ecs.config
+          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"$PRIMARY_ID\"} >> /etc/ecs/ecs.config
 
           yum install -y aws-cfn-bootstrap nfs-utils wget aws-cli xfsprogs
 
@@ -143,7 +143,7 @@
           DIR_SRC=$EC2_AVAIL_ZONE.$EFS_FILE_SYSTEM_ID.efs.$EC2_REGION.amazonaws.com
 
           touch /home/ec2-user/echo.res
-          echo $MASTER_ID >> /home/ec2-user/echo.res
+          echo $PRIMARY_ID >> /home/ec2-user/echo.res
           echo $EFS_FILE_SYSTEM_ID >> /home/ec2-user/echo.res
           echo $EC2_AVAIL_ZONE >> /home/ec2-user/echo.res
           echo $EC2_REGION >> /home/ec2-user/echo.res
@@ -169,42 +169,42 @@
                     [
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/replication_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/replication_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/replication_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/httpd_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/httpd_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/httpd_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/sshd_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/sshd_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/sshd_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/gc_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/gc_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/gc_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/sharedref_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/sharedref_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/sharedref_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/message_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/message_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/message_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/websession_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/websession_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/websession_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/audit_log\",
                       \"log_group_name\": \"${LogGroupName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$MASTER_ID/audit_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/$PRIMARY_ID/audit_log\",
                       \"timezone\": \"UTC\"
                       }
                     ]
@@ -219,7 +219,7 @@
           /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/home/ec2-user/gerritlogsaccess.json -s
 
           # Signal to CloudFormation aws-cfn-bootstrap has been correctly updated
-          /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource MasterECSAutoScalingGroup --region ${AWS::Region}
+          /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource PrimaryECSAutoScalingGroup --region ${AWS::Region}
 
   GerritVolumeStack:
     Type: AWS::CloudFormation::Stack
@@ -232,13 +232,13 @@
         GerritVolumeSizeInGiB: !Ref GerritVolumeSizeInGiB
 
 Outputs:
-  MasterLaunchConfiguration:
-    Value: !Ref MasterLaunchConfiguration
+  PrimaryLaunchConfiguration:
+    Value: !Ref PrimaryLaunchConfiguration
     Export:
-      Name: !Join [ '-', [ !Ref 'AWS::StackName', 'MasterLaunchConfiguration', !Ref GerritInstanceNumber ] ]
+      Name: !Join [ '-', [ !Ref 'AWS::StackName', 'PrimaryLaunchConfiguration', !Ref GerritInstanceNumber ] ]
 
-  MasterECSAutoScalingGroup:
-    Value: !Ref MasterECSAutoScalingGroup
+  PrimaryECSAutoScalingGroup:
+    Value: !Ref PrimaryECSAutoScalingGroup
     Export:
-      Name: !Join [ '-', [ !Ref 'AWS::StackName', 'MasterECSAutoScalingGroup', !Ref GerritInstanceNumber ] ]
+      Name: !Join [ '-', [ !Ref 'AWS::StackName', 'PrimaryECSAutoScalingGroup', !Ref GerritInstanceNumber ] ]
 
diff --git a/common.env b/common.env
index 0860ce3..dc77a70 100644
--- a/common.env
+++ b/common.env
@@ -18,8 +18,8 @@
 
 # Image directories
 IMAGE_DIR:=$(ROOT_DIR)/gerrit
-HAPROXY_IMAGE_DIR=$(ROOT_DIR)/dual-master/haproxy
-SYSLOG_IMAGE_DIR=$(ROOT_DIR)/dual-master/syslog-sidecar
+HAPROXY_IMAGE_DIR=$(ROOT_DIR)/dual-primary/haproxy
+SYSLOG_IMAGE_DIR=$(ROOT_DIR)/dual-primary/syslog-sidecar
 
 # Image SHA1 versions
 HEAD_SHA1=$(shell find $(IMAGE_DIR) -type f -exec cat {} \; | shasum | cut -c 1-20)
diff --git a/dual-master/cf-dns-route.yml b/dual-master/cf-dns-route.yml
deleted file mode 100644
index d123d7f..0000000
--- a/dual-master/cf-dns-route.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-AWSTemplateFormatVersion: '2010-09-09'
-Description: A stack for the Gerrit service Route53 routing.
-Parameters:
-  Master1ServiceStackName:
-      Description: Stack name of the ECS Master Gerrit service
-      Type: String
-      Default: gerrit-service-master-1
-  Master2ServiceStackName:
-      Description: Stack name of the ECS Master Gerrit service
-      Type: String
-      Default: gerrit-service-master-2
-  LBServiceStackName:
-      Description: Stack name of the ECS LB service
-      Type: String
-      Default: gerrit-service
-
-Resources:
-  Master1DnsRecord:
-      Type: AWS::Route53::RecordSet
-      Properties:
-        Name:
-          !Join
-            - '.'
-            - - Fn::ImportValue: !Join [':', [!Ref 'Master1ServiceStackName', 'Subdomain']]
-              - Fn::ImportValue: !Join [':', [!Ref 'Master1ServiceStackName', 'HostedZoneName']]
-        HostedZoneName:
-          !Join
-            - ''
-            - - Fn::ImportValue: !Join [':', [!Ref 'Master1ServiceStackName', 'HostedZoneName']]
-              - '.'
-        Comment: DNS name for Gerrit Master.
-        Type: A
-        AliasTarget:
-          DNSName:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'Master1ServiceStackName', 'PublicLoadBalancerDNSName']]
-          HostedZoneId:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'Master1ServiceStackName', 'CanonicalHostedZoneID']]
-          EvaluateTargetHealth: False
-  Master2DnsRecord:
-      Type: AWS::Route53::RecordSet
-      Properties:
-        Name:
-          !Join
-            - '.'
-            - - Fn::ImportValue: !Join [':', [!Ref 'Master2ServiceStackName', 'Subdomain']]
-              - Fn::ImportValue: !Join [':', [!Ref 'Master2ServiceStackName', 'HostedZoneName']]
-        HostedZoneName:
-          !Join
-            - ''
-            - - Fn::ImportValue: !Join [':', [!Ref 'Master2ServiceStackName', 'HostedZoneName']]
-              - '.'
-        Comment: DNS name for Gerrit Master.
-        Type: A
-        AliasTarget:
-          DNSName:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'Master2ServiceStackName', 'PublicLoadBalancerDNSName']]
-          HostedZoneId:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'Master2ServiceStackName', 'CanonicalHostedZoneID']]
-          EvaluateTargetHealth: False
-  LBDnsRecord:
-      Type: AWS::Route53::RecordSet
-      Properties:
-        Name:
-          !Join
-            - '.'
-            - - Fn::ImportValue: !Join [':', [!Ref 'LBServiceStackName', 'Subdomain']]
-              - Fn::ImportValue: !Join [':', [!Ref 'LBServiceStackName', 'HostedZoneName']]
-        HostedZoneName:
-          !Join
-            - ''
-            - - Fn::ImportValue: !Join [':', [!Ref 'LBServiceStackName', 'HostedZoneName']]
-              - '.'
-        Comment: DNS name for Gerrit LB.
-        Type: A
-        AliasTarget:
-          DNSName:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'LBServiceStackName', 'PublicLoadBalancerDNSName']]
-          HostedZoneId:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'LBServiceStackName', 'CanonicalHostedZoneID']]
-          EvaluateTargetHealth: False
diff --git a/dual-master/Makefile b/dual-primary/Makefile
similarity index 75%
rename from dual-master/Makefile
rename to dual-primary/Makefile
index d295f7c..7e2b6ab 100644
--- a/dual-master/Makefile
+++ b/dual-primary/Makefile
@@ -4,8 +4,8 @@
 include ../maintenance/git-gc/Makefile
 
 CLUSTER_TEMPLATE:=cf-cluster.yml
-SERVICE_MASTER_TEMPLATE:=cf-service-master.yml
-SERVICE_SLAVE_TEMPLATE:=cf-service-slave.yml
+SERVICE_PRIMARY_TEMPLATE:=cf-service-primary.yml
+SERVICE_REPLICA_TEMPLATE:=cf-service-replica.yml
 DNS_ROUTING_TEMPLATE:=cf-dns-route.yml
 CLOUDWATCH_DASHBOARD_TEMPLATE:=cf-dashboard.yml
 LOAD_BALANCER_TEMPLATE:=cf-service-lb.yml
@@ -21,9 +21,9 @@
 
 .PHONY: create-all delete-all \
 				wait-for-replication-creation wait-for-service-replication-deletion service-replication delete-service-replication \
-				cluster cluster-keys service-master-1 service-master-2 service-slave dns-routing dashboard delete-dashboard\
-				wait-for-cluster-creation wait-for-service-master-1-creation wait-for-service-master-2-creation wait-for-service-slave-creation wait-for-dns-routing-creation wait-for-dashboard-creation \
-				wait-for-cluster-deletion wait-for-service-master-1-deletion wait-for-service-master-2-deletion wait-for-service-slave-deletion wait-for-dns-routing-deletion wait-for-dashboard-deletion \
+				cluster cluster-keys service-primary-1 service-primary-2 service-replica dns-routing dashboard delete-dashboard\
+				wait-for-cluster-creation wait-for-service-primary-1-creation wait-for-service-primary-2-creation wait-for-service-replica-creation wait-for-dns-routing-creation wait-for-dashboard-creation \
+				wait-for-cluster-deletion wait-for-service-primary-1-deletion wait-for-service-primary-2-deletion wait-for-service-replica-deletion wait-for-dns-routing-deletion wait-for-dashboard-deletion \
 				service-lb wait-for-service-lb-deletion wait-for-service-lb-creation \
 				gerrit-build gerrit-publish haproxy-publish syslog-sidecar-publish
 
@@ -42,15 +42,15 @@
 						gerrit-publish haproxy-publish syslog-sidecar-publish \
 						cluster wait-for-cluster-creation \
 						$(optional_replication_targets_creation) \
-						service-slave service-master-1 \
-						wait-for-service-master-1-creation wait-for-service-slave-creation \
-						service-master-2 wait-for-service-master-2-creation \
+						service-replica service-primary-1 \
+						wait-for-service-primary-1-creation wait-for-service-replica-creation \
+						service-primary-2 wait-for-service-primary-2-creation \
 						$(optional_dashboard_targets_creation) \
 						service-lb wait-for-service-lb-creation \
 						$(optional_git_gc_targets_creation) \
 						dns-routing wait-for-dns-routing-creation
 
-cluster: cluster-keys set-optional-gerrit-master-volume
+cluster: cluster-keys set-optional-gerrit-primary-volume
 ifdef CLUSTER_INSTANCE_TYPE
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=InstanceType,ParameterValue=$(CLUSTER_INSTANCE_TYPE))
 endif
@@ -75,8 +75,8 @@
 ifdef HA_PROXY_DESIRED_COUNT
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=HAProxyDesiredCount,ParameterValue=$(HA_PROXY_DESIRED_COUNT))
 endif
-ifdef MASTER_MAX_COUNT
-		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=MasterMaxCount,ParameterValue=$(MASTER_MAX_COUNT))
+ifdef PRIMARY_MAX_COUNT
+		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=PrimaryMaxCount,ParameterValue=$(PRIMARY_MAX_COUNT))
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
@@ -91,17 +91,17 @@
 		ParameterKey=VPCIdProp,ParameterValue=$(VPC_ID) \
 		ParameterKey=SubnetIdProp,ParameterValue=$(SUBNET_ID) \
 		$(CLUSTER_OPTIONAL_PARAMS) \
-		$(GERRIT_OPTIONAL_MASTER_VOLUME)
+		$(GERRIT_OPTIONAL_PRIMARY_VOLUME)
 
-service-master-1: set-optional-params-metrics-cloudwatch set-optional-params-smtp \
+service-primary-1: set-optional-params-metrics-cloudwatch set-optional-params-smtp \
 					set-optional-params-multisite set-ldap-account-pattern \
 					set-optional-gerrit-ulimits set-optional-jgit-conf \
 					set-high-availability-optional-params
-ifdef GERRIT_MASTER1_INSTANCE_ID
-		$(eval MASTER1_SERVICE_OPTIONAL_PARAMS := $(MASTER1_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_MASTER1_INSTANCE_ID))
+ifdef GERRIT_PRIMARY1_INSTANCE_ID
+		$(eval PRIMARY1_SERVICE_OPTIONAL_PARAMS := $(PRIMARY1_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_PRIMARY1_INSTANCE_ID))
 endif
 ifdef LOAD_BALANCER_SCHEME
-		$(eval MASTER1_SERVICE_OPTIONAL_PARAMS := $(MASTER1_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
+		$(eval PRIMARY1_SERVICE_OPTIONAL_PARAMS := $(PRIMARY1_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
 endif
 ifdef REMOTE_REPLICATION_TARGET_HOST
 		$(eval REMOTE_OPTIONAL_PARAMS := $(REMOTE_OPTIONAL_PARAMS) ParameterKey=RemoteReplicationTargetHost,ParameterValue=$(REMOTE_REPLICATION_TARGET_HOST))
@@ -111,9 +111,9 @@
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
-		--stack-name $(SERVICE_MASTER1_STACK_NAME) \
+		--stack-name $(SERVICE_PRIMARY1_STACK_NAME) \
 		--capabilities CAPABILITY_IAM  \
-		--template-body file://`pwd`/$(SERVICE_MASTER_TEMPLATE) \
+		--template-body file://`pwd`/$(SERVICE_PRIMARY_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
 		ParameterKey=GerritInstanceNumber,ParameterValue=1 \
@@ -127,15 +127,15 @@
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
 		ParameterKey=TemplateBucketName,ParameterValue=$(TEMPLATE_BUCKET_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
-		ParameterKey=Subdomain,ParameterValue=$(MASTER1_SUBDOMAIN) \
-		ParameterKey=SlaveSubdomain,ParameterValue=$(SLAVE_SUBDOMAIN) \
+		ParameterKey=Subdomain,ParameterValue=$(PRIMARY1_SUBDOMAIN) \
+		ParameterKey=ReplicaSubdomain,ParameterValue=$(REPLICA_SUBDOMAIN) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
-		ParameterKey=HTTPHostPort,ParameterValue=$(HTTP_HOST_PORT_MASTER1) \
-		ParameterKey=SSHHostPort,ParameterValue=$(SSH_HOST_PORT_MASTER1) \
+		ParameterKey=HTTPHostPort,ParameterValue=$(HTTP_HOST_PORT_PRIMARY1) \
+		ParameterKey=SSHHostPort,ParameterValue=$(SSH_HOST_PORT_PRIMARY1) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
 		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
-		ParameterKey=PeerSubdomain,ParameterValue=$(MASTER2_SUBDOMAIN) \
+		ParameterKey=PeerSubdomain,ParameterValue=$(PRIMARY2_SUBDOMAIN) \
 		ParameterKey=LBSubdomain,ParameterValue=$(LB_SUBDOMAIN) \
 		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
 		ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU) \
@@ -145,21 +145,21 @@
 		$(JGIT_OPTIONAL_PARAMS) \
 		$(MULTISITE_OPTIONAL_PARAMS) \
 		$(REMOTE_OPTIONAL_PARAMS) \
-		$(MASTER1_SERVICE_OPTIONAL_PARAMS) \
+		$(PRIMARY1_SERVICE_OPTIONAL_PARAMS) \
 		$(LDAP_ACCOUNT_PATTERN_PARAM) \
 		$(METRICS_CW_OPTIONAL_PARAMS) \
 		$(SMTP_OPTIONAL_PARAMS) \
 		$(GERRIT_ULIMITS)
 
-service-master-2: set-optional-params-metrics-cloudwatch set-optional-params-smtp \
+service-primary-2: set-optional-params-metrics-cloudwatch set-optional-params-smtp \
 					set-optional-params-multisite set-ldap-account-pattern \
 					set-optional-gerrit-ulimits set-optional-jgit-conf \
 					set-high-availability-optional-params
-ifdef GERRIT_MASTER2_INSTANCE_ID
-		$(eval MASTER2_SERVICE_OPTIONAL_PARAMS := $(MASTER2_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_MASTER2_INSTANCE_ID))
+ifdef GERRIT_PRIMARY2_INSTANCE_ID
+		$(eval PRIMARY2_SERVICE_OPTIONAL_PARAMS := $(PRIMARY2_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_PRIMARY2_INSTANCE_ID))
 endif
 ifdef LOAD_BALANCER_SCHEME
-		$(eval MASTER2_SERVICE_OPTIONAL_PARAMS := $(MASTER2_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
+		$(eval PRIMARY2_SERVICE_OPTIONAL_PARAMS := $(PRIMARY2_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
 endif
 ifdef REMOTE_REPLICATION_TARGET_HOST
 		$(eval REMOTE_OPTIONAL_PARAMS := $(REMOTE_OPTIONAL_PARAMS) ParameterKey=RemoteReplicationTargetHost,ParameterValue=$(REMOTE_REPLICATION_TARGET_HOST))
@@ -169,9 +169,9 @@
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
-		--stack-name $(SERVICE_MASTER2_STACK_NAME) \
+		--stack-name $(SERVICE_PRIMARY2_STACK_NAME) \
 		--capabilities CAPABILITY_IAM  \
-		--template-body file://`pwd`/$(SERVICE_MASTER_TEMPLATE) \
+		--template-body file://`pwd`/$(SERVICE_PRIMARY_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
 		ParameterKey=GerritInstanceNumber,ParameterValue=2 \
@@ -185,15 +185,15 @@
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
 		ParameterKey=TemplateBucketName,ParameterValue=$(TEMPLATE_BUCKET_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
-		ParameterKey=Subdomain,ParameterValue=$(MASTER2_SUBDOMAIN) \
-		ParameterKey=SlaveSubdomain,ParameterValue=$(SLAVE_SUBDOMAIN) \
+		ParameterKey=Subdomain,ParameterValue=$(PRIMARY2_SUBDOMAIN) \
+		ParameterKey=ReplicaSubdomain,ParameterValue=$(REPLICA_SUBDOMAIN) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
-		ParameterKey=HTTPHostPort,ParameterValue=$(HTTP_HOST_PORT_MASTER2) \
-		ParameterKey=SSHHostPort,ParameterValue=$(SSH_HOST_PORT_MASTER2) \
+		ParameterKey=HTTPHostPort,ParameterValue=$(HTTP_HOST_PORT_PRIMARY2) \
+		ParameterKey=SSHHostPort,ParameterValue=$(SSH_HOST_PORT_PRIMARY2) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
 		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
-		ParameterKey=PeerSubdomain,ParameterValue=$(MASTER1_SUBDOMAIN) \
+		ParameterKey=PeerSubdomain,ParameterValue=$(PRIMARY1_SUBDOMAIN) \
 		ParameterKey=LBSubdomain,ParameterValue=$(LB_SUBDOMAIN) \
 		ParameterKey=ReindexAtSartup,ParameterValue=true \
 		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
@@ -204,7 +204,7 @@
 		$(JGIT_OPTIONAL_PARAMS) \
 		$(MULTISITE_OPTIONAL_PARAMS) \
 		$(REMOTE_OPTIONAL_PARAMS) \
-		$(MASTER2_SERVICE_OPTIONAL_PARAMS) \
+		$(PRIMARY2_SERVICE_OPTIONAL_PARAMS) \
 		$(LDAP_ACCOUNT_PATTERN_PARAM) \
 		$(METRICS_CW_OPTIONAL_PARAMS) \
 		$(SMTP_OPTIONAL_PARAMS) \
@@ -226,18 +226,18 @@
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
 		ParameterKey=GitReplicationSubdomain,ParameterValue=$(GIT_REPLICATION_SUBDOMAIN)
 
-service-slave: set-optional-params-metrics-cloudwatch set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
-ifdef GERRIT_SLAVE_INSTANCE_ID
-		$(eval SLAVE_SERVICE_OPTIONAL_PARAMS := $(SLAVE_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_SLAVE_INSTANCE_ID))
+service-replica: set-optional-params-metrics-cloudwatch set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
+ifdef GERRIT_REPLICA_INSTANCE_ID
+		$(eval REPLICA_SERVICE_OPTIONAL_PARAMS := $(REPLICA_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_REPLICA_INSTANCE_ID))
 endif
 ifdef LOAD_BALANCER_SCHEME
-		$(eval SLAVE_SERVICE_OPTIONAL_PARAMS := $(SLAVE_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
+		$(eval REPLICA_SERVICE_OPTIONAL_PARAMS := $(REPLICA_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
-		--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+		--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 		--capabilities CAPABILITY_IAM  \
-		--template-body file://`pwd`/$(SERVICE_SLAVE_TEMPLATE) \
+		--template-body file://`pwd`/$(SERVICE_REPLICA_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
 		ParameterKey=LDAPServer,ParameterValue=$(LDAP_SERVER) \
@@ -247,7 +247,7 @@
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
 		ParameterKey=TemplateBucketName,ParameterValue=$(TEMPLATE_BUCKET_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
-		ParameterKey=Subdomain,ParameterValue=$(SLAVE_SUBDOMAIN) \
+		ParameterKey=Subdomain,ParameterValue=$(REPLICA_SUBDOMAIN) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
@@ -258,7 +258,7 @@
 		ParameterKey=JgitCacheSize,ParameterValue=$(JGIT_CACHE_SIZE) \
 		$(JGIT_OPTIONAL_PARAMS) \
 		$(LDAP_ACCOUNT_PATTERN_PARAM) \
-		$(SLAVE_SERVICE_OPTIONAL_PARAMS) \
+		$(REPLICA_SERVICE_OPTIONAL_PARAMS) \
 		$(METRICS_CW_OPTIONAL_PARAMS) \
 		$(GERRIT_ULIMITS)
 
@@ -277,8 +277,8 @@
 		--region $(AWS_REGION) \
 		--parameters \
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
-		ParameterKey=Master1ServiceStackName,ParameterValue=$(SERVICE_MASTER1_STACK_NAME) \
-		ParameterKey=Master2ServiceStackName,ParameterValue=$(SERVICE_MASTER2_STACK_NAME) \
+		ParameterKey=Primary1ServiceStackName,ParameterValue=$(SERVICE_PRIMARY1_STACK_NAME) \
+		ParameterKey=Primary2ServiceStackName,ParameterValue=$(SERVICE_PRIMARY2_STACK_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
@@ -296,20 +296,20 @@
 		--template-body file://`pwd`/$(DNS_ROUTING_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
-		ParameterKey=Master1ServiceStackName,ParameterValue=$(SERVICE_MASTER1_STACK_NAME) \
-		ParameterKey=Master2ServiceStackName,ParameterValue=$(SERVICE_MASTER2_STACK_NAME) \
+		ParameterKey=Primary1ServiceStackName,ParameterValue=$(SERVICE_PRIMARY1_STACK_NAME) \
+		ParameterKey=Primary2ServiceStackName,ParameterValue=$(SERVICE_PRIMARY2_STACK_NAME) \
 		ParameterKey=LBServiceStackName,ParameterValue=$(LOAD_BALANCER_STACK_NAME)
 
 dashboard:
 ifeq ($(METRICS_CLOUDWATCH_ENABLED),true)
-ifdef GERRIT_MASTER1_INSTANCE_ID
-		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=Master1InstanceId,ParameterValue=$(GERRIT_MASTER1_INSTANCE_ID))
+ifdef GERRIT_PRIMARY1_INSTANCE_ID
+		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=Primary1InstanceId,ParameterValue=$(GERRIT_PRIMARY1_INSTANCE_ID))
 endif
-ifdef GERRIT_MASTER2_INSTANCE_ID
-		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=Master2InstanceId,ParameterValue=$(GERRIT_MASTER2_INSTANCE_ID))
+ifdef GERRIT_PRIMARY2_INSTANCE_ID
+		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=Primary2InstanceId,ParameterValue=$(GERRIT_PRIMARY2_INSTANCE_ID))
 endif
-ifdef GERRIT_SLAVE_INSTANCE_ID
-		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=SlaveInstanceId,ParameterValue=$(GERRIT_SLAVE_INSTANCE_ID))
+ifdef GERRIT_REPLICA_INSTANCE_ID
+		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=ReplicaInstanceId,ParameterValue=$(GERRIT_REPLICA_INSTANCE_ID))
 endif
 ifdef METRICS_CLOUDWATCH_NAMESPACE
 		$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=MetricsCloudwatchNamespace,ParameterValue=$(METRICS_CLOUDWATCH_NAMESPACE))
@@ -334,12 +334,12 @@
 	--region $(AWS_REGION)
 	@echo "*** Cluster stack '$(CLUSTER_STACK_NAME)' created"
 
-wait-for-service-master-1-creation:
-	@echo "*** Wait for service master stack '$(SERVICE_MASTER1_STACK_NAME)' creation"
+wait-for-service-primary-1-creation:
+	@echo "*** Wait for service primary stack '$(SERVICE_PRIMARY1_STACK_NAME)' creation"
 	$(AWS_FC_COMMAND) wait stack-create-complete \
-	--stack-name $(SERVICE_MASTER1_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY1_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack '$(SERVICE_MASTER1_STACK_NAME)' created"
+	@echo "*** Service stack '$(SERVICE_PRIMARY1_STACK_NAME)' created"
 
 wait-for-service-replication-creation:
 	@echo "*** Wait for service replication stack '$(SERVICE_REPLICATION_STACK_NAME)' creation"
@@ -348,19 +348,19 @@
 	--region $(AWS_REGION)
 	@echo "*** Service stack '$(SERVICE_REPLICATION_STACK_NAME)' created"
 
-wait-for-service-master-2-creation:
-	@echo "*** Wait for service master stack '$(SERVICE_MASTER2_STACK_NAME)' creation"
+wait-for-service-primary-2-creation:
+	@echo "*** Wait for service primary stack '$(SERVICE_PRIMARY2_STACK_NAME)' creation"
 	$(AWS_FC_COMMAND) wait stack-create-complete \
-	--stack-name $(SERVICE_MASTER2_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY2_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack '$(SERVICE_MASTER2_STACK_NAME)' created"
+	@echo "*** Service stack '$(SERVICE_PRIMARY2_STACK_NAME)' created"
 
-wait-for-service-slave-creation:
-	@echo "*** Wait for service slave stack '$(SERVICE_SLAVE_STACK_NAME)' creation"
+wait-for-service-replica-creation:
+	@echo "*** Wait for service replica stack '$(SERVICE_REPLICA_STACK_NAME)' creation"
 	$(AWS_FC_COMMAND) wait stack-create-complete \
-	--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+	--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack '$(SERVICE_SLAVE_STACK_NAME)' created"
+	@echo "*** Service stack '$(SERVICE_REPLICA_STACK_NAME)' created"
 
 wait-for-service-lb-creation:
 	@echo "*** Wait for service lb stack '$(LOAD_BALANCER_STACK_NAME)' creation"
@@ -390,26 +390,26 @@
 	--region $(AWS_REGION)
 	@echo "*** Cluster stack '$(CLUSTER_STACK_NAME)' deleted"
 
-wait-for-service-master-1-deletion:
-	@echo "*** Wait for service master stack '$(SERVICE_MASTER1_STACK_NAME)' deletion"
+wait-for-service-primary-1-deletion:
+	@echo "*** Wait for service primary stack '$(SERVICE_PRIMARY1_STACK_NAME)' deletion"
 	$(AWS_FC_COMMAND) wait stack-delete-complete \
-	--stack-name $(SERVICE_MASTER1_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY1_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack master '$(SERVICE_MASTER1_STACK_NAME)' deleted"
+	@echo "*** Service stack primary '$(SERVICE_PRIMARY1_STACK_NAME)' deleted"
 
-wait-for-service-master-2-deletion:
-	@echo "*** Wait for service master stack '$(SERVICE_MASTER2_STACK_NAME)' deletion"
+wait-for-service-primary-2-deletion:
+	@echo "*** Wait for service primary stack '$(SERVICE_PRIMARY2_STACK_NAME)' deletion"
 	$(AWS_FC_COMMAND) wait stack-delete-complete \
-	--stack-name $(SERVICE_MASTER2_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY2_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack master '$(SERVICE_MASTER2_STACK_NAME)' deleted"
+	@echo "*** Service stack primary '$(SERVICE_PRIMARY2_STACK_NAME)' deleted"
 
-wait-for-service-slave-deletion:
-	@echo "*** Wait for service slave stack '$(SERVICE_SLAVE_STACK_NAME)' deletion"
+wait-for-service-replica-deletion:
+	@echo "*** Wait for service replica stack '$(SERVICE_REPLICA_STACK_NAME)' deletion"
 	$(AWS_FC_COMMAND) wait stack-delete-complete \
-	--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+	--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack slave '$(SERVICE_SLAVE_STACK_NAME)' deleted"
+	@echo "*** Service stack replica '$(SERVICE_REPLICA_STACK_NAME)' deleted"
 
 wait-for-service-lb-deletion:
 	@echo "*** Wait for service lb stack '$(LOAD_BALANCER_STACK_NAME)' deletion"
@@ -444,19 +444,19 @@
 	--stack-name $(CLUSTER_STACK_NAME) \
 	--region $(AWS_REGION)
 
-delete-service-master-1:
+delete-service-primary-1:
 	$(AWS_FC_COMMAND) delete-stack \
-	--stack-name $(SERVICE_MASTER1_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY1_STACK_NAME) \
 	--region $(AWS_REGION)
 
-delete-service-master-2:
+delete-service-primary-2:
 	$(AWS_FC_COMMAND) delete-stack \
-	--stack-name $(SERVICE_MASTER2_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY2_STACK_NAME) \
 	--region $(AWS_REGION)
 
-delete-service-slave:
+delete-service-replica:
 	$(AWS_FC_COMMAND) delete-stack \
-	--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+	--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 	--region $(AWS_REGION)
 
 delete-service-lb:
@@ -481,8 +481,8 @@
 
 delete-all: delete-dns-routing wait-for-dns-routing-deletion \
 						delete-service-lb wait-for-service-lb-deletion \
-						delete-service-master-1 delete-service-master-2 delete-service-slave \
-						wait-for-service-master-1-deletion wait-for-service-master-2-deletion wait-for-service-slave-deletion \
+						delete-service-primary-1 delete-service-primary-2 delete-service-replica \
+						wait-for-service-primary-1-deletion wait-for-service-primary-2-deletion wait-for-service-replica-deletion \
 						$(optional_dashboard_targets_deletion) \
 						$(optional_replication_targets_deletion) \
 						$(optional_git_gc_targets_deletion) \
@@ -531,9 +531,9 @@
 
 gerrit-publish:
 ifeq ($(MULTISITE_ENABLED),true)
-	$(MAKE) -C ../gerrit gerrit-publish RECIPE=dual-master PLUGINS="$(MULTI_SITE_PLUGINS)" PLUGINS_LIBS_LINKS="$(MULTI_SITE_PLUGINS_LIBS_LINKS)" MAVEN_LIBS="$(MULTI_SITE_MAVEN_LIBS)"
+	$(MAKE) -C ../gerrit gerrit-publish RECIPE=dual-primary PLUGINS="$(MULTI_SITE_PLUGINS)" PLUGINS_LIBS_LINKS="$(MULTI_SITE_PLUGINS_LIBS_LINKS)" MAVEN_LIBS="$(MULTI_SITE_MAVEN_LIBS)"
 else
-	$(MAKE) -C ../gerrit gerrit-publish RECIPE=dual-master PLUGINS="$(SINGLE_SITE_PLUGINS)"
+	$(MAKE) -C ../gerrit gerrit-publish RECIPE=dual-primary PLUGINS="$(SINGLE_SITE_PLUGINS)"
 endif
 
 haproxy-publish:
@@ -543,10 +543,10 @@
 	$(MAKE) -C syslog-sidecar syslog-sidecar-publish
 
 git-daemon-publish:
-	$(MAKE) -C ../master-slave/git-daemon git-daemon-publish
+	$(MAKE) -C ../primary-replica/git-daemon git-daemon-publish
 
 git-ssh-publish:
-	$(MAKE) -C ../master-slave/git-ssh git-ssh-publish
+	$(MAKE) -C ../primary-replica/git-ssh git-ssh-publish
 
 set-high-availability-optional-params:
 	$(eval HA_OPTIONAL_PARAMS=)
diff --git a/dual-master/README.md b/dual-primary/README.md
similarity index 80%
rename from dual-master/README.md
rename to dual-primary/README.md
index 7b2ad60..767bdab 100644
--- a/dual-master/README.md
+++ b/dual-primary/README.md
@@ -1,23 +1,23 @@
-# Gerrit dual-master in High-Availability
+# Gerrit dual-primary in High-Availability
 
-This set of templates provides all the components to deploy a Gerrit dual-master
-in HA in ECS. The 2 masters will share the Git repositories via NFS, using EFS.
+This set of templates provides all the components to deploy a Gerrit dual-primary
+in HA in ECS. The 2 primaries will share the Git repositories via NFS, using EFS.
 
 ## Architecture
 
 The following templates are provided in this example:
 * `cf-cluster`: define the ECS cluster and the networking stack
-* `cf-service-master`: define the service stack running the gerrit master
+* `cf-service-primary`: define the service stack running the gerrit primary
 * `cf-dns-route`: define the DNS routing for the service
-* `cf-service-slave`: define the service stack running the gerrit replica
-* `cf-service-lb`: define the LBs in front of gerrit masters (this includes haproxy as well as NLB)
+* `cf-service-replica`: define the service stack running the gerrit replica
+* `cf-service-lb`: define the LBs in front of gerrit primaries (this includes haproxy as well as NLB)
 * `cf-dashboard`: define the CloudWatch dashboard for the services
 
 When the recipe enables the replication_service (see [docs](#replication-service))
 then these additional templates will be executed:
 
 * `cf-service-replication`: Define a replication stack that will allow git replication
-over the EFS volume, which is mounted by the master instances.
+over the EFS volume, which is mounted by the primary instances.
 
 ### Networking
 
@@ -27,13 +27,13 @@
 * 1 public Subnets:
  * CIDR: 10.0.0.0/24
 * 1 public NLB exposing:
- * Gerrit master 1 HTTP on port 8080
- * Gerrit master 1 SSH on port 29418
+ * Gerrit primary 1 HTTP on port 8080
+ * Gerrit primary 1 SSH on port 29418
 * 1 public NLB exposing:
- * Gerrit master 2 HTTP on port 8081
- * Gerrit master 2 SSH on port 39418
+ * Gerrit primary 2 HTTP on port 8081
+ * Gerrit primary 2 SSH on port 39418
 * 1 Internet Gateway
-* 2 type A alias DNS entry, for Gerrit master 1 and 2
+* 2 type A alias DNS entry, for Gerrit primary 1 and 2
 * A wildcard SSL certificate available in [AWS Certificate Manager](https://aws.amazon.com/certificate-manager/)
 
 ### Data persistency
@@ -43,8 +43,8 @@
   * Caches
   * Logs
 * EFS volume:
-  * Share Git repositories between masters
-  * Share Web sessions between masters
+  * Share Git repositories between primaries
+  * Share Web sessions between primaries
 
 *NOTE*: This stack uses EFS in provisioned mode, which is a better setting for large repos
 (> 1GB uncompressed) since it provides a lower latency compared to the burst mode.
@@ -71,8 +71,8 @@
 
 #### Blue/Green deployment
 
-When a dual-master stack is created, unless otherwise specified, a new EFS is
-created and a two new empty EBSs are attached to master1 and master2,
+When a dual-primary stack is created, unless otherwise specified, a new EFS is
+created and a two new empty EBSs are attached to primary1 and primary2,
 respectively.
 
 In a [blue/green deployment](https://en.wikipedia.org/wiki/Blue-green_deployment)
@@ -86,7 +86,7 @@
 version of the cluster needs to be deployed: this will be the _green_ stack and
 it will need to be deployed as such:
 
-1. Take master1 EBS snapshot of volume attached to /dev/xvdg (note, this needs
+1. Take primary1 EBS snapshot of volume attached to /dev/xvdg (note, this needs
 to be done in a read only window). Ideally this step is already performed
 regularly by a backup script.
 
@@ -144,7 +144,7 @@
 
 * Standard CloudWatch monitoring metrics for each component
 * Application level CloudWatch monitoring can be enabled as described [here](../Configuration.md#cloudwatch-monitoring)
-* Prometheus and Grafana stack is currently not available for dual-master, but a change is in progress to allow this
+* Prometheus and Grafana stack is currently not available for dual-primary, but a change is in progress to allow this
  (see [Issue 12979](https://bugs.chromium.org/p/gerrit/issues/detail?id=12979))
 
 ## How to run it
@@ -163,28 +163,28 @@
 
 Configuration values affecting deployment environment and cluster properties
 
-* `SERVICE_MASTER1_STACK_NAME`: Optional. Name of the master 1 service stack. `gerrit-service-master-1` by default.
-* `SERVICE_MASTER2_STACK_NAME`: Optional. Name of the master 2 service stack. `gerrit-service-master-2` by default.
+* `SERVICE_PRIMARY1_STACK_NAME`: Optional. Name of the primary 1 service stack. `gerrit-service-primary-1` by default.
+* `SERVICE_PRIMARY2_STACK_NAME`: Optional. Name of the primary 2 service stack. `gerrit-service-primary-2` by default.
 * `DASHBOARD_STACK_NAME` : Optional. Name of the dashboard stack. `gerrit-dashboard` by default.
-* `MASTER1_SUBDOMAIN`: Optional. Name of the master 1 sub domain. `gerrit-master-1-demo` by default.
-* `MASTER2_SUBDOMAIN`: Optional. Name of the master 2 sub domain. `gerrit-master-2-demo` by default.
-* `HTTP_HOST_PORT_MASTER1`: Optional. Gerrit Host HTTP port for master1 (must be different from master2). `9080` by default.
-* `SSH_HOST_PORT_MASTER1:`: Optional. Gerrit Host SSH port for master1 (must be different from master2). `29418` by default.
-* `HTTP_HOST_PORT_MASTER2`: Optional. Gerrit Host HTTP port for master2 (must be different from master1). `9080` by default.
-* `SSH_HOST_PORT_MASTER2:`: Optional. Gerrit Host SSH port for master2 (must be different from master1). `29418` by default.
-* `SLAVE_SUBDOMAIN`: Mandatory. The subdomain of the Gerrit slave. For example: `<AWS_PREFIX>-slave`
-* `LB_SUBDOMAIN`: Mandatory. The subdomain of the Gerrit load balancer. For example: `<AWS_PREFIX>-dual-master`
+* `PRIMARY1_SUBDOMAIN`: Optional. Name of the primary 1 sub domain. `gerrit-primary-1-demo` by default.
+* `PRIMARY2_SUBDOMAIN`: Optional. Name of the primary 2 sub domain. `gerrit-primary-2-demo` by default.
+* `HTTP_HOST_PORT_PRIMARY1`: Optional. Gerrit Host HTTP port for primary1 (must be different from primary2). `9080` by default.
+* `SSH_HOST_PORT_PRIMARY1:`: Optional. Gerrit Host SSH port for primary1 (must be different from primary2). `29418` by default.
+* `HTTP_HOST_PORT_PRIMARY2`: Optional. Gerrit Host HTTP port for primary2 (must be different from primary1). `9080` by default.
+* `SSH_HOST_PORT_PRIMARY2:`: Optional. Gerrit Host SSH port for primary2 (must be different from primary1). `29418` by default.
+* `REPLICA_SUBDOMAIN`: Mandatory. The subdomain of the Gerrit replica. For example: `<AWS_PREFIX>-replica`
+* `LB_SUBDOMAIN`: Mandatory. The subdomain of the Gerrit load balancer. For example: `<AWS_PREFIX>-dual-primary`
 * `FILESYSTEM_THROUGHPUT_MODE`: Optional. The throughput mode for the file system to be created.
 default: `bursting`. More info [here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html)
 * `FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS`: Optional. Only used when `FILESYSTEM_THROUGHPUT_MODE` is set to `provisioned`.
 default: `256`.
 
-* `GERRIT_SLAVE_INSTANCE_ID`: Optional. Identifier for the Gerrit slave instance.
-"gerrit-dual-master-SLAVE" by default.
-* `GERRIT_MASTER1_INSTANCE_ID`: Optional. Identifier for the Gerrit master1 instance.
-"gerrit-dual-master-MASTER1" by default.
-* `GERRIT_MASTER2_INSTANCE_ID`: Optional. Identifier for the Gerrit master2 instance.
-"gerrit-dual-master-MASTER2" by default.
+* `GERRIT_REPLICA_INSTANCE_ID`: Optional. Identifier for the Gerrit replica instance.
+"gerrit-dual-primary-REPLICA" by default.
+* `GERRIT_PRIMARY1_INSTANCE_ID`: Optional. Identifier for the Gerrit primary1 instance.
+"gerrit-dual-primary-PRIMARY1" by default.
+* `GERRIT_PRIMARY2_INSTANCE_ID`: Optional. Identifier for the Gerrit primary2 instance.
+"gerrit-dual-primary-PRIMARY2" by default.
 
 * `HA_PROXY_DESIRED_COUNT`: Optional. Desired number of haproxy services.
 "2" by default. Minimum: "2".
@@ -197,14 +197,14 @@
 * `HA_PROXY_MAX_COUNT`: Optional. Maximum number of EC2 instances in the haproxy autoscaling group.
 "2" by default. Minimum: "2".
 
-* `MASTER_MAX_COUNT`: Optional. Maximum number of EC2 instances in the master autoscaling group.
+* `PRIMARY_MAX_COUNT`: Optional. Maximum number of EC2 instances in the primary autoscaling group.
 "2" by default. Minimum: "2".
 
 * `GERRIT_VOLUME_SNAPSHOT_ID` : Optional. Id of the EBS volume snapshot used to
 create new EBS volume for Gerrit data. A new volume will be created for each
-master, based on this snapshot.
+primary, based on this snapshot.
 
-Note that, differently from other recipes, dual-master does not support the
+Note that, differently from other recipes, dual-primary does not support the
 `GERRIT_VOLUME_ID` parameter, since it wouldn't be possible to mount the same
 EBS on multiple EC2 instances.
 
@@ -212,7 +212,7 @@
 * `FILESYSTEM_ID`: Optional. An existing EFS filesystem id.
 
     If empty, a new EFS will be created to store git data.
-    Setting this value is required when deploying a dual-master cluster using
+    Setting this value is required when deploying a dual-primary cluster using
     existing data as well as performing blue/green deployments.
     The nested stack will be *retained* when the cluster is deleted, so that
     existing data can be used to perform blue/green deployments.
@@ -246,7 +246,7 @@
 #### MULTI-SITE
 
 This recipe supports multi-site. Multi-site is a specific configuration of Gerrit
-that allows it to be part of distributed multi-master of multiple Gerrit clusters.
+that allows it to be part of distributed multi-primary of multiple Gerrit clusters.
 No storage is shared among the Gerrit sites: syncing happens thanks to two
 channels:
 
@@ -259,7 +259,7 @@
 
 ##### Requirements
 * Kafka brokers and Zookeeper are required by this recipe and are expected to exist
-and accessible with server-side TLS security enabled by the master instances
+and accessible with server-side TLS security enabled by the primary instances
 resulting from the deployment of this recipe.
 * Replication service must be enabled to allow syncing of Git data.
 
@@ -315,7 +315,7 @@
 `$(GIT_REPLICATION_SUBDOMAIN).$(HOSTED_ZONE_NAME):1022`
 
 The service will persist git data on the same EFS volume mounted by the gerrit
-master1 and gerrit master2.
+primary1 and gerrit primary2.
 
 Note that the replication endpoint is not internet-facing, thus replication requests
 must be coming from a peered VPC.
@@ -361,23 +361,23 @@
 
 ### Access your Gerrit instances
 
-Get the URL of your Gerrit master instances this way:
+Get the URL of your Gerrit primary instances this way:
 
 ```
 aws cloudformation describe-stacks \
-  --stack-name <SERVICE_MASTER1_STACK_NAME> \
+  --stack-name <SERVICE_PRIMARY1_STACK_NAME> \
   | grep -A1 '"OutputKey": "CanonicalWebUrl"' \
   | grep OutputValue \
   | cut -d'"' -f 4
 
 aws cloudformation describe-stacks \
-  --stack-name <SERVICE_MASTER2_STACK_NAME> \
+  --stack-name <SERVICE_PRIMARY2_STACK_NAME> \
   | grep -A1 '"OutputKey": "CanonicalWebUrl"' \
   | grep OutputValue \
   | cut -d'"' -f 4
 ```
 
-Gerrit master instance ports:
+Gerrit primary instance ports:
 * HTTP `8080`
 * SSH `29418`
 
diff --git a/dual-master/cf-cluster.yml b/dual-primary/cf-cluster.yml
similarity index 97%
rename from dual-master/cf-cluster.yml
rename to dual-primary/cf-cluster.yml
index caf10ac..22d0594 100644
--- a/dual-master/cf-cluster.yml
+++ b/dual-primary/cf-cluster.yml
@@ -71,8 +71,8 @@
     Type: Number
     MinValue: 2
     Default: 2
-  MasterMaxCount:
-    Description: The maximum number of EC2 instances in the master autoscaling group
+  PrimaryMaxCount:
+    Description: The maximum number of EC2 instances in the primary autoscaling group
     ConstraintDescription: number of haproxy must be at least 2
     Type: Number
     Default: 2
@@ -206,10 +206,10 @@
 
           /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource HAProxyECSAutoScalingGroup --region ${AWS::Region}
 
-  Master1ASG:
+  Primary1ASG:
     Type: AWS::CloudFormation::Stack
     Properties:
-      TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-master-asg.yml'] ]
+      TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-primary-asg.yml'] ]
       TimeoutInMinutes: '25'
       Parameters:
         GerritInstanceNumber: 1
@@ -223,17 +223,17 @@
         FileSystem: !If [CreateEFS, !GetAtt GitFileSystemPermanentStack.Outputs.FileSystemID, !Ref FileSystemID ]
         SubnetId: !If [NetworkStackNeeded, !GetAtt ECSTaskNetworkStack.Outputs.PublicSubnetOneRef, !Ref SubnetIdProp]
         LogGroupName: !Ref AWS::StackName
-        MasterMaxCount: !Ref MasterMaxCount
+        PrimaryMaxCount: !Ref PrimaryMaxCount
         GerritVolumeAttachMaxRetries: !Ref GerritVolumeAttachMaxRetries
         GerritVolumeAttachRetryDelay: !Ref GerritVolumeAttachRetryDelay
         GerritVolumeSnapshotId: !Ref GerritVolumeSnapshotId
         GerritVolumeSizeInGiB: !Ref GerritVolumeSizeInGiB
         TemplateBucketName: !Ref TemplateBucketName
 
-  Master2ASG:
+  Primary2ASG:
     Type: AWS::CloudFormation::Stack
     Properties:
-      TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-master-asg.yml'] ]
+      TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-primary-asg.yml'] ]
       TimeoutInMinutes: '25'
       Parameters:
         GerritInstanceNumber: 2
@@ -247,7 +247,7 @@
         FileSystem: !If [CreateEFS, !GetAtt GitFileSystemPermanentStack.Outputs.FileSystemID, !Ref FileSystemID ]
         SubnetId: !If [NetworkStackNeeded, !GetAtt ECSTaskNetworkStack.Outputs.PublicSubnetOneRef, !Ref SubnetIdProp]
         LogGroupName: !Ref AWS::StackName
-        MasterMaxCount: !Ref MasterMaxCount
+        PrimaryMaxCount: !Ref PrimaryMaxCount
         GerritVolumeAttachMaxRetries: !Ref GerritVolumeAttachMaxRetries
         GerritVolumeAttachRetryDelay: !Ref GerritVolumeAttachRetryDelay
         GerritVolumeSnapshotId: !Ref GerritVolumeSnapshotId
diff --git a/dual-master/cf-dashboard.yml b/dual-primary/cf-dashboard.yml
similarity index 77%
rename from dual-master/cf-dashboard.yml
rename to dual-primary/cf-dashboard.yml
index a04300b..9d4e6dc 100644
--- a/dual-master/cf-dashboard.yml
+++ b/dual-primary/cf-dashboard.yml
@@ -1,17 +1,17 @@
 AWSTemplateFormatVersion: '2010-09-09'
-Description: Deploy a dual-master CloudWatch dashboard.
+Description: Deploy a dual-primary CloudWatch dashboard.
 Parameters:
-  Master1InstanceId:
-      Description: Optional identifier for the Gerrit master1 instance
-      Default: gerrit-dual-master-MASTER1
+  Primary1InstanceId:
+      Description: Optional identifier for the Gerrit primary1 instance
+      Default: gerrit-dual-primary-PRIMARY1
       Type: String
-  Master2InstanceId:
-      Description: Optional identifier for the Gerrit master2 instance
-      Default: gerrit-dual-master-MASTER2
+  Primary2InstanceId:
+      Description: Optional identifier for the Gerrit primary2 instance
+      Default: gerrit-dual-primary-PRIMARY2
       Type: String
-  SlaveInstanceId:
-      Description: Optional identifier for the Gerrit slave instance
-      Default: gerrit-dual-master-SLAVE
+  ReplicaInstanceId:
+      Description: Optional identifier for the Gerrit replica instance
+      Default: gerrit-dual-primary-REPLICA
       Type: String
   MetricsCloudwatchNamespace:
       Description: The CloudWatch namespace for Gerrit metrics
@@ -36,9 +36,9 @@
                             "height": 3,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${Master2InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "singleValue",
                                 "region": "${AWS::Region}",
@@ -57,9 +57,9 @@
                             "properties": {
                                 "metrics": [
                                     [ { "expression": "RATE(METRICS())", "label": "Expression1", "id": "e1", "region": "${AWS::Region}" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${Master1InstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${Master2InstanceId}", "Type", "gauge", { "id": "m3", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${SlaveInstanceId}", "Type", "gauge", { "id": "m2", "visible": false } ]
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${Primary1InstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${Primary2InstanceId}", "Type", "gauge", { "id": "m3", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge", { "id": "m2", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -86,9 +86,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${Master1InstanceId}", "Type", "gauge", { "id": "m1" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${Master2InstanceId}", "Type", "gauge", { "id": "m3" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${SlaveInstanceId}", "Type", "gauge", { "id": "m2" } ]
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${Primary1InstanceId}", "Type", "gauge", { "id": "m1" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${Primary2InstanceId}", "Type", "gauge", { "id": "m3" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge", { "id": "m2" } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -112,9 +112,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${Master2InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -137,9 +137,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${Master2InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -162,9 +162,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${Master2InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -187,9 +187,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${Master2InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -212,8 +212,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${Master1InstanceId}", "Type", "99.9%", { "id": "m2" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${Master2InstanceId}", "Type", "99.9%", { "id": "m3" } ]
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${Primary1InstanceId}", "Type", "99.9%", { "id": "m2" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${Primary2InstanceId}", "Type", "99.9%", { "id": "m3" } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -237,12 +237,12 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ { "expression": "m1+m2", "label": "Master 1 HTTP hits per second", "id": "e2", "region": "${AWS::Region}" } ],
-                                    [ { "expression": "m3+m4", "label": "Master 2 HTTP hits per second", "id": "e1", "region": "${AWS::Region}" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Master1InstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Master1InstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Master2InstanceId}", "Type", "count", { "id": "m3", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Master2InstanceId}", "Type", "count", { "id": "m4", "visible": false } ]
+                                    [ { "expression": "m1+m2", "label": "Primary 1 HTTP hits per second", "id": "e2", "region": "${AWS::Region}" } ],
+                                    [ { "expression": "m3+m4", "label": "Primary 2 HTTP hits per second", "id": "e1", "region": "${AWS::Region}" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Primary1InstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Primary1InstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Primary2InstanceId}", "Type", "count", { "id": "m3", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Primary2InstanceId}", "Type", "count", { "id": "m4", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -267,12 +267,12 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ { "expression": "(m1/(m1+m2))*100", "label": "Master 1 % of HTTP Errors", "id": "e1", "region": "${AWS::Region}" } ],
-                                    [ { "expression": "(m3/(m3+m4))*100", "label": "Master 2 % of HTTP Errors", "id": "e2", "region": "${AWS::Region}" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Master1InstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Master1InstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Master2InstanceId}", "Type", "count", { "id": "m3", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Master2InstanceId}", "Type", "count", { "id": "m4", "visible": false } ]
+                                    [ { "expression": "(m1/(m1+m2))*100", "label": "Primary 1 % of HTTP Errors", "id": "e1", "region": "${AWS::Region}" } ],
+                                    [ { "expression": "(m3/(m3+m4))*100", "label": "Primary 2 % of HTTP Errors", "id": "e2", "region": "${AWS::Region}" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Primary1InstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Primary1InstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${Primary2InstanceId}", "Type", "count", { "id": "m3", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${Primary2InstanceId}", "Type", "count", { "id": "m4", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -297,9 +297,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${Master1InstanceId}", "Type", "count", { "id": "m1" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${Master2InstanceId}", "Type", "count", { "id": "m2" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${SlaveInstanceId}", "Type", "count", { "id": "m3" } ]
+                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${Primary1InstanceId}", "Type", "count", { "id": "m1" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${Primary2InstanceId}", "Type", "count", { "id": "m2" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${ReplicaInstanceId}", "Type", "count", { "id": "m3" } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -324,14 +324,14 @@
                             "properties": {
                                 "metrics": [
                                     [ { "expression": "RATE(METRICS())*PERIOD(m1)", "label": "Expression1", "id": "e1" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${Master1InstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/receive_commits/total_scheduled_tasks_count", "InstanceId", "${Master1InstanceId}", "Type", "gauge", { "id": "m2", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/work_queue/total_scheduled_tasks_count", "InstanceId", "${Master1InstanceId}", "Type", "gauge", { "id": "m3", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/ssh_command_start/total_scheduled_tasks_count", "InstanceId", "${Master1InstanceId}", "Type", "gauge", { "id": "m4", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${Master2InstanceId}", "Type", "gauge", { "id": "m5", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/receive_commits/total_scheduled_tasks_count", "InstanceId", "${Master2InstanceId}", "Type", "gauge", { "id": "m6", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/work_queue/total_scheduled_tasks_count", "InstanceId", "${Master2InstanceId}", "Type", "gauge", { "id": "m7", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/ssh_command_start/total_scheduled_tasks_count",  "InstanceId", "${Master2InstanceId}", "Type", "gauge", { "id": "m8", "visible": false } ]
+                                    [ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${Primary1InstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/receive_commits/total_scheduled_tasks_count", "InstanceId", "${Primary1InstanceId}", "Type", "gauge", { "id": "m2", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/work_queue/total_scheduled_tasks_count", "InstanceId", "${Primary1InstanceId}", "Type", "gauge", { "id": "m3", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/ssh_command_start/total_scheduled_tasks_count", "InstanceId", "${Primary1InstanceId}", "Type", "gauge", { "id": "m4", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${Primary2InstanceId}", "Type", "gauge", { "id": "m5", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/receive_commits/total_scheduled_tasks_count", "InstanceId", "${Primary2InstanceId}", "Type", "gauge", { "id": "m6", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/work_queue/total_scheduled_tasks_count", "InstanceId", "${Primary2InstanceId}", "Type", "gauge", { "id": "m7", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/ssh_command_start/total_scheduled_tasks_count",  "InstanceId", "${Primary2InstanceId}", "Type", "gauge", { "id": "m8", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -355,8 +355,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${Master2InstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -379,9 +379,9 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${Master1InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${Master2InstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${Primary1InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${Primary2InstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
diff --git a/dual-primary/cf-dns-route.yml b/dual-primary/cf-dns-route.yml
new file mode 100644
index 0000000..5048f75
--- /dev/null
+++ b/dual-primary/cf-dns-route.yml
@@ -0,0 +1,86 @@
+AWSTemplateFormatVersion: '2010-09-09'
+Description: A stack for the Gerrit service Route53 routing.
+Parameters:
+  Primary1ServiceStackName:
+      Description: Stack name of the ECS Primary Gerrit service
+      Type: String
+      Default: gerrit-service-primary-1
+  Primary2ServiceStackName:
+      Description: Stack name of the ECS Primary Gerrit service
+      Type: String
+      Default: gerrit-service-primary-2
+  LBServiceStackName:
+      Description: Stack name of the ECS LB service
+      Type: String
+      Default: gerrit-service
+
+Resources:
+  Primary1DnsRecord:
+      Type: AWS::Route53::RecordSet
+      Properties:
+        Name:
+          !Join
+            - '.'
+            - - Fn::ImportValue: !Join [':', [!Ref 'Primary1ServiceStackName', 'Subdomain']]
+              - Fn::ImportValue: !Join [':', [!Ref 'Primary1ServiceStackName', 'HostedZoneName']]
+        HostedZoneName:
+          !Join
+            - ''
+            - - Fn::ImportValue: !Join [':', [!Ref 'Primary1ServiceStackName', 'HostedZoneName']]
+              - '.'
+        Comment: DNS name for Gerrit Primary.
+        Type: A
+        AliasTarget:
+          DNSName:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'Primary1ServiceStackName', 'PublicLoadBalancerDNSName']]
+          HostedZoneId:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'Primary1ServiceStackName', 'CanonicalHostedZoneID']]
+          EvaluateTargetHealth: False
+  Primary2DnsRecord:
+      Type: AWS::Route53::RecordSet
+      Properties:
+        Name:
+          !Join
+            - '.'
+            - - Fn::ImportValue: !Join [':', [!Ref 'Primary2ServiceStackName', 'Subdomain']]
+              - Fn::ImportValue: !Join [':', [!Ref 'Primary2ServiceStackName', 'HostedZoneName']]
+        HostedZoneName:
+          !Join
+            - ''
+            - - Fn::ImportValue: !Join [':', [!Ref 'Primary2ServiceStackName', 'HostedZoneName']]
+              - '.'
+        Comment: DNS name for Gerrit Primary.
+        Type: A
+        AliasTarget:
+          DNSName:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'Primary2ServiceStackName', 'PublicLoadBalancerDNSName']]
+          HostedZoneId:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'Primary2ServiceStackName', 'CanonicalHostedZoneID']]
+          EvaluateTargetHealth: False
+  LBDnsRecord:
+      Type: AWS::Route53::RecordSet
+      Properties:
+        Name:
+          !Join
+            - '.'
+            - - Fn::ImportValue: !Join [':', [!Ref 'LBServiceStackName', 'Subdomain']]
+              - Fn::ImportValue: !Join [':', [!Ref 'LBServiceStackName', 'HostedZoneName']]
+        HostedZoneName:
+          !Join
+            - ''
+            - - Fn::ImportValue: !Join [':', [!Ref 'LBServiceStackName', 'HostedZoneName']]
+              - '.'
+        Comment: DNS name for Gerrit LB.
+        Type: A
+        AliasTarget:
+          DNSName:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'LBServiceStackName', 'PublicLoadBalancerDNSName']]
+          HostedZoneId:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'LBServiceStackName', 'CanonicalHostedZoneID']]
+          EvaluateTargetHealth: False
diff --git a/dual-master/cf-service-lb.yml b/dual-primary/cf-service-lb.yml
similarity index 92%
rename from dual-master/cf-service-lb.yml
rename to dual-primary/cf-service-lb.yml
index d2795ff..0865f04 100644
--- a/dual-master/cf-service-lb.yml
+++ b/dual-primary/cf-service-lb.yml
@@ -61,7 +61,7 @@
   Subdomain:
         Description: The subdomain of the Gerrit cluster
         Type: String
-        Default: gerrit-dual-master
+        Default: gerrit-dual-primary
   LoadBalancerScheme:
         Description: Load Balancer schema, The nodes of an Internet-facing load balancer have public IP addresses.
         Type: String
@@ -70,14 +70,14 @@
   GerritKeyPrefix:
         Description: Gerrit credentials keys prefix
         Type: String
-  Master1ServiceStackName:
-      Description: Stack name of the ECS Master Gerrit service
+  Primary1ServiceStackName:
+      Description: Stack name of the ECS Primary Gerrit service
       Type: String
-      Default: gerrit-service-master-1
-  Master2ServiceStackName:
-      Description: Stack name of the ECS Master Gerrit service
+      Default: gerrit-service-primary-1
+  Primary2ServiceStackName:
+      Description: Stack name of the ECS Primary Gerrit service
       Type: String
-      Default: gerrit-service-master-2
+      Default: gerrit-service-primary-2
   SyslogSidecarServiceName:
       Description: HAPRoxy Syslog Sidecar service name
       Type: String
@@ -118,12 +118,12 @@
                   Essential: true
                   Image: !Sub '${DockerRegistryUrl}/${HAProxyDockerImage}'
                   Environment:
-                    - Name: GERRIT_MASTER_1_URL
+                    - Name: GERRIT_PRIMARY_1_URL
                       Value:
-                        Fn::ImportValue: !Join [':', [!Ref 'Master1ServiceStackName', 'PublicLoadBalancerDNSName']]
-                    - Name: GERRIT_MASTER_2_URL
+                        Fn::ImportValue: !Join [':', [!Ref 'Primary1ServiceStackName', 'PublicLoadBalancerDNSName']]
+                    - Name: GERRIT_PRIMARY_2_URL
                       Value:
-                        Fn::ImportValue: !Join [':', [!Ref 'Master2ServiceStackName', 'PublicLoadBalancerDNSName']]
+                        Fn::ImportValue: !Join [':', [!Ref 'Primary2ServiceStackName', 'PublicLoadBalancerDNSName']]
                     - Name: SYSLOG_SIDECAR
                       Value: !Ref SyslogSidecarServiceName
                   Cpu: 1024
diff --git a/dual-master/cf-service-master.yml b/dual-primary/cf-service-primary.yml
similarity index 97%
rename from dual-master/cf-service-master.yml
rename to dual-primary/cf-service-primary.yml
index bfb87ec..d2f1edc 100644
--- a/dual-master/cf-service-master.yml
+++ b/dual-primary/cf-service-primary.yml
@@ -2,7 +2,7 @@
 Description: Deploy a service into an ECS cluster behind a public load balancer.
 Parameters:
   GerritInstanceNumber:
-    Description: Whether this is master1 or master2
+    Description: Whether this is primary1 or primary2
     Type: Number
     AllowedValues: [1,2]
   ClusterStackName:
@@ -40,9 +40,9 @@
   Subdomain:
         Description: The subdomain of the Gerrit cluster
         Type: String
-        Default: gerrit-master-demo
-  SlaveSubdomain:
-        Description: The subdomain of the Gerrit slave
+        Default: gerrit-primary-demo
+  ReplicaSubdomain:
+        Description: The subdomain of the Gerrit replica
         Type: String
   LBSubdomain:
         Description: The subdomain of the Gerrit load balancer
@@ -132,7 +132,7 @@
   InstanceId:
     Description: Optional identifier for the Gerrit instance
     Type: String
-    Default: gerrit-dual-master-MASTER
+    Default: gerrit-dual-primary-PRIMARY
   MetricsCloudwatchEnabled:
     Description: Whether gerrit metrics should be published to cloudwatch
     Type: String
@@ -206,7 +206,7 @@
       Db: gerrit-db
       Logs: gerrit-logs
     Service:
-      Name: gerrit-master
+      Name: gerrit-primary
     LoadBalancer:
       HTTPPort: 8080
       SSHPort: 29418
@@ -247,7 +247,7 @@
             ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             NetworkMode: bridge
             PlacementConstraints:
-                - Expression: !Sub 'attribute:target_group == master-${GerritInstanceNumber}'
+                - Expression: !Sub 'attribute:target_group == primary-${GerritInstanceNumber}'
                   Type: "memberOf"
             ContainerDefinitions:
                 - Name: !FindInMap ['Gerrit', 'Service', 'Name']
@@ -310,8 +310,8 @@
                       Value: !FindInMap ['Git', 'Daemon', 'Port']
                     - Name: GIT_SSH_PORT
                       Value: !FindInMap ['Git', 'SSH', 'Port']
-                    - Name: SLAVE_SUBDOMAIN
-                      Value: !Ref SlaveSubdomain
+                    - Name: REPLICA_SUBDOMAIN
+                      Value: !Ref ReplicaSubdomain
                     - Name: GERRIT_INSTANCE_ID
                       Value: !Ref InstanceId
                     - Name: METRICS_CLOUDWATCH_ENABLED
diff --git a/dual-master/cf-service-slave.yml b/dual-primary/cf-service-replica.yml
similarity index 97%
rename from dual-master/cf-service-slave.yml
rename to dual-primary/cf-service-replica.yml
index 41df598..58ed57d 100644
--- a/dual-master/cf-service-slave.yml
+++ b/dual-primary/cf-service-replica.yml
@@ -3,7 +3,7 @@
 Parameters:
   GerritServiceName:
       Type: String
-      Default: gerrit-slave
+      Default: gerrit-replica
   GitDaemonServiceName:
       Type: String
       Default: gerrit-git-daemon
@@ -81,7 +81,7 @@
   Subdomain:
       Description: The subdomain of the Gerrit cluster
       Type: String
-      Default: gerrit-slave-demo
+      Default: gerrit-replica-demo
   LoadBalancerScheme:
         Description: Load Balancer schema, The nodes of an Internet-facing load balancer have public IP addresses.
         Type: String
@@ -90,23 +90,23 @@
   GerritGitVolume:
       Description: Gerrit git volume name
       Type: String
-      Default: gerrit-git-slave
+      Default: gerrit-git-replica
   GerritDataVolume:
       Description: Gerrit data volume name
       Type: String
-      Default: gerrit-data-slave
+      Default: gerrit-data-replica
   GerritCacheVolume:
       Description: Gerrit cache volume name
       Type: String
-      Default: gerrit-cache-slave
+      Default: gerrit-cache-replica
   GerritDbVolume:
       Description: Gerrit db volume name
       Type: String
-      Default: gerrit-db-slave
+      Default: gerrit-db-replica
   GerritLogsVolume:
       Description: Gerrit logs volume name
       Type: String
-      Default: gerrit-logs-slave
+      Default: gerrit-logs-replica
   GerritKeyPrefix:
       Description: Gerrit credentials keys prefix
       Type: String
@@ -157,7 +157,7 @@
   InstanceId:
     Description: Optional identifier for the Gerrit instance
     Type: String
-    Default: gerrit-dual-master-SLAVE
+    Default: gerrit-dual-primary-REPLICA
   MetricsCloudwatchEnabled:
     Description: Whether gerrit metrics should be published to cloudwatch
     Type: String
@@ -237,7 +237,7 @@
                       Value: !Sub 'https://${Subdomain}.${HostedZoneName}'
                     - Name: HTTPD_LISTEN_URL
                       Value: !Sub 'proxy-https://*:${HTTPContainePort}/'
-                    - Name: CONTAINER_SLAVE
+                    - Name: CONTAINER_REPLICA
                       Value: true
                     - Name: GERRIT_KEY_PREFIX
                       Value: !Ref GerritKeyPrefix
@@ -487,12 +487,12 @@
             Port: !Ref GitSSHPort
             Protocol: TCP
 
-    SlaveDnsRecord:
+    ReplicaDnsRecord:
         Type: AWS::Route53::RecordSet
         Properties:
           Name: !Sub '${Subdomain}.${HostedZoneName}'
           HostedZoneName: !Sub '${HostedZoneName}.'
-          Comment: DNS name for Gerrit Slave.
+          Comment: DNS name for Gerrit Replica.
           Type: A
           AliasTarget:
             DNSName: !GetAtt 'LoadBalancer.DNSName'
diff --git a/dual-master/cf-service-replication.yml b/dual-primary/cf-service-replication.yml
similarity index 98%
rename from dual-master/cf-service-replication.yml
rename to dual-primary/cf-service-replication.yml
index b6b656b..9930d3f 100644
--- a/dual-master/cf-service-replication.yml
+++ b/dual-primary/cf-service-replication.yml
@@ -68,7 +68,7 @@
   GerritGitVolume:
       Description: Gerrit git volume name
       Type: String
-      Default: gerrit-git-master
+      Default: gerrit-git-primary
 
 Resources:
     Service:
@@ -97,7 +97,7 @@
             ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             NetworkMode: bridge
             PlacementConstraints:
-              - Expression: !Sub 'attribute:target_group =~ master.*'
+              - Expression: !Sub 'attribute:target_group =~ primary.*'
                 Type: "memberOf"
             ContainerDefinitions:
                 - Name: !Ref GitAdminSSHContainerName
diff --git a/dual-master/haproxy/Dockerfile b/dual-primary/haproxy/Dockerfile
similarity index 100%
rename from dual-master/haproxy/Dockerfile
rename to dual-primary/haproxy/Dockerfile
diff --git a/dual-master/haproxy/Makefile b/dual-primary/haproxy/Makefile
similarity index 100%
rename from dual-master/haproxy/Makefile
rename to dual-primary/haproxy/Makefile
diff --git a/dual-master/haproxy/docker-entrypoint.sh b/dual-primary/haproxy/docker-entrypoint.sh
similarity index 100%
rename from dual-master/haproxy/docker-entrypoint.sh
rename to dual-primary/haproxy/docker-entrypoint.sh
diff --git a/dual-master/haproxy/haproxy.cfg.template b/dual-primary/haproxy/haproxy.cfg.template
similarity index 69%
rename from dual-master/haproxy/haproxy.cfg.template
rename to dual-primary/haproxy/haproxy.cfg.template
index 6d8c458..7b4c714 100644
--- a/dual-master/haproxy/haproxy.cfg.template
+++ b/dual-primary/haproxy/haproxy.cfg.template
@@ -25,7 +25,7 @@
     capture request header X-Forwarded-For len 15
     log-format %[capture.req.hdr(0)]:%cp\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r
 
-    default_backend master
+    default_backend primary
 
 frontend gitssh
     bind *:29418
@@ -34,43 +34,43 @@
 
     default_backend ssh
 
-backend master
+backend primary
     mode http
     balance roundrobin
     option forwardfor
     default-server inter 10s fall 3 rise 2
-    option httpchk GET /config/server/healthcheck~status HTTP/1.0\r\nHost:\ $GERRIT_MASTER_1_URL
+    option httpchk GET /config/server/healthcheck~status HTTP/1.0\r\nHost:\ $GERRIT_PRIMARY_1_URL
     http-check expect status 200
-    server gerrit-1 $GERRIT_MASTER_1_URL:8080 check inter 10s
-    server gerrit-2 $GERRIT_MASTER_2_URL:8080 check inter 10s backup
+    server gerrit-1 $GERRIT_PRIMARY_1_URL:8080 check inter 10s
+    server gerrit-2 $GERRIT_PRIMARY_2_URL:8080 check inter 10s backup
 
 backend gerrit-1
     mode http
     option forwardfor
-    server gerrit-1 $GERRIT_MASTER_1_URL:8080
+    server gerrit-1 $GERRIT_PRIMARY_1_URL:8080
 
 backend gerrit-2
     mode http
     option forwardfor
-    server gerrit-2 $GERRIT_MASTER_2_URL:8080
+    server gerrit-2 $GERRIT_PRIMARY_2_URL:8080
 
 backend ssh
     mode tcp
     option redispatch
-    option httpchk GET /config/server/healthcheck~status HTTP/1.0\r\nHost:\ $GERRIT_MASTER_1_URL
+    option httpchk GET /config/server/healthcheck~status HTTP/1.0\r\nHost:\ $GERRIT_PRIMARY_1_URL
     http-check expect status 200
     balance source
     timeout connect 10s
     timeout server 5m
-    server gerrit-ssh-1 $GERRIT_MASTER_1_URL:29418 check port 8080 inter 10s
-    server gerrit-ssh-2 $GERRIT_MASTER_2_URL:29418 check port 8080 inter 10s backup
+    server gerrit-ssh-1 $GERRIT_PRIMARY_1_URL:29418 check port 8080 inter 10s
+    server gerrit-ssh-2 $GERRIT_PRIMARY_2_URL:29418 check port 8080 inter 10s backup
 
 backend gerrit-ssh-1
     mode http
     option forwardfor
-    server gerrit-ssh-1 $GERRIT_MASTER_1_URL:29418
+    server gerrit-ssh-1 $GERRIT_PRIMARY_1_URL:29418
 
 backend gerrit-ssh-2
     mode http
     option forwardfor
-    server gerrit-ssh-2 $GERRIT_MASTER_2_URL:29418
+    server gerrit-ssh-2 $GERRIT_PRIMARY_2_URL:29418
diff --git a/dual-master/setup.env.template b/dual-primary/setup.env.template
similarity index 73%
rename from dual-master/setup.env.template
rename to dual-primary/setup.env.template
index 2867e2a..e57c9e4 100644
--- a/dual-master/setup.env.template
+++ b/dual-primary/setup.env.template
@@ -4,8 +4,8 @@
 MULTISITE_ZOOKEEPER_ROOT_NODE:=gerrit/multi-site
 
 CLUSTER_INSTANCE_TYPE:=m4.2xlarge
-SERVICE_MASTER1_STACK_NAME:=$(AWS_PREFIX)-service-master-1
-SERVICE_MASTER2_STACK_NAME:=$(AWS_PREFIX)-service-master-2
+SERVICE_PRIMARY1_STACK_NAME:=$(AWS_PREFIX)-service-primary-1
+SERVICE_PRIMARY2_STACK_NAME:=$(AWS_PREFIX)-service-primary-2
 
 REPLICATION_SERVICE_ENABLED:=false
 SERVICE_REPLICATION_STACK_NAME:=$(AWS_PREFIX)-service-replication
@@ -13,18 +13,18 @@
 GIT_REPLICATION_SUBDOMAIN:=$(AWS_PREFIX)-replication
 # REMOTE_REPLICATION_TARGET_HOST:=other-site-replication.yourcompany.com
 
-SERVICE_SLAVE_STACK_NAME:=$(AWS_PREFIX)-service-slave
-HTTP_HOST_PORT_MASTER2:=8081
-SSH_HOST_PORT_MASTER2:=29419
-HTTP_HOST_PORT_MASTER1:=8080
-SSH_HOST_PORT_MASTER1:=29418
+SERVICE_REPLICA_STACK_NAME:=$(AWS_PREFIX)-service-replica
+HTTP_HOST_PORT_PRIMARY2:=8081
+SSH_HOST_PORT_PRIMARY2:=29419
+HTTP_HOST_PORT_PRIMARY1:=8080
+SSH_HOST_PORT_PRIMARY1:=29418
 DNS_ROUTING_STACK_NAME:=$(AWS_PREFIX)-dns-routing
 DASHBOARD_STACK_NAME:=$(AWS_PREFIX)-dashboard
 LOAD_BALANCER_STACK_NAME:=$(AWS_PREFIX)-load-balancer
 HOSTED_ZONE_NAME:=yourcompany.com
-MASTER1_SUBDOMAIN:=$(AWS_PREFIX)-master-1.gerrit-demo
-MASTER2_SUBDOMAIN:=$(AWS_PREFIX)-master-2.gerrit-demo
-SLAVE_SUBDOMAIN:=$(AWS_PREFIX)-slave.gerrit-demo
+PRIMARY1_SUBDOMAIN:=$(AWS_PREFIX)-primary-1.gerrit-demo
+PRIMARY2_SUBDOMAIN:=$(AWS_PREFIX)-primary-2.gerrit-demo
+REPLICA_SUBDOMAIN:=$(AWS_PREFIX)-replica.gerrit-demo
 LB_SUBDOMAIN=$(AWS_PREFIX)-lb.gerrit-demo
 DOCKER_REGISTRY_URI:=<yourAccountId>.dkr.ecr.us-east-1.amazonaws.com
 SSL_CERTIFICATE_ARN=arn:aws:acm:us-east-1:<yourAccountId>:certificate/33e2c235-a4d1-42b7-b866-18d8d744975c
@@ -36,9 +36,9 @@
 
 FILESYSTEM_THROUGHPUT_MODE=bursting
 
-GERRIT_SLAVE_INSTANCE_ID=gerrit-dual-master-SLAVE
-GERRIT_MASTER1_INSTANCE_ID=gerrit-dual-master-MASTER1
-GERRIT_MASTER2_INSTANCE_ID=gerrit-dual-master-MASTER2
+GERRIT_REPLICA_INSTANCE_ID=gerrit-dual-primary-REPLICA
+GERRIT_PRIMARY1_INSTANCE_ID=gerrit-dual-primary-PRIMARY1
+GERRIT_PRIMARY2_INSTANCE_ID=gerrit-dual-primary-PRIMARY2
 
 LDAP_SERVER:=ldap://yourldap.yourcompany.com
 LDAP_USERNAME:=cn=admin,dc=example,dc=org
@@ -59,7 +59,7 @@
 
 HA_PROXY_MAX_COUNT:=2
 HA_PROXY_DESIRED_COUNT:=2
-MASTER_MAX_COUNT:=2
+PRIMARY_MAX_COUNT:=2
 
 GERRIT_CONTAINER_FDS_SOFT_LIMIT:=32768
 GERRIT_CONTAINER_FDS_HARD_LIMIT:=32768
diff --git a/dual-master/syslog-sidecar/Dockerfile b/dual-primary/syslog-sidecar/Dockerfile
similarity index 100%
rename from dual-master/syslog-sidecar/Dockerfile
rename to dual-primary/syslog-sidecar/Dockerfile
diff --git a/dual-master/syslog-sidecar/Makefile b/dual-primary/syslog-sidecar/Makefile
similarity index 100%
rename from dual-master/syslog-sidecar/Makefile
rename to dual-primary/syslog-sidecar/Makefile
diff --git a/dual-master/syslog-sidecar/config/syslog-ng-destination.out b/dual-primary/syslog-sidecar/config/syslog-ng-destination.out
similarity index 100%
rename from dual-master/syslog-sidecar/config/syslog-ng-destination.out
rename to dual-primary/syslog-sidecar/config/syslog-ng-destination.out
diff --git a/dual-master/syslog-sidecar/config/syslog-ng-log.out b/dual-primary/syslog-sidecar/config/syslog-ng-log.out
similarity index 100%
rename from dual-master/syslog-sidecar/config/syslog-ng-log.out
rename to dual-primary/syslog-sidecar/config/syslog-ng-log.out
diff --git a/dual-master/syslog-sidecar/config/syslog-ng-plugins.std b/dual-primary/syslog-sidecar/config/syslog-ng-plugins.std
similarity index 100%
rename from dual-master/syslog-sidecar/config/syslog-ng-plugins.std
rename to dual-primary/syslog-sidecar/config/syslog-ng-plugins.std
diff --git a/dual-master/syslog-sidecar/config/syslog-ng-source.sidecar b/dual-primary/syslog-sidecar/config/syslog-ng-source.sidecar
similarity index 100%
rename from dual-master/syslog-sidecar/config/syslog-ng-source.sidecar
rename to dual-primary/syslog-sidecar/config/syslog-ng-source.sidecar
diff --git a/dual-master/syslog-sidecar/config/syslog-ng-source.std b/dual-primary/syslog-sidecar/config/syslog-ng-source.std
similarity index 100%
rename from dual-master/syslog-sidecar/config/syslog-ng-source.std
rename to dual-primary/syslog-sidecar/config/syslog-ng-source.std
diff --git a/dual-master/syslog-sidecar/docker-entrypoint.sh b/dual-primary/syslog-sidecar/docker-entrypoint.sh
similarity index 100%
rename from dual-master/syslog-sidecar/docker-entrypoint.sh
rename to dual-primary/syslog-sidecar/docker-entrypoint.sh
diff --git a/geo-location-routing/README.md b/geo-location-routing/README.md
index f14f4ab..0ff99ed 100644
--- a/geo-location-routing/README.md
+++ b/geo-location-routing/README.md
@@ -12,7 +12,7 @@
 ### Prerequisites
 
 This recipe assumes that you do have a multi-site Gerrit deployment in two regions.
-You can refer to the [relevant documentation](../dual-master/README.md#multi-site)
+You can refer to the [relevant documentation](../dual-primary/README.md#multi-site)
 to understand how to setup Gerrit in a multi-site deployment.
 
 ### Configuration
diff --git a/geo-location-routing/setup.env.template b/geo-location-routing/setup.env.template
index f549628..b31647e 100644
--- a/geo-location-routing/setup.env.template
+++ b/geo-location-routing/setup.env.template
@@ -6,7 +6,7 @@
 DEFAULT_ALIAS_TARGET:=SITE_A
 
 SITE_A_CONTINENT_CODE:="NA"
-SITE_A_ALIAS_TARGET:=$(AWS_PREFIX)-master-site-a.gerrit-demo.yourcompany.com
+SITE_A_ALIAS_TARGET:=$(AWS_PREFIX)-primary-site-a.gerrit-demo.yourcompany.com
 
 SITE_B_CONTINENT_CODE="EU"
-SITE_B_ALIAS_TARGET:=$(AWS_PREFIX)-master-site-b.gerrit-demo.yourcompany.com
+SITE_B_ALIAS_TARGET:=$(AWS_PREFIX)-primary-site-b.gerrit-demo.yourcompany.com
diff --git a/gerrit/entrypoint.sh b/gerrit/entrypoint.sh
index 1235531..a5e1128 100755
--- a/gerrit/entrypoint.sh
+++ b/gerrit/entrypoint.sh
@@ -3,12 +3,12 @@
 /tmp/setup_gerrit.py
 git config -f /var/gerrit/etc/gerrit.config gerrit.canonicalWebUrl "${CANONICAL_WEB_URL:-http://$HOSTNAME}"
 git config -f /var/gerrit/etc/gerrit.config httpd.listenUrl "${HTTPD_LISTEN_URL:-http://*:8080/}"
-git config -f /var/gerrit/etc/gerrit.config container.slave "${CONTAINER_SLAVE:-false}"
+git config -f /var/gerrit/etc/gerrit.config container.replica "${CONTAINER_REPLICA:-false}"
 
-if [ $CONTAINER_SLAVE ]; then
-  echo "Slave mode..."
+if [ $CONTAINER_REPLICA ]; then
+  echo "Replica mode..."
 
-  echo "Ensure master specific plugins and libraries are not installed:"
+  echo "Ensure primary specific plugins and libraries are not installed:"
   for jar in "lib/multi-site.jar" "plugins/multi-site.jar" "lib/replication.jar" \
     "lib/events-broker.jar" "plugins/kafka-events.jar" "plugins/zookeeper-refdb.jar" \
     "plugins/websession-broker.jar" "plugins/high-availability.jar"
@@ -30,10 +30,10 @@
   rm -fr /var/gerrit/plugins/replication.jar
 
 else
-  echo "Master mode (init phase)..."
+  echo "Primary mode (init phase)..."
   java -jar /var/gerrit/bin/gerrit.war init --no-auto-start --batch --install-all-plugins -d /var/gerrit
   if [ $REINDEX_AT_STARTUP == "true" ]; then
-    echo "Master mode (reindex phase)..."
+    echo "Primary mode (reindex phase)..."
     java -jar /var/gerrit/bin/gerrit.war reindex -d /var/gerrit
   fi
 fi
diff --git a/gerrit/etc/replication.config.template b/gerrit/etc/replication.config.template
index 07d1067..dadc203 100644
--- a/gerrit/etc/replication.config.template
+++ b/gerrit/etc/replication.config.template
@@ -6,9 +6,9 @@
   autoReload = true
   replicateOnStartup = {{ REPLICATE_ON_STARTUP }}
 
-[remote "slave-1"]
-  url = {{ SLAVE_1_URL }}
-  adminUrl = {{ SLAVE_1_AMDIN_URL }}
+[remote "replica-1"]
+  url = {{ REPLICA_1_URL }}
+  adminUrl = {{ REPLICA_1_AMDIN_URL }}
   mirror = true
   push = +refs/*:refs/*
   threads = 10
diff --git a/gerrit/setup_gerrit.py b/gerrit/setup_gerrit.py
index f56f30e..5af5795 100755
--- a/gerrit/setup_gerrit.py
+++ b/gerrit/setup_gerrit.py
@@ -173,21 +173,21 @@
     })
     f.write(template.render(config_for_template))
 
-containerSlave = (os.getenv('CONTAINER_SLAVE') == 'true')
-if ((not containerSlave) and setupReplication):
+containerReplica = (os.getenv('CONTAINER_REPLICA') == 'true')
+if ((not containerReplica) and setupReplication):
     print("Setting Replication config in '" +
           GERRIT_CONFIG_DIRECTORY + "replication.config'")
     template = env.get_template("replication.config.template")
     with open(GERRIT_CONFIG_DIRECTORY + "replication.config", 'w', encoding='utf-8') as f:
-        SLAVE_FQDN = os.getenv('SLAVE_SUBDOMAIN') + "." + os.getenv('HOSTED_ZONE_NAME')
+        REPLICA_FQDN = os.getenv('REPLICA_SUBDOMAIN') + "." + os.getenv('HOSTED_ZONE_NAME')
         REMOTE_TARGET = os.getenv('REMOTE_REPLICATION_TARGET_HOST', '')
         # In a multi-site setup, the very first replication needs to be
         # triggered manually from site-A to site-B, once the latter is ready,
         # thus "REPLICATE_ON_STARTUP" needs to be disabled
         REPLICATE_ON_STARTUP = "false" if setupMultiSite else "true"
         f.write(template.render(
-                SLAVE_1_URL="git://" + SLAVE_FQDN + ":" + os.getenv('GIT_PORT') + "/${name}.git",
-                SLAVE_1_AMDIN_URL="ssh://gerrit@" + SLAVE_FQDN + ":" + os.getenv('GIT_SSH_PORT') + "/var/gerrit/git/${name}.git",
+                REPLICA_1_URL="git://" + REPLICA_FQDN + ":" + os.getenv('GIT_PORT') + "/${name}.git",
+                REPLICA_1_AMDIN_URL="ssh://gerrit@" + REPLICA_FQDN + ":" + os.getenv('GIT_SSH_PORT') + "/var/gerrit/git/${name}.git",
                 REMOTE_TARGET=REMOTE_TARGET,
                 REMOTE_TARGET_URL="git://" + REMOTE_TARGET + ":" + os.getenv('GIT_PORT') + "/${name}.git",
                 REMOTE_ADMIN_TARGET_URL="ssh://gerrit@" + REMOTE_TARGET + ":" + os.getenv('GIT_SSH_PORT') + "/var/gerrit/git/${name}.git",
diff --git a/maintenance/git-gc/README.md b/maintenance/git-gc/README.md
index 0d53000..2df8b40 100644
--- a/maintenance/git-gc/README.md
+++ b/maintenance/git-gc/README.md
@@ -21,7 +21,7 @@
 make [AWS_REGION=a-valid-aws-region] [AWS_PREFIX=some-cluster-prefix] delete-scheduled-gc-task
 ```
 
-The scheduled task will be executed on any master EC2 instance.
+The scheduled task will be executed on any primary EC2 instance.
 You will need to account for this when deciding the instance type and the
 allocated CPU and Memory running on those EC2 instances.
 
diff --git a/maintenance/git-gc/cf-task-git-gc.yml b/maintenance/git-gc/cf-task-git-gc.yml
index 7e48cf1..39858b7 100644
--- a/maintenance/git-gc/cf-task-git-gc.yml
+++ b/maintenance/git-gc/cf-task-git-gc.yml
@@ -43,7 +43,7 @@
             ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             NetworkMode: bridge
             PlacementConstraints:
-                - Expression: !Sub 'attribute:target_group =~ master.*'
+                - Expression: !Sub 'attribute:target_group =~ primary.*'
                   Type: "memberOf"
             ContainerDefinitions:
                 - Name: !FindInMap ['GitGC', 'Task', 'Name']
@@ -117,7 +117,7 @@
         ScheduleExpression: !Sub "cron(${ScheduleCronExpression})"
         State: ENABLED
         Targets:
-          - Id: git-gc-master
+          - Id: git-gc-primary
             RoleArn: !GetAtt EventsInvokeTaskRole.Arn
             EcsParameters:
               TaskDefinitionArn: !Ref TaskDefinition
diff --git a/master-slave/cf-dns-route.yml b/master-slave/cf-dns-route.yml
deleted file mode 100644
index 9f6234b..0000000
--- a/master-slave/cf-dns-route.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-AWSTemplateFormatVersion: '2010-09-09'
-Description: A stack for the Gerrit service Route53 routing.
-Parameters:
-  MasterServiceStackName:
-      Description: Stack name of the ECS Master Gerrit service
-      Type: String
-      Default: gerrit-service-master
-  SlaveServiceStackName:
-      Description: Stack name of the ECS Slave Gerrit service
-      Type: String
-      Default: gerrit-service-slave
-
-Resources:
-  MasterDnsRecord:
-      Type: AWS::Route53::RecordSet
-      Properties:
-        Name:
-          !Join
-            - '.'
-            - - Fn::ImportValue: !Join [':', [!Ref 'MasterServiceStackName', 'Subdomain']]
-              - Fn::ImportValue: !Join [':', [!Ref 'MasterServiceStackName', 'HostedZoneName']]
-        HostedZoneName:
-          !Join
-            - ''
-            - - Fn::ImportValue: !Join [':', [!Ref 'MasterServiceStackName', 'HostedZoneName']]
-              - '.'
-        Comment: DNS name for Gerrit Master.
-        Type: A
-        AliasTarget:
-          DNSName:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'MasterServiceStackName', 'PublicLoadBalancerDNSName']]
-          HostedZoneId:
-            Fn::ImportValue:
-              !Join [':', [!Ref 'MasterServiceStackName', 'CanonicalHostedZoneID']]
-          EvaluateTargetHealth: False
diff --git a/monitoring/Makefile b/monitoring/Makefile
index 5e1cc89..1701db5 100644
--- a/monitoring/Makefile
+++ b/monitoring/Makefile
@@ -35,8 +35,8 @@
 		--parameters \
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
 		ParameterKey=PrometheusStackName,ParameterValue=$(SERVICE_PROMETHEUS_STACK_NAME) \
-		ParameterKey=MasterStackName,ParameterValue=$(SERVICE_MASTER_STACK_NAME) \
-		ParameterKey=SlaveStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME) \
+		ParameterKey=PrimaryStackName,ParameterValue=$(SERVICE_PRIMARY_STACK_NAME) \
+		ParameterKey=ReplicaStackName,ParameterValue=$(SERVICE_REPLICA_STACK_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
 		ParameterKey=Subdomain,ParameterValue=$(GRAFANA_SUBDOMAIN) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
diff --git a/monitoring/README.md b/monitoring/README.md
index f454504..5257feb 100644
--- a/monitoring/README.md
+++ b/monitoring/README.md
@@ -4,7 +4,7 @@
 stack.
 
 The stack includes Prometheus, to scrape Gerrit metrics
-exposed by master and slave, and Grafana to display them.
+exposed by primary and replica, and Grafana to display them.
 
 ## Prerequisites
 
diff --git a/monitoring/cf-service-grafana.yml b/monitoring/cf-service-grafana.yml
index a159f6f..3771737 100644
--- a/monitoring/cf-service-grafana.yml
+++ b/monitoring/cf-service-grafana.yml
@@ -7,12 +7,12 @@
     PrometheusStackName:
         Type: String
         Default: gerrit-prometheus
-    MasterStackName:
+    PrimaryStackName:
         Type: String
-        Default: gerrit-master
-    SlaveStackName:
+        Default: gerrit-primary
+    ReplicaStackName:
         Type: String
-        Default: gerrit-slave
+        Default: gerrit-replica
     ClusterStackName:
         Description: Stack name of the ECS cluster to deploy the serivces
         Type: String
@@ -83,18 +83,18 @@
                         Value: !Ref AWS::Region
                       - Name: GRAFANA_DOMAIN
                         Value: !Sub '${Subdomain}.${HostedZoneName}'
-                      - Name: MASTER_URL
+                      - Name: PRIMARY_URL
                         Value:
                           !Join
                             - '.'
-                            - - Fn::ImportValue: !Join [':', [!Ref 'MasterStackName', 'Subdomain']]
-                              - Fn::ImportValue: !Join [':', [!Ref 'MasterStackName', 'HostedZoneName']]
-                      - Name: SLAVE_URL
+                            - - Fn::ImportValue: !Join [':', [!Ref 'PrimaryStackName', 'Subdomain']]
+                              - Fn::ImportValue: !Join [':', [!Ref 'PrimaryStackName', 'HostedZoneName']]
+                      - Name: REPLICA_URL
                         Value:
                           !Join
                             - '.'
-                            - - Fn::ImportValue: !Join [':', [!Ref 'SlaveStackName', 'Subdomain']]
-                              - Fn::ImportValue: !Join [':', [!Ref 'SlaveStackName', 'HostedZoneName']]
+                            - - Fn::ImportValue: !Join [':', [!Ref 'ReplicaStackName', 'Subdomain']]
+                              - Fn::ImportValue: !Join [':', [!Ref 'ReplicaStackName', 'HostedZoneName']]
                       - Name: PROMETHEUS_URL
                         Value:
                           Fn::ImportValue:
diff --git a/monitoring/grafana/dashboards/Gerrit.json b/monitoring/grafana/dashboards/Gerrit.json
index 45d41e4..3afb9f2 100644
--- a/monitoring/grafana/dashboards/Gerrit.json
+++ b/monitoring/grafana/dashboards/Gerrit.json
@@ -82,7 +82,7 @@
       "tableColumn": "",
       "targets": [
         {
-          "expr": "max_over_time(sshd_sessions_connected{instance=\"{{MASTER_URL}}:443\"}[$Window])",
+          "expr": "max_over_time(sshd_sessions_connected{instance=\"{{PRIMARY_URL}}:443\"}[$Window])",
           "format": "time_series",
           "instant": true,
           "interval": "",
@@ -92,7 +92,7 @@
         }
       ],
       "thresholds": "30,60",
-      "title": "SSH Conn master",
+      "title": "SSH Conn primary",
       "type": "singlestat",
       "valueFontSize": "80%",
       "valueMaps": [
@@ -166,7 +166,7 @@
       "tableColumn": "env",
       "targets": [
         {
-          "expr": "max_over_time(sshd_sessions_connected{instance=\"{{SLAVE_URL}}:443\"}[$Window])",
+          "expr": "max_over_time(sshd_sessions_connected{instance=\"{{REPLICA_URL}}:443\"}[$Window])",
           "format": "time_series",
           "instant": true,
           "intervalFactor": 1,
@@ -174,7 +174,7 @@
         }
       ],
       "thresholds": "30,60",
-      "title": "SSH Conn slave",
+      "title": "SSH Conn replica",
       "type": "singlestat",
       "valueFontSize": "80%",
       "valueMaps": [
diff --git a/monitoring/grafana/entrypoint.sh b/monitoring/grafana/entrypoint.sh
index a474d2a..40a323d 100644
--- a/monitoring/grafana/entrypoint.sh
+++ b/monitoring/grafana/entrypoint.sh
@@ -3,7 +3,7 @@
 echo "Updating Grafana templates..."
 sed -i -e "s|{{DOMAIN}}|$GRAFANA_DOMAIN|g" /etc/grafana/config.ini
 sed -i -e "s|{{PROMETHEUS_URL}}|$PROMETHEUS_URL|g" /etc/grafana/provisioning/datasources/prometheus.yml
-sed -i -e "s|{{MASTER_URL}}|$MASTER_URL|g" /var/lib/grafana/dashboards/Gerrit.json
-sed -i -e "s|{{SLAVE_URL}}|$SLAVE_URL|g" /var/lib/grafana/dashboards/Gerrit.json
+sed -i -e "s|{{PRIMARY_URL}}|$PRIMARY_URL|g" /var/lib/grafana/dashboards/Gerrit.json
+sed -i -e "s|{{REPLICA_URL}}|$REPLICA_URL|g" /var/lib/grafana/dashboards/Gerrit.json
 
 /run.sh
diff --git a/monitoring/prometheus/prometheus.yml b/monitoring/prometheus/prometheus.yml
index f9e0f57..000ae9a 100644
--- a/monitoring/prometheus/prometheus.yml
+++ b/monitoring/prometheus/prometheus.yml
@@ -14,7 +14,7 @@
     - targets: ['localhost:9090']
 
 
-  - job_name: 'gerrit-master-javamelody'
+  - job_name: 'gerrit-primary-javamelody'
 
     scheme: https
     metrics_path: '/monitoring'
@@ -27,11 +27,11 @@
     scrape_interval: 1s
 
     static_configs:
-      - targets: ['gerrit-master.gerrit-demo.gerritforgeaws.com:443']
+      - targets: ['gerrit-primary.gerrit-demo.gerritforgeaws.com:443']
         labels:
           env: 'unit'
 
-  - job_name: 'gerrit-master-metrics'
+  - job_name: 'gerrit-primary-metrics'
 
     scheme: https
     metrics_path: '/plugins/metrics-reporter-prometheus/metrics'
@@ -44,11 +44,11 @@
     scrape_interval: 5s
 
     static_configs:
-      - targets: ['gerrit-master.gerrit-demo.gerritforgeaws.com:443']
+      - targets: ['gerrit-primary.gerrit-demo.gerritforgeaws.com:443']
         labels:
           env: 'unit'
 
-  - job_name: 'gerrit-slave-javamelody'
+  - job_name: 'gerrit-replica-javamelody'
 
     scheme: https
     metrics_path: '/monitoring'
@@ -61,11 +61,11 @@
     scrape_interval: 1s
 
     static_configs:
-      - targets: ['gerrit-slave.gerrit-demo.gerritforgeaws.com:443']
+      - targets: ['gerrit-replica.gerrit-demo.gerritforgeaws.com:443']
         labels:
           env: 'unit'
 
-  - job_name: 'gerrit-slave-metrics'
+  - job_name: 'gerrit-replica-metrics'
 
     scheme: https
     metrics_path: '/plugins/metrics-reporter-prometheus/metrics'
@@ -78,6 +78,6 @@
     scrape_interval: 5s
 
     static_configs:
-      - targets: ['gerrit-slave.gerrit-demo.gerritforgeaws.com:443']
+      - targets: ['gerrit-replica.gerrit-demo.gerritforgeaws.com:443']
         labels:
           env: 'unit'
diff --git a/master-slave/Makefile b/primary-replica/Makefile
similarity index 66%
rename from master-slave/Makefile
rename to primary-replica/Makefile
index 8e8e93f..16883aa 100644
--- a/master-slave/Makefile
+++ b/primary-replica/Makefile
@@ -4,18 +4,18 @@
 include ../maintenance/git-gc/Makefile
 
 CLUSTER_TEMPLATE:=cf-cluster.yml
-SERVICE_MASTER_TEMPLATE:=cf-service-master.yml
-SERVICE_SLAVE_TEMPLATE:=cf-service-slave.yml
+SERVICE_PRIMARY_TEMPLATE:=cf-service-primary.yml
+SERVICE_REPLICA_TEMPLATE:=cf-service-replica.yml
 DNS_ROUTING_TEMPLATE:=cf-dns-route.yml
 CLOUDWATCH_DASHBOARD_TEMPLATE:=cf-dashboard.yml
 AWS_FC_COMMAND=export AWS_PAGER=;aws cloudformation
 GIT_GC_SOURCE_PATH=/gerrit-mount-point/gerrit-git
 
 .PHONY: create-all delete-all \
-				cluster cluster-keys service-master service-slave dns-routing dashboard \
-				delete-cluster delete-service-master delete-service-slave delete-dns-routing delete-dashboard \
-				wait-for-cluster-creation wait-for-service-master-creation wait-for-dns-routing-creation wait-for-dashboard \
-				wait-for-cluster-deletion wait-for-service-master-deletion wait-for-dns-routing-deletion wait-for-dashboard-deletion \
+				cluster cluster-keys service-primary service-replica dns-routing dashboard \
+				delete-cluster delete-service-primary delete-service-replica delete-dns-routing delete-dashboard \
+				wait-for-cluster-creation wait-for-service-primary-creation wait-for-dns-routing-creation wait-for-dashboard \
+				wait-for-cluster-deletion wait-for-service-primary-deletion wait-for-dns-routing-deletion wait-for-dashboard-deletion \
 				gerrit-build gerrit-publish
 
 ifeq ($(METRICS_CLOUDWATCH_ENABLED),true)
@@ -25,13 +25,13 @@
 create-all: upload-common-templates \
 						gerrit-publish git-daemon-publish git-ssh-publish \
 						cluster wait-for-cluster-creation \
-						service-slave service-master \
-						wait-for-service-master-creation wait-for-service-slave-creation \
+						service-replica service-primary \
+						wait-for-service-primary-creation wait-for-service-replica-creation \
 						$(optional_dashboard_targets) \
 						$(optional_git_gc_targets_creation) \
 						dns-routing wait-for-dns-routing-creation
 
-cluster: cluster-keys set-optional-gerrit-master-volume
+cluster: cluster-keys set-optional-gerrit-primary-volume
 ifdef CLUSTER_INSTANCE_TYPE
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=InstanceType,ParameterValue=$(CLUSTER_INSTANCE_TYPE))
 endif
@@ -41,8 +41,8 @@
 ifdef VPC_CIDR
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=VPCCIDR,ParameterValue=$(VPC_CIDR))
 endif
-ifdef MASTER_MAX_COUNT
-		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=MasterMaxCount,ParameterValue=$(MASTER_MAX_COUNT))
+ifdef PRIMARY_MAX_COUNT
+		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=PrimaryMaxCount,ParameterValue=$(PRIMARY_MAX_COUNT))
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
@@ -57,20 +57,20 @@
 		ParameterKey=VPCIdProp,ParameterValue=$(VPC_ID) \
 		ParameterKey=SubnetIdProp,ParameterValue=$(SUBNET_ID) \
 		$(CLUSTER_OPTIONAL_PARAMS) \
-		$(GERRIT_OPTIONAL_MASTER_VOLUME)
+		$(GERRIT_OPTIONAL_PRIMARY_VOLUME)
 
-service-master: set-optional-params-metrics-cloudwatch set-optional-params-smtp set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
+service-primary: set-optional-params-metrics-cloudwatch set-optional-params-smtp set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
 ifdef LOAD_BALANCER_SCHEME
-		$(eval MASTER_SERVICE_OPTIONAL_PARAMS := $(MASTER_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
+		$(eval PRIMARY_SERVICE_OPTIONAL_PARAMS := $(PRIMARY_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
 endif
-ifdef GERRIT_MASTER_INSTANCE_ID
-		$(eval MASTER_SERVICE_OPTIONAL_PARAMS := $(MASTER_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_MASTER_INSTANCE_ID))
+ifdef GERRIT_PRIMARY_INSTANCE_ID
+		$(eval PRIMARY_SERVICE_OPTIONAL_PARAMS := $(PRIMARY_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_PRIMARY_INSTANCE_ID))
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
-		--stack-name $(SERVICE_MASTER_STACK_NAME) \
+		--stack-name $(SERVICE_PRIMARY_STACK_NAME) \
 		--capabilities CAPABILITY_IAM  \
-		--template-body file://`pwd`/$(SERVICE_MASTER_TEMPLATE) \
+		--template-body file://`pwd`/$(SERVICE_PRIMARY_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
 		ParameterKey=LDAPServer,ParameterValue=$(LDAP_SERVER) \
@@ -83,11 +83,11 @@
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
 		ParameterKey=TemplateBucketName,ParameterValue=$(TEMPLATE_BUCKET_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
-		ParameterKey=Subdomain,ParameterValue=$(MASTER_SUBDOMAIN) \
-		ParameterKey=SlaveSubdomain,ParameterValue=$(SLAVE_SUBDOMAIN) \
+		ParameterKey=Subdomain,ParameterValue=$(PRIMARY_SUBDOMAIN) \
+		ParameterKey=ReplicaSubdomain,ParameterValue=$(REPLICA_SUBDOMAIN) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
-		ParameterKey=SlaveServiceStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME) \
+		ParameterKey=ReplicaServiceStackName,ParameterValue=$(SERVICE_REPLICA_STACK_NAME) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
 		ParameterKey=DockerImage,ParameterValue=aws-gerrit/gerrit:$(IMAGE_TAG) \
 		ParameterKey=GerritRAM,ParameterValue=$(GERRIT_RAM) \
@@ -96,24 +96,24 @@
 		ParameterKey=JgitCacheSize,ParameterValue=$(JGIT_CACHE_SIZE) \
 		$(JGIT_OPTIONAL_PARAMS) \
 		$(LDAP_ACCOUNT_PATTERN_PARAM) \
-		$(MASTER_SERVICE_OPTIONAL_PARAMS) \
+		$(PRIMARY_SERVICE_OPTIONAL_PARAMS) \
 		$(METRICS_CW_OPTIONAL_PARAMS) \
 		$(SMTP_OPTIONAL_PARAMS) \
 		$(GERRIT_ULIMITS)
 
 
-service-slave: set-optional-params-metrics-cloudwatch set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
+service-replica: set-optional-params-metrics-cloudwatch set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
 ifdef LOAD_BALANCER_SCHEME
-		$(eval SLAVE_SERVICE_OPTIONAL_PARAMS := $(SLAVE_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
+		$(eval REPLICA_SERVICE_OPTIONAL_PARAMS := $(REPLICA_SERVICE_OPTIONAL_PARAMS) ParameterKey=LoadBalancerScheme,ParameterValue=$(LOAD_BALANCER_SCHEME))
 endif
-ifdef GERRIT_SLAVE_INSTANCE_ID
-		$(eval SLAVE_SERVICE_OPTIONAL_PARAMS := $(SLAVE_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_SLAVE_INSTANCE_ID))
+ifdef GERRIT_REPLICA_INSTANCE_ID
+		$(eval REPLICA_SERVICE_OPTIONAL_PARAMS := $(REPLICA_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_REPLICA_INSTANCE_ID))
 endif
 
 	$(AWS_FC_COMMAND) create-stack \
-		--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+		--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 		--capabilities CAPABILITY_IAM  \
-		--template-body file://`pwd`/$(SERVICE_SLAVE_TEMPLATE) \
+		--template-body file://`pwd`/$(SERVICE_REPLICA_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
 		ParameterKey=LDAPServer,ParameterValue=$(LDAP_SERVER) \
@@ -123,7 +123,7 @@
 		ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
 		ParameterKey=TemplateBucketName,ParameterValue=$(TEMPLATE_BUCKET_NAME) \
 		ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
-		ParameterKey=Subdomain,ParameterValue=$(SLAVE_SUBDOMAIN) \
+		ParameterKey=Subdomain,ParameterValue=$(REPLICA_SUBDOMAIN) \
 		ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
@@ -134,7 +134,7 @@
 		ParameterKey=JgitCacheSize,ParameterValue=$(JGIT_CACHE_SIZE) \
 		$(JGIT_OPTIONAL_PARAMS) \
 		$(LDAP_ACCOUNT_PATTERN_PARAM) \
-		$(SLAVE_SERVICE_OPTIONAL_PARAMS) \
+		$(REPLICA_SERVICE_OPTIONAL_PARAMS) \
 		$(METRICS_CW_OPTIONAL_PARAMS) \
 		$(GERRIT_ULIMITS)
 
@@ -145,16 +145,16 @@
 		--template-body file://`pwd`/$(DNS_ROUTING_TEMPLATE) \
 		--region $(AWS_REGION) \
 		--parameters \
-		ParameterKey=MasterServiceStackName,ParameterValue=$(SERVICE_MASTER_STACK_NAME) \
-		ParameterKey=SlaveServiceStackName,ParameterValue=$(SERVICE_SLAVE_STACK_NAME)
+		ParameterKey=PrimaryServiceStackName,ParameterValue=$(SERVICE_PRIMARY_STACK_NAME) \
+		ParameterKey=ReplicaServiceStackName,ParameterValue=$(SERVICE_REPLICA_STACK_NAME)
 
 dashboard:
 ifeq ($(METRICS_CLOUDWATCH_ENABLED),true)
-ifdef GERRIT_MASTER_INSTANCE_ID
-	$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=MasterInstanceId,ParameterValue=$(GERRIT_MASTER_INSTANCE_ID))
+ifdef GERRIT_PRIMARY_INSTANCE_ID
+	$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=PrimaryInstanceId,ParameterValue=$(GERRIT_PRIMARY_INSTANCE_ID))
 endif
-ifdef GERRIT_SLAVE_INSTANCE_ID
-	$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=SlaveInstanceId,ParameterValue=$(GERRIT_SLAVE_INSTANCE_ID))
+ifdef GERRIT_REPLICA_INSTANCE_ID
+	$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=ReplicaInstanceId,ParameterValue=$(GERRIT_REPLICA_INSTANCE_ID))
 endif
 ifdef METRICS_CLOUDWATCH_NAMESPACE
 	$(eval DASHBOARD_OPTIONAL_PARAMS := $(DASHBOARD_OPTIONAL_PARAMS) ParameterKey=MetricsCloudwatchNamespace,ParameterValue=$(METRICS_CLOUDWATCH_NAMESPACE))
@@ -180,19 +180,19 @@
 	--region $(AWS_REGION)
 	@echo "*** Cluster stack '$(CLUSTER_STACK_NAME)' created"
 
-wait-for-service-master-creation:
-	@echo "*** Wait for service master stack '$(SERVICE_MASTER_STACK_NAME)' creation"
+wait-for-service-primary-creation:
+	@echo "*** Wait for service primary stack '$(SERVICE_PRIMARY_STACK_NAME)' creation"
 	$(AWS_FC_COMMAND) wait stack-create-complete \
-	--stack-name $(SERVICE_MASTER_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack '$(SERVICE_MASTER_STACK_NAME)' created"
+	@echo "*** Service stack '$(SERVICE_PRIMARY_STACK_NAME)' created"
 
-wait-for-service-slave-creation:
-	@echo "*** Wait for service slave stack '$(SERVICE_SLAVE_STACK_NAME)' creation"
+wait-for-service-replica-creation:
+	@echo "*** Wait for service replica stack '$(SERVICE_REPLICA_STACK_NAME)' creation"
 	$(AWS_FC_COMMAND) wait stack-create-complete \
-	--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+	--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack '$(SERVICE_SLAVE_STACK_NAME)' created"
+	@echo "*** Service stack '$(SERVICE_REPLICA_STACK_NAME)' created"
 
 wait-for-dns-routing-creation:
 	@echo "*** Wait for DNS routing stack '$(DNS_ROUTING_STACK_NAME)' creation"
@@ -215,19 +215,19 @@
 	--region $(AWS_REGION)
 	@echo "*** Cluster stack '$(CLUSTER_STACK_NAME)' deleted"
 
-wait-for-service-master-deletion:
-	@echo "*** Wait for service master stack '$(SERVICE_MASTER_STACK_NAME)' deletion"
+wait-for-service-primary-deletion:
+	@echo "*** Wait for service primary stack '$(SERVICE_PRIMARY_STACK_NAME)' deletion"
 	$(AWS_FC_COMMAND) wait stack-delete-complete \
-	--stack-name $(SERVICE_MASTER_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack master '$(SERVICE_MASTER_STACK_NAME)' deleted"
+	@echo "*** Service stack primary '$(SERVICE_PRIMARY_STACK_NAME)' deleted"
 
-wait-for-service-slave-deletion:
-	@echo "*** Wait for service master stack '$(SERVICE_SLAVE_STACK_NAME)' deletion"
+wait-for-service-replica-deletion:
+	@echo "*** Wait for service primary stack '$(SERVICE_REPLICA_STACK_NAME)' deletion"
 	$(AWS_FC_COMMAND) wait stack-delete-complete \
-	--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+	--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 	--region $(AWS_REGION)
-	@echo "*** Service stack master '$(SERVICE_SLAVE_STACK_NAME)' deleted"
+	@echo "*** Service stack primary '$(SERVICE_REPLICA_STACK_NAME)' deleted"
 
 wait-for-dns-routing-deletion:
 	@echo "*** Wait for DNS routing stack '$(DNS_ROUTING_STACK_NAME)' deletion"
@@ -248,14 +248,14 @@
 	--stack-name $(CLUSTER_STACK_NAME) \
 	--region $(AWS_REGION)
 
-delete-service-master:
+delete-service-primary:
 	$(AWS_FC_COMMAND) delete-stack \
-	--stack-name $(SERVICE_MASTER_STACK_NAME) \
+	--stack-name $(SERVICE_PRIMARY_STACK_NAME) \
 	--region $(AWS_REGION)
 
-delete-service-slave:
+delete-service-replica:
 	$(AWS_FC_COMMAND) delete-stack \
-	--stack-name $(SERVICE_SLAVE_STACK_NAME) \
+	--stack-name $(SERVICE_REPLICA_STACK_NAME) \
 	--region $(AWS_REGION)
 
 delete-dns-routing:
@@ -269,14 +269,14 @@
 	--region $(AWS_REGION)
 
 delete-all: delete-dns-routing wait-for-dns-routing-deletion \
-						delete-service-slave wait-for-service-slave-deletion \
-						delete-service-master wait-for-service-master-deletion \
+						delete-service-replica wait-for-service-replica-deletion \
+						delete-service-primary wait-for-service-primary-deletion \
 						delete-cluster wait-for-cluster-deletion \
 						$(optional_git_gc_targets_deletion) \
 						delete-dashboard wait-for-dashboard-deletion
 
 gerrit-publish:
-	$(MAKE) -C ../gerrit gerrit-publish RECIPE=master-slave
+	$(MAKE) -C ../gerrit gerrit-publish RECIPE=primary-replica
 
 git-daemon-publish:
 	$(MAKE) -C git-daemon git-daemon-publish
@@ -285,10 +285,10 @@
 	$(MAKE) -C git-ssh git-ssh-publish
 
 prometheus-publish:
-	$(MAKE) -C ../monitoring/prometheus prometheus-publish RECIPE=master-slave
+	$(MAKE) -C ../monitoring/prometheus prometheus-publish RECIPE=primary-replica
 
 grafana-publish:
-	$(MAKE) -C ../monitoring/grafana grafana-publish RECIPE=master-slave
+	$(MAKE) -C ../monitoring/grafana grafana-publish RECIPE=primary-replica
 
 service-monitoring:
-	$(MAKE) -C ../monitoring service-monitoring RECIPE=master-slave
+	$(MAKE) -C ../monitoring service-monitoring RECIPE=primary-replica
diff --git a/master-slave/README.md b/primary-replica/README.md
similarity index 74%
rename from master-slave/README.md
rename to primary-replica/README.md
index a288fae..a6f7e73 100644
--- a/master-slave/README.md
+++ b/primary-replica/README.md
@@ -1,14 +1,14 @@
-# Gerrit Master-Slave
+# Gerrit Primary-Replica
 
-This set of Templates provide all the components to deploy a single Gerrit master
-and a single Gerrit slave in ECS
+This set of Templates provide all the components to deploy a single Gerrit primary
+and a single Gerrit replica in ECS
 
 ## Architecture
 
 Five templates are provided in this example:
 * `cf-cluster`: define the ECS cluster and the networking stack
-* `cf-service-master`: define the service stack running Gerrit master
-* `cf-service-slave`: define the service stack running Gerrit slave
+* `cf-service-primary`: define the service stack running Gerrit primary
+* `cf-service-replica`: define the service stack running Gerrit replica
 * `cf-dns-route`: define the DNS routing for the service
 * `cf-dashboard`: define the CloudWatch dashboard for the services
 
@@ -20,15 +20,15 @@
 * 1 public Subnets:
  * CIDR: 10.0.0.0/24
 * 1 public NLB exposing:
- * Gerrit master HTTP on port 8080
- * Gerrit master SSH on port 29418
+ * Gerrit primary HTTP on port 8080
+ * Gerrit primary SSH on port 29418
 * 1 public NLB exposing:
- * Gerrit slave HTTP on port 8081
- * Gerrit slave SSH on port 39418
+ * Gerrit replica HTTP on port 8081
+ * Gerrit replica SSH on port 39418
  * SSH agent on port 1022
  * Git daemon on port 9418
 * 1 Internet Gateway
-* 2 type A alias DNS entry, for Gerrit master and slave
+* 2 type A alias DNS entry, for Gerrit primary and replica
 * A SSL certificate available in [AWS Certificate Manager](https://aws.amazon.com/certificate-manager/)
 
 ### Data persistency
@@ -71,15 +71,15 @@
 
 Configuration values affecting deployment environment and cluster properties
 
-* `SERVICE_MASTER_STACK_NAME`: Optional. Name of the master service stack. `gerrit-service-master` by default.
-* `SERVICE_SLAVE_STACK_NAME`: Optional. Name of the slave service stack. `gerrit-service-slave` by default.
+* `SERVICE_PRIMARY_STACK_NAME`: Optional. Name of the primary service stack. `gerrit-service-primary` by default.
+* `SERVICE_REPLICA_STACK_NAME`: Optional. Name of the replica service stack. `gerrit-service-replica` by default.
 * `DASHBOARD_STACK_NAME` : Optional. Name of the dashboard stack. `gerrit-dashboard` by default.
-* `MASTER_SUBDOMAIN`: Optional. Name of the master sub domain. `gerrit-master-demo` by default.
-* `SLAVE_SUBDOMAIN`: Optional. Name of the slave sub domain. `gerrit-slave-demo` by default.
-* `GERRIT_MASTER_INSTANCE_ID`: Optional. Identifier for the Gerrit master instance.
-"gerrit-master-slave-MASTER" by default.
-* `GERRIT_SLAVE_INSTANCE_ID`: Optional. Identifier for the Gerrit slave instance.
-"gerrit-master-slave-SLAVE" by default.
+* `PRIMARY_SUBDOMAIN`: Optional. Name of the primary sub domain. `gerrit-primary-demo` by default.
+* `REPLICA_SUBDOMAIN`: Optional. Name of the replica sub domain. `gerrit-replica-demo` by default.
+* `GERRIT_PRIMARY_INSTANCE_ID`: Optional. Identifier for the Gerrit primary instance.
+"gerrit-primary-replica-PRIMARY" by default.
+* `GERRIT_REPLICA_INSTANCE_ID`: Optional. Identifier for the Gerrit replica instance.
+"gerrit-primary-replica-REPLICA" by default.
 * `GERRIT_VOLUME_ID` : Optional. Id of an extisting EBS volume. If empty, a new volume
 for Gerrit data will be created
 * `GERRIT_VOLUME_SNAPSHOT_ID` : Optional. Ignored if GERRIT_VOLUME_ID is not empty. Id of
@@ -87,7 +87,7 @@
 * `GERRIT_VOLUME_SIZE_IN_GIB`: Optional. The size of the Gerrit data volume, in GiBs. `10` by default.
 
 *NOTE*: if you are planning to run the monitoring stack, set the
-`MASTER_MAX_COUNT` value to at least 2. The resources provided by
+`PRIMARY_MAX_COUNT` value to at least 2. The resources provided by
 a single EC2 instance won't be enough for all the services that will be ran*
 
 * `PROMETHEUS_SUBDOMAIN`: Optional. Prometheus subdomain. For example: `<AWS_PREFIX>-prometheus`
@@ -126,30 +126,30 @@
 
 ### Access your Gerrit instances
 
-Get the URL of your Gerrit master instance this way:
+Get the URL of your Gerrit primary instance this way:
 
 ```
 aws cloudformation describe-stacks \
-  --stack-name <SERVICE_MASTER_STACK_NAME> \
+  --stack-name <SERVICE_PRIMARY_STACK_NAME> \
   | grep -A1 '"OutputKey": "CanonicalWebUrl"' \
   | grep OutputValue \
   | cut -d'"' -f 4
 ```
 
-Similarly for the slave:
+Similarly for the replica:
 ```
 aws cloudformation describe-stacks \
-  --stack-name <SERVICE_SLAVE_STACK_NAME> \
+  --stack-name <SERVICE_REPLICA_STACK_NAME> \
   | grep -A1 '"OutputKey": "CanonicalWebUrl"' \
   | grep OutputValue \
   | cut -d'"' -f 4
 ```
 
-Gerrit master instance ports:
+Gerrit primary instance ports:
 * HTTP `8080`
 * SSH `29418`
 
-Gerrit slave instance ports:
+Gerrit replica instance ports:
 * HTTP `9080`
 * SSH `39418`
 
diff --git a/master-slave/cf-cluster.yml b/primary-replica/cf-cluster.yml
similarity index 93%
rename from master-slave/cf-cluster.yml
rename to primary-replica/cf-cluster.yml
index 1775c63..c9cd2a7 100644
--- a/master-slave/cf-cluster.yml
+++ b/primary-replica/cf-cluster.yml
@@ -6,8 +6,8 @@
   TemplateBucketName:
     Description: S3 bucket containing cloudformation templates
     Type: String
-  MasterMaxCount:
-    Description: The maximum number of EC2 instances in the master autoscaling group
+  PrimaryMaxCount:
+    Description: The maximum number of EC2 instances in the primary autoscaling group
     Type: Number
   ECSAMI:
     Description: AMI ID
@@ -93,14 +93,14 @@
           LogGroupName: !Ref AWS::StackName
           RetentionInDays: 14
 
-  MasterASG:
+  PrimaryASG:
     Type: AWS::AutoScaling::AutoScalingGroup
     Properties:
       VPCZoneIdentifier:
         - !GetAtt ECSTaskNetworkStack.Outputs.PublicSubnetOneRef
-      LaunchConfigurationName: !Ref 'MasterLaunchConfiguration'
+      LaunchConfigurationName: !Ref 'PrimaryLaunchConfiguration'
       MinSize: '1'
-      MaxSize: !Ref MasterMaxCount
+      MaxSize: !Ref PrimaryMaxCount
       DesiredCapacity: '1'
     CreationPolicy:
       ResourceSignal:
@@ -109,7 +109,7 @@
       AutoScalingReplacingUpdate:
         WillReplace: 'true'
 
-  MasterLaunchConfiguration:
+  PrimaryLaunchConfiguration:
     Type: AWS::AutoScaling::LaunchConfiguration
     Properties:
       ImageId: !Ref 'ECSAMI'
@@ -121,7 +121,7 @@
         Fn::Base64: !Sub |
           #!/bin/bash -xe
           echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
-          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"master\"} >> /etc/ecs/ecs.config
+          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"primary\"} >> /etc/ecs/ecs.config
           # Make sure latest version of the helper scripts are installed as per recommendation:
           # https://github.com/awsdocs/aws-cloudformation-user-guide/blob/master/doc_source/cfn-helper-scripts-reference.md#using-the-latest-version
           yum install -y aws-cfn-bootstrap wget aws-cli xfsprogs
@@ -175,27 +175,27 @@
                     [
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/replication_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/master/replication_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/primary/replication_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/httpd_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/master/httpd_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/primary/httpd_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/sshd_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/master/sshd_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/primary/sshd_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/gc_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/master/gc_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/primary/gc_log\",
                       \"timezone\": \"UTC\"
                       },
                       {\"file_path\": \"/gerrit-mount-point/gerrit-logs/audit_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/master/audit_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/primary/audit_log\",
                       \"timezone\": \"UTC\"
                       }
                     ]
@@ -208,7 +208,7 @@
           rpm -U ./amazon-cloudwatch-agent.rpm
           /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/home/ec2-user/gerritlogsaccess.json -s
           # Signal to CloudFormation aws-cfn-bootstrap has been correctly updated
-          /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource MasterASG --region ${AWS::Region}
+          /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource PrimaryASG --region ${AWS::Region}
 
 
   ReplicaASG:
@@ -251,29 +251,29 @@
                 {\"files\":
                   {\"collect_list\":
                     [
-                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-slave/_data/replication_log\",
+                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-replica/_data/replication_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/slave/replication_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/replica/replication_log\",
                       \"timezone\": \"UTC\"
                       },
-                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-slave/_data/httpd_log\",
+                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-replica/_data/httpd_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/slave/httpd_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/replica/httpd_log\",
                       \"timezone\": \"UTC\"
                       },
-                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-slave/_data/sshd_log\",
+                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-replica/_data/sshd_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/slave/sshd_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/replica/sshd_log\",
                       \"timezone\": \"UTC\"
                       },
-                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-slave/_data/gc_log\",
+                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-replica/_data/gc_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/slave/gc_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/replica/gc_log\",
                       \"timezone\": \"UTC\"
                       },
-                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-slave/_data/audit_log\",
+                      {\"file_path\": \"/var/lib/docker/volumes/gerrit-logs-replica/_data/audit_log\",
                       \"log_group_name\": \"${AWS::StackName}\",
-                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/slave/audit_log\",
+                      \"log_stream_name\": \"${EnvironmentName}/{instance_id}/replica/audit_log\",
                       \"timezone\": \"UTC\"
                       }
                     ]
diff --git a/master-slave/cf-dashboard.yml b/primary-replica/cf-dashboard.yml
similarity index 87%
rename from master-slave/cf-dashboard.yml
rename to primary-replica/cf-dashboard.yml
index 66120ea..8dbe49e 100644
--- a/master-slave/cf-dashboard.yml
+++ b/primary-replica/cf-dashboard.yml
@@ -1,13 +1,13 @@
 AWSTemplateFormatVersion: '2010-09-09'
-Description: Deploy a Master-Slave CloudWatch dashboard.
+Description: Deploy a Primary-Replica CloudWatch dashboard.
 Parameters:
-  MasterInstanceId:
-      Description: Optional identifier for the Gerrit master instance
-      Default: gerrit-master-slave-MASTER
+  PrimaryInstanceId:
+      Description: Optional identifier for the Gerrit primary instance
+      Default: gerrit-primary-replica-PRIMARY
       Type: String
-  SlaveInstanceId:
-      Description: Optional identifier for the Gerrit slave instance
-      Default: gerrit-master-slave-SLAVE
+  ReplicaInstanceId:
+      Description: Optional identifier for the Gerrit replica instance
+      Default: gerrit-primary-replica-REPLICA
       Type: String
   MetricsCloudwatchNamespace:
       Description: The CloudWatch namespace for Gerrit metrics
@@ -31,8 +31,8 @@
                             "height": 3,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${MasterInstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "sshd/sessions/connected", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "singleValue",
                                 "region": "${AWS::Region}",
@@ -51,8 +51,8 @@
                             "properties": {
                                 "metrics": [
                                     [ { "expression": "RATE(METRICS())", "label": "Expression1", "id": "e1", "region": "${AWS::Region}" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${MasterInstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${SlaveInstanceId}", "Type", "gauge", { "id": "m2", "visible": false } ]
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/usage", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge", { "id": "m2", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -79,8 +79,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${MasterInstanceId}", "Type", "gauge", { "id": "m1" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${SlaveInstanceId}", "Type", "gauge", { "id": "m2" } ]
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge", { "id": "m1" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/cache_used", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge", { "id": "m2" } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -104,8 +104,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${MasterInstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.memory.total.used", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -128,8 +128,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${MasterInstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/cpu/system_load", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -152,8 +152,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${MasterInstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jvm.gc.G1-Old-Generation.time",  "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -176,8 +176,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${MasterInstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "proc/jvm/thread/num_live",  "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -200,7 +200,7 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${MasterInstanceId}", "Type", "99.9%", { "id": "m2" } ]
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/rest_api/server_latency_total", "InstanceId", "${PrimaryInstanceId}", "Type", "99.9%", { "id": "m2" } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": true,
@@ -225,7 +225,7 @@
                             "properties": {
                                 "metrics": [
                                     [ { "expression": "m1+m2", "label": "HTTP hits per second", "id": "e2", "region": "${AWS::Region}" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${MasterInstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/success_count_total", "InstanceId", "${PrimaryInstanceId}", "Type", "count", { "id": "m2", "visible": false } ],
                                     [ ".", "http/server/error_count_total", ".", ".", ".", ".", { "id": "m1", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
@@ -252,7 +252,7 @@
                             "properties": {
                                 "metrics": [
                                     [ { "expression": "(m1/(m1+m2))*100", "label": "% of HTTP Errors", "id": "e1", "region": "${AWS::Region}" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${MasterInstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "http/server/error_count_total", "InstanceId", "${PrimaryInstanceId}", "Type", "count", { "id": "m1", "visible": false } ],
                                     [ ".", "http/server/success_count_total", ".", ".", ".", ".", { "id": "m2", "visible": false } ]
                                 ],
                                 "view": "timeSeries",
@@ -278,8 +278,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${MasterInstanceId}", "Type", "count", { "id": "m1" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${SlaveInstanceId}", "Type", "count", { "id": "m1" } ]
+                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${PrimaryInstanceId}", "Type", "count", { "id": "m1" } ],
+                                    [ "${MetricsCloudwatchNamespace}", "git/upload-pack/request_count_total", "InstanceId", "${ReplicaInstanceId}", "Type", "count", { "id": "m1" } ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
@@ -304,7 +304,7 @@
                             "properties": {
                                 "metrics": [
                                     [ { "expression": "RATE(METRICS())*PERIOD(m1)", "label": "Expression1", "id": "e1" } ],
-                                    [ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${MasterInstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
+                                    [ "${MetricsCloudwatchNamespace}", "queue/index_batch/total_scheduled_tasks_count", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge", { "id": "m1", "visible": false } ],
                                     [ ".", "queue/receive_commits/total_scheduled_tasks_count", ".", ".", ".", ".", { "id": "m2", "visible": false } ],
                                     [ ".", "queue/work_queue/total_scheduled_tasks_count", ".", ".", ".", ".", { "id": "m3", "visible": false } ],
                                     [ ".", "queue/ssh_command_start/total_scheduled_tasks_count", ".", ".", ".", ".", { "id": "m4", "visible": false } ]
@@ -331,7 +331,7 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${MasterInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "queue/send_email/scheduled_tasks", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": true,
@@ -354,8 +354,8 @@
                             "height": 6,
                             "properties": {
                                 "metrics": [
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${MasterInstanceId}", "Type", "gauge" ],
-                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${SlaveInstanceId}", "Type", "gauge" ]
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${PrimaryInstanceId}", "Type", "gauge" ],
+                                    [ "${MetricsCloudwatchNamespace}", "jgit/block_cache/open_files", "InstanceId", "${ReplicaInstanceId}", "Type", "gauge" ]
                                 ],
                                 "view": "timeSeries",
                                 "stacked": false,
diff --git a/primary-replica/cf-dns-route.yml b/primary-replica/cf-dns-route.yml
new file mode 100644
index 0000000..ec9b369
--- /dev/null
+++ b/primary-replica/cf-dns-route.yml
@@ -0,0 +1,36 @@
+AWSTemplateFormatVersion: '2010-09-09'
+Description: A stack for the Gerrit service Route53 routing.
+Parameters:
+  PrimaryServiceStackName:
+      Description: Stack name of the ECS Primary Gerrit service
+      Type: String
+      Default: gerrit-service-primary
+  ReplicaServiceStackName:
+      Description: Stack name of the ECS Replica Gerrit service
+      Type: String
+      Default: gerrit-service-replica
+
+Resources:
+  PrimaryDnsRecord:
+      Type: AWS::Route53::RecordSet
+      Properties:
+        Name:
+          !Join
+            - '.'
+            - - Fn::ImportValue: !Join [':', [!Ref 'PrimaryServiceStackName', 'Subdomain']]
+              - Fn::ImportValue: !Join [':', [!Ref 'PrimaryServiceStackName', 'HostedZoneName']]
+        HostedZoneName:
+          !Join
+            - ''
+            - - Fn::ImportValue: !Join [':', [!Ref 'PrimaryServiceStackName', 'HostedZoneName']]
+              - '.'
+        Comment: DNS name for Gerrit Primary.
+        Type: A
+        AliasTarget:
+          DNSName:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'PrimaryServiceStackName', 'PublicLoadBalancerDNSName']]
+          HostedZoneId:
+            Fn::ImportValue:
+              !Join [':', [!Ref 'PrimaryServiceStackName', 'CanonicalHostedZoneID']]
+          EvaluateTargetHealth: False
diff --git a/master-slave/cf-service-master.yml b/primary-replica/cf-service-primary.yml
similarity index 96%
rename from master-slave/cf-service-master.yml
rename to primary-replica/cf-service-primary.yml
index 3c0cff4..f41b430 100644
--- a/master-slave/cf-service-master.yml
+++ b/primary-replica/cf-service-primary.yml
@@ -3,10 +3,10 @@
 Parameters:
   GerritServiceName:
     Type: String
-    Default: gerrit-master
-  SlaveServiceStackName:
+    Default: gerrit-primary
+  ReplicaServiceStackName:
     Type: String
-    Default: gerrit-slave
+    Default: gerrit-replica
   TemplateBucketName:
     Description: S3 bucket containing cloudformation templates
     Type: String
@@ -62,14 +62,14 @@
   Subdomain:
         Description: The subdomain of the Gerrit cluster
         Type: String
-        Default: gerrit-master-demo
+        Default: gerrit-primary-demo
   LoadBalancerScheme:
         Description: Load Balancer schema, The nodes of an Internet-facing load balancer have public IP addresses.
         Type: String
         Default: internet-facing
         AllowedValues: [internal, internet-facing]
-  SlaveSubdomain:
-        Description: The subdomain of the Gerrit slave
+  ReplicaSubdomain:
+        Description: The subdomain of the Gerrit replica
         Type: String
   GerritKeyPrefix:
         Description: Gerrit credentials keys prefix
@@ -144,7 +144,7 @@
   InstanceId:
     Description: Optional identifier for the Gerrit instance
     Type: String
-    Default: gerrit-master-slave-MASTER
+    Default: gerrit-primary-replica-PRIMARY
   MetricsCloudwatchEnabled:
     Description: Whether gerrit metrics should be published to cloudwatch
     Type: String
@@ -215,7 +215,7 @@
             ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             NetworkMode: bridge
             PlacementConstraints:
-              - Expression: !Sub 'attribute:target_group == master'
+              - Expression: !Sub 'attribute:target_group == primary'
                 Type: "memberOf"
             ContainerDefinitions:
                 - Name: !Ref GerritServiceName
@@ -266,8 +266,8 @@
                       Value: !Ref GitPort
                     - Name: GIT_SSH_PORT
                       Value: !Ref GitSSHPort
-                    - Name: SLAVE_SUBDOMAIN
-                      Value: !Ref SlaveSubdomain
+                    - Name: REPLICA_SUBDOMAIN
+                      Value: !Ref ReplicaSubdomain
                     - Name: HOSTED_ZONE_NAME
                       Value: !Ref HostedZoneName
                     - Name: REINDEX_AT_STARTUP
diff --git a/master-slave/cf-service-slave.yml b/primary-replica/cf-service-replica.yml
similarity index 97%
rename from master-slave/cf-service-slave.yml
rename to primary-replica/cf-service-replica.yml
index 44f19c2..642ec80 100644
--- a/master-slave/cf-service-slave.yml
+++ b/primary-replica/cf-service-replica.yml
@@ -3,7 +3,7 @@
 Parameters:
   GerritServiceName:
       Type: String
-      Default: gerrit-slave
+      Default: gerrit-replica
   GitDaemonServiceName:
       Type: String
       Default: gerrit-git-daemon
@@ -81,7 +81,7 @@
   Subdomain:
       Description: The subdomain of the Gerrit cluster
       Type: String
-      Default: gerrit-slave-demo
+      Default: gerrit-replica-demo
   LoadBalancerScheme:
       Description: Load Balancer schema, The nodes of an Internet-facing load balancer have public IP addresses.
       Type: String
@@ -90,23 +90,23 @@
   GerritGitVolume:
       Description: Gerrit git volume name
       Type: String
-      Default: gerrit-git-slave
+      Default: gerrit-git-replica
   GerritDataVolume:
       Description: Gerrit data volume name
       Type: String
-      Default: gerrit-data-slave
+      Default: gerrit-data-replica
   GerritCacheVolume:
       Description: Gerrit cache volume name
       Type: String
-      Default: gerrit-cache-slave
+      Default: gerrit-cache-replica
   GerritDbVolume:
       Description: Gerrit db volume name
       Type: String
-      Default: gerrit-db-slave
+      Default: gerrit-db-replica
   GerritLogsVolume:
       Description: Gerrit logs volume name
       Type: String
-      Default: gerrit-logs-slave
+      Default: gerrit-logs-replica
   GerritKeyPrefix:
       Description: Gerrit credentials keys prefix
       Type: String
@@ -157,7 +157,7 @@
   InstanceId:
     Description: Optional identifier for the Gerrit instance
     Type: String
-    Default: gerrit-master-slave-SLAVE
+    Default: gerrit-primary-replica-REPLICA
   MetricsCloudwatchEnabled:
     Description: Whether gerrit metrics should be published to cloudwatch
     Type: String
@@ -237,7 +237,7 @@
                       Value: !Sub 'https://${Subdomain}.${HostedZoneName}'
                     - Name: HTTPD_LISTEN_URL
                       Value: !Sub 'proxy-https://*:${HTTPContainePort}/'
-                    - Name: CONTAINER_SLAVE
+                    - Name: CONTAINER_REPLICA
                       Value: true
                     - Name: GERRIT_KEY_PREFIX
                       Value: !Ref GerritKeyPrefix
@@ -487,12 +487,12 @@
             Port: !Ref GitSSHPort
             Protocol: TCP
 
-    SlaveDnsRecord:
+    ReplicaDnsRecord:
         Type: AWS::Route53::RecordSet
         Properties:
           Name: !Sub '${Subdomain}.${HostedZoneName}'
           HostedZoneName: !Sub '${HostedZoneName}.'
-          Comment: DNS name for Gerrit Slave.
+          Comment: DNS name for Gerrit Replica.
           Type: A
           AliasTarget:
             DNSName: !GetAtt 'LoadBalancer.DNSName'
diff --git a/master-slave/git-daemon/Dockerfile b/primary-replica/git-daemon/Dockerfile
similarity index 100%
rename from master-slave/git-daemon/Dockerfile
rename to primary-replica/git-daemon/Dockerfile
diff --git a/master-slave/git-daemon/Makefile b/primary-replica/git-daemon/Makefile
similarity index 100%
rename from master-slave/git-daemon/Makefile
rename to primary-replica/git-daemon/Makefile
diff --git a/master-slave/git-ssh/Dockerfile b/primary-replica/git-ssh/Dockerfile
similarity index 100%
rename from master-slave/git-ssh/Dockerfile
rename to primary-replica/git-ssh/Dockerfile
diff --git a/master-slave/git-ssh/Makefile b/primary-replica/git-ssh/Makefile
similarity index 100%
rename from master-slave/git-ssh/Makefile
rename to primary-replica/git-ssh/Makefile
diff --git a/master-slave/git-ssh/entrypoint.sh b/primary-replica/git-ssh/entrypoint.sh
similarity index 100%
rename from master-slave/git-ssh/entrypoint.sh
rename to primary-replica/git-ssh/entrypoint.sh
diff --git a/master-slave/git-ssh/requirements.txt b/primary-replica/git-ssh/requirements.txt
similarity index 100%
rename from master-slave/git-ssh/requirements.txt
rename to primary-replica/git-ssh/requirements.txt
diff --git a/master-slave/git-ssh/setup_ssh.py b/primary-replica/git-ssh/setup_ssh.py
similarity index 100%
rename from master-slave/git-ssh/setup_ssh.py
rename to primary-replica/git-ssh/setup_ssh.py
diff --git a/master-slave/setup.env.template b/primary-replica/setup.env.template
similarity index 80%
rename from master-slave/setup.env.template
rename to primary-replica/setup.env.template
index eb860f6..9fc6f70 100644
--- a/master-slave/setup.env.template
+++ b/primary-replica/setup.env.template
@@ -1,15 +1,15 @@
-MASTER_MAX_COUNT=2
+PRIMARY_MAX_COUNT=2
 CLUSTER_INSTANCE_TYPE:=m4.xlarge
-SERVICE_MASTER_STACK_NAME:=$(AWS_PREFIX)-service-master
-SERVICE_SLAVE_STACK_NAME:=$(AWS_PREFIX)-service-slave
+SERVICE_PRIMARY_STACK_NAME:=$(AWS_PREFIX)-service-primary
+SERVICE_REPLICA_STACK_NAME:=$(AWS_PREFIX)-service-replica
 SERVICE_PROMETHEUS_STACK_NAME:=$(AWS_PREFIX)-prometheus
 SERVICE_GRAFANA_STACK_NAME:=$(AWS_PREFIX)-grafana
 DNS_ROUTING_STACK_NAME:=$(AWS_PREFIX)-dns-routing
 DNS_ROUTING_MONITORING_STACK_NAME:=$(AWS_PREFIX)-monitoring-dns-routing
 DASHBOARD_STACK_NAME:=$(AWS_PREFIX)-dashboard
 HOSTED_ZONE_NAME:=yourcompany.com
-MASTER_SUBDOMAIN:=$(AWS_PREFIX)-master.gerrit-demo
-SLAVE_SUBDOMAIN:=$(AWS_PREFIX)-slave.gerrit-demo
+PRIMARY_SUBDOMAIN:=$(AWS_PREFIX)-primary.gerrit-demo
+REPLICA_SUBDOMAIN:=$(AWS_PREFIX)-replica.gerrit-demo
 PROMETHEUS_SUBDOMAIN:=$(AWS_PREFIX)-prometheus.gerrit-demo
 GRAFANA_SUBDOMAIN:=$(AWS_PREFIX)-grafana.gerrit-demo
 DOCKER_REGISTRY_URI:=<yourAccountId>.dkr.ecr.us-east-1.amazonaws.com
@@ -21,8 +21,8 @@
 JGIT_CACHE_SIZE=3g
 JGIT_OPEN_FILES=128
 
-GERRIT_MASTER_INSTANCE_ID=gerrit-master-slave-MASTER
-GERRIT_SLAVE_INSTANCE_ID=gerrit-master-slave-SLAVE
+GERRIT_PRIMARY_INSTANCE_ID=gerrit-primary-replica-PRIMARY
+GERRIT_REPLICA_INSTANCE_ID=gerrit-primary-replica-REPLICA
 
 LDAP_SERVER:=ldap://yourldap.yourcompany.com
 LDAP_USERNAME:=cn=admin,dc=example,dc=org
diff --git a/single-master/Makefile b/single-primary/Makefile
similarity index 97%
rename from single-master/Makefile
rename to single-primary/Makefile
index aa2e48c..f878ed7 100644
--- a/single-master/Makefile
+++ b/single-primary/Makefile
@@ -22,7 +22,7 @@
 						$(optional_git_gc_targets_creation) \
 						dns-routing wait-for-dns-routing-creation
 
-cluster: cluster-keys set-optional-gerrit-master-volume
+cluster: cluster-keys set-optional-gerrit-primary-volume
 ifdef CLUSTER_INSTANCE_TYPE
 		$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=InstanceType,ParameterValue=$(CLUSTER_INSTANCE_TYPE))
 endif
@@ -45,7 +45,7 @@
 		ParameterKey=VPCIdProp,ParameterValue=$(VPC_ID) \
 		ParameterKey=SubnetIdProp,ParameterValue=$(SUBNET_ID) \
 		$(CLUSTER_OPTIONAL_PARAMS) \
-		$(GERRIT_OPTIONAL_MASTER_VOLUME)
+		$(GERRIT_OPTIONAL_PRIMARY_VOLUME)
 
 service: set-optional-params-metrics-cloudwatch set-optional-params-smtp set-ldap-account-pattern set-optional-gerrit-ulimits set-optional-jgit-conf
 ifdef LOAD_BALANCER_SCHEME
@@ -159,4 +159,4 @@
 						delete-cluster wait-for-cluster-deletion
 
 gerrit-publish:
-	$(MAKE) -C ../gerrit gerrit-publish RECIPE=single-master
+	$(MAKE) -C ../gerrit gerrit-publish RECIPE=single-primary
diff --git a/single-master/README.md b/single-primary/README.md
similarity index 94%
rename from single-master/README.md
rename to single-primary/README.md
index 422513d..caac341 100644
--- a/single-master/README.md
+++ b/single-primary/README.md
@@ -1,6 +1,6 @@
-# Gerrit Single Master
+# Gerrit Single Primary
 
-This set of Templates provide all the components to deploy a single Gerrit master
+This set of Templates provide all the components to deploy a single Gerrit primary
 in ECS
 
 ## Architecture
@@ -47,7 +47,7 @@
 * Standard CloudWatch monitoring metrics for each component
 * Application level CloudWatch monitoring can be enabled as described [here](../Configuration.md#cloudwatch-monitoring)
 * Prometheus and Grafana stack is not available for this recipe yet. However the work has been done for
-the dual-master recipe and it could be easily adapted (you can find the relevant issue
+the dual-primary recipe and it could be easily adapted (you can find the relevant issue
 [here](https://bugs.chromium.org/p/gerrit/issues/detail?id=13092)).
 
 ## How to run it
@@ -76,7 +76,7 @@
 Configuration values affecting deployment environment and cluster properties
 
 * `SERVICE_STACK_NAME`: Optional. Name of the service stack. `gerrit-service` by default.
-* `GERRIT_INSTANCE_ID`: Optional. Identifier for the Gerrit instance. "gerrit-single-master" by default.
+* `GERRIT_INSTANCE_ID`: Optional. Identifier for the Gerrit instance. "gerrit-single-primary" by default.
 * `GERRIT_VOLUME_ID` : Optional. Id of an extisting EBS volume. If empty, a new volume
 for Gerrit data will be created
 * `GERRIT_VOLUME_SNAPSHOT_ID` : Optional. Ignored if GERRIT_VOLUME_ID is not empty. Id of
@@ -131,7 +131,7 @@
 
 ### Permissions
 
-In order to deploy and destroy a single-master recipe the invoking user needs to
+In order to deploy and destroy a single-primary recipe the invoking user needs to
 have the relevant permissions to perform actions on AWS resources.
 
 The list of actions can be found [here](resources/permission.policy.json).
diff --git a/single-master/cf-cluster.yml b/single-primary/cf-cluster.yml
similarity index 98%
rename from single-master/cf-cluster.yml
rename to single-primary/cf-cluster.yml
index b456897..7274596 100644
--- a/single-master/cf-cluster.yml
+++ b/single-primary/cf-cluster.yml
@@ -127,7 +127,7 @@
         Fn::Base64: !Sub |
           #!/bin/bash -xe
           echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
-          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"master\"} >> /etc/ecs/ecs.config
+          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"primary\"} >> /etc/ecs/ecs.config
           # Make sure latest version of the helper scripts are installed as per recommendation:
           # https://github.com/awsdocs/aws-cloudformation-user-guide/blob/master/doc_source/cfn-helper-scripts-reference.md#using-the-latest-version
           yum install -y aws-cfn-bootstrap aws-cli xfsprogs
diff --git a/single-master/cf-dns-route.yml b/single-primary/cf-dns-route.yml
similarity index 95%
rename from single-master/cf-dns-route.yml
rename to single-primary/cf-dns-route.yml
index 55f8a15..bf0d474 100644
--- a/single-master/cf-dns-route.yml
+++ b/single-primary/cf-dns-route.yml
@@ -20,7 +20,7 @@
             - ''
             - - Fn::ImportValue: !Join [':', [!Ref 'ServiceStackName', 'HostedZoneName']]
               - '.'
-        Comment: DNS name for Gerrit Master.
+        Comment: DNS name for Gerrit Primary.
         Type: A
         AliasTarget:
           DNSName:
diff --git a/single-master/cf-service.yml b/single-primary/cf-service.yml
similarity index 99%
rename from single-master/cf-service.yml
rename to single-primary/cf-service.yml
index f156bb1..548a1af 100644
--- a/single-master/cf-service.yml
+++ b/single-primary/cf-service.yml
@@ -3,7 +3,7 @@
 Parameters:
   GerritServiceName:
     Type: String
-    Default: gerrit-master
+    Default: gerrit-primary
   ClusterStackName:
       Description: Stack name of the ECS cluster to deply the serivces
       Type: String
@@ -47,7 +47,7 @@
   Subdomain:
         Description: The subdomain of the Gerrit cluster
         Type: String
-        Default: gerrit-master-demo
+        Default: gerrit-primary-demo
   LoadBalancerScheme:
         Description: Load Balancer schema, The nodes of an Internet-facing load balancer have public IP addresses.
         Type: String
@@ -126,7 +126,7 @@
   InstanceId:
       Description: Optional identifier for the Gerrit instance
       Type: String
-      Default: gerrit-single-master
+      Default: gerrit-single-primary
   MetricsCloudwatchEnabled:
       Description: Whether gerrit metrics should be published to cloudwatch
       Type: String
@@ -199,7 +199,7 @@
             ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             NetworkMode: bridge
             PlacementConstraints:
-              - Expression: !Sub 'attribute:target_group == master'
+              - Expression: !Sub 'attribute:target_group == primary'
                 Type: "memberOf"
             ContainerDefinitions:
                 - Name: !Ref GerritServiceName
diff --git a/single-master/resources/permission.policy.json b/single-primary/resources/permission.policy.json
similarity index 100%
rename from single-master/resources/permission.policy.json
rename to single-primary/resources/permission.policy.json
diff --git a/single-master/setup.env.template b/single-primary/setup.env.template
similarity index 93%
rename from single-master/setup.env.template
rename to single-primary/setup.env.template
index 2dc6797..c4b1c10 100644
--- a/single-master/setup.env.template
+++ b/single-primary/setup.env.template
@@ -2,7 +2,7 @@
 CLUSTER_INSTANCE_TYPE:=m4.large
 DNS_ROUTING_STACK_NAME:=$(AWS_PREFIX)-dns-routing
 HOSTED_ZONE_NAME:=mycompany.com
-SUBDOMAIN:=$(AWS_PREFIX)-master-demo
+SUBDOMAIN:=$(AWS_PREFIX)-primary-demo
 DOCKER_REGISTRY_URI:=<your_aws_account_number>.dkr.ecr.us-east-2.amazonaws.com
 SSL_CERTIFICATE_ARN=arn:aws:acm:us-east-2:<your_aws_account_number>:certificate/41eb8e52-c82b-420e-a5b2-d79107f3e5e1
 GERRIT_RAM=6000
@@ -11,7 +11,7 @@
 JGIT_CACHE_SIZE=3g
 JGIT_OPEN_FILES=128
 
-GERRIT_INSTANCE_ID=gerrit-single-master
+GERRIT_INSTANCE_ID=gerrit-single-primary
 
 LDAP_SERVER:=ldap://yourldap.yourcompany.com
 LDAP_USERNAME:=cn=admin,dc=example,dc=org