Spec down the default cluster EC2 instance type

Reduce the default EC2 instance type from a m4.10xlarge to:

* m4.large for the single-master recipe (95% saving on AWS bill)
* m4.xlarge for the master-slave recipe (90% saving on AWS bill)
* m4.2xlarge for the dual-master recipe (80% saving on AWS bill)

Also, reduce accordingly the default CPU and memory allocated to the Gerrit
instances to 1 vCPU and 6Gb respectively.

Bug: Issue 13221
Change-Id: Ie8a199ea50f11414c4037c2c71957a45b6b5ff4a
diff --git a/Configuration.md b/Configuration.md
index 3065476..0d85b3e 100644
--- a/Configuration.md
+++ b/Configuration.md
@@ -30,15 +30,19 @@
 
 Configuration values to spec up Gerrit containers.
 
-* `CLUSTER_INSTANCE_TYPE`: Optional. The EC2 instance Type used to run the cluster. `m4.10xlarge` by default.
-* `GERRIT_RAM`: RAM allocated (MiB) to the Gerrit container. `70000` by default.
-* `GERRIT_CPU`: vCPU units allocated to the Gerrit container. `10240` by default.
+* `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`
+* `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.
   See [Gerrit documentation](https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#container.heapLimit)
-  `35g` by default.
+  `6g` by default.
 * `JGIT_CACHE_SIZE`: Maximum number of bytes to load and cache in memory from pack files.
   See [Gerrit documentation](https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#core.packedGitLimit)
-  for more details. `12g` by default.
+  for more details. `3g` by default.
 * `INTERNET_GATEWAY_ID`: Optional. Id of the existing Internet Gateway.
   If not set, create a new Internet Gateway
 * `VPC_ID`: Optional. Id of the existing VPC.
diff --git a/dual-master/cf-cluster.yml b/dual-master/cf-cluster.yml
index ca1c947..f682041 100644
--- a/dual-master/cf-cluster.yml
+++ b/dual-master/cf-cluster.yml
@@ -21,7 +21,7 @@
   InstanceType:
     Description: EC2 instance type
     Type: String
-    Default: m4.10xlarge
+    Default: m4.2xlarge
     AllowedValues: [t2.micro, t2.small, t2.medium, t2.large, m3.medium, m3.large,
       m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
       c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
diff --git a/dual-master/cf-service-master.yml b/dual-master/cf-service-master.yml
index 75e0020..a21bfc2 100644
--- a/dual-master/cf-service-master.yml
+++ b/dual-master/cf-service-master.yml
@@ -126,19 +126,19 @@
   GerritRAM:
       Description: RAM to allocate to the Gerrit container
       Type: Number
-      Default: 70000
+      Default: 6000
   GerritCPU:
       Description: vCPU to allocate to the Gerrit container
       Type: Number
-      Default: 10240
+      Default: 1024
   GerritHeapLimit:
       Description: Gerrit Heap limit
       Type: String
-      Default: 35g
+      Default: 6g
   JgitCacheSize:
       Description: JGit cache size
       Type: String
-      Default: 12g
+      Default: 3g
   LDAPServer:
       Description: LDAP server URL
       Type: String
diff --git a/dual-master/cf-service-slave.yml b/dual-master/cf-service-slave.yml
index 2d87350..83adaff 100644
--- a/dual-master/cf-service-slave.yml
+++ b/dual-master/cf-service-slave.yml
@@ -108,19 +108,19 @@
   GerritRAM:
       Description: RAM to allocate to the Gerrit container
       Type: Number
-      Default: 70000
+      Default: 6000
   GerritCPU:
       Description: vCPU to allocate to the Gerrit container
       Type: Number
-      Default: 10240
+      Default: 1024
   GerritHeapLimit:
       Description: Gerrit Heap limit
       Type: String
-      Default: 35g
+      Default: 6g
   JgitCacheSize:
       Description: JGit cache size
       Type: String
-      Default: 12g
+      Default: 3g
   LDAPServer:
       Description: LDAP server URL
       Type: String
diff --git a/dual-master/setup.env.template b/dual-master/setup.env.template
index a4bba00..949abca 100644
--- a/dual-master/setup.env.template
+++ b/dual-master/setup.env.template
@@ -15,10 +15,10 @@
 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
-GERRIT_RAM=70000
-GERRIT_CPU=10240
-GERRIT_HEAP_LIMIT=35g
-JGIT_CACHE_SIZE=12g
+GERRIT_RAM=6000
+GERRIT_CPU=1024
+GERRIT_HEAP_LIMIT=6g
+JGIT_CACHE_SIZE=3g
 
 FILESYSTEM_THROUGHPUT_MODE=bursting
 
diff --git a/master-slave/cf-cluster.yml b/master-slave/cf-cluster.yml
index dfff4c5..4eaf788 100644
--- a/master-slave/cf-cluster.yml
+++ b/master-slave/cf-cluster.yml
@@ -21,7 +21,7 @@
   InstanceType:
     Description: EC2 instance type
     Type: String
-    Default: m4.10xlarge
+    Default: m4.xlarge
     AllowedValues: [t2.micro, t2.small, t2.medium, t2.large, m3.medium, m3.large,
       m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
       c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
diff --git a/master-slave/cf-service-master.yml b/master-slave/cf-service-master.yml
index 7aff09c..1bee898 100644
--- a/master-slave/cf-service-master.yml
+++ b/master-slave/cf-service-master.yml
@@ -101,19 +101,19 @@
   GerritRAM:
       Description: RAM to allocate to the Gerrit container
       Type: Number
-      Default: 70000
+      Default: 6000
   GerritCPU:
       Description: vCPU to allocate to the Gerrit container
       Type: Number
-      Default: 10240
+      Default: 1024
   GerritHeapLimit:
       Description: Gerrit Heap limit
       Type: String
-      Default: 35g
+      Default: 6g
   JgitCacheSize:
       Description: JGit cache size
       Type: String
-      Default: 12g
+      Default: 3g
   LDAPServer:
       Description: LDAP server URL
       Type: String
diff --git a/master-slave/cf-service-slave.yml b/master-slave/cf-service-slave.yml
index 25c8acd..eba0d6b 100644
--- a/master-slave/cf-service-slave.yml
+++ b/master-slave/cf-service-slave.yml
@@ -113,19 +113,19 @@
   GerritRAM:
       Description: RAM to allocate to the Gerrit container
       Type: Number
-      Default: 70000
+      Default: 6000
   GerritCPU:
       Description: vCPU to allocate to the Gerrit container
       Type: Number
-      Default: 10240
+      Default: 1024
   GerritHeapLimit:
       Description: Gerrit Heap limit
       Type: String
-      Default: 35g
+      Default: 6g
   JgitCacheSize:
       Description: JGit cache size
       Type: String
-      Default: 12g
+      Default: 3g
   LDAPServer:
       Description: LDAP server URL
       Type: String
diff --git a/master-slave/setup.env.template b/master-slave/setup.env.template
index 8bab049..1035cf5 100644
--- a/master-slave/setup.env.template
+++ b/master-slave/setup.env.template
@@ -1,5 +1,5 @@
 CLUSTER_DESIRED_CAPACITY:=1
-CLUSTER_INSTANCE_TYPE:=m4.10xlarge
+CLUSTER_INSTANCE_TYPE:=m4.xlarge
 SERVICE_MASTER_STACK_NAME:=$(AWS_PREFIX)-service-master
 SERVICE_SLAVE_STACK_NAME:=$(AWS_PREFIX)-service-slave
 SERVICE_PROMETHEUS_STACK_NAME:=$(AWS_PREFIX)-prometheus
@@ -14,10 +14,10 @@
 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
 TOKEN_VERSION:=4ibxLB
-GERRIT_RAM=70000
-GERRIT_CPU=10240
-GERRIT_HEAP_LIMIT=35g
-JGIT_CACHE_SIZE=12g
+GERRIT_RAM=6000
+GERRIT_CPU=1024
+GERRIT_HEAP_LIMIT=6g
+JGIT_CACHE_SIZE=3g
 
 LDAP_SERVER:=ldap://yourldap.yourcompany.com
 LDAP_USERNAME:=cn=admin,dc=example,dc=org
diff --git a/single-master/cf-cluster.yml b/single-master/cf-cluster.yml
index a436035..81e922a 100644
--- a/single-master/cf-cluster.yml
+++ b/single-master/cf-cluster.yml
@@ -21,7 +21,7 @@
   InstanceType:
     Description: EC2 instance type
     Type: String
-    Default: m4.10xlarge
+    Default: m4.large
     AllowedValues: [t2.micro, t2.small, t2.medium, t2.large, m3.medium, m3.large,
       m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
       c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
diff --git a/single-master/cf-service.yml b/single-master/cf-service.yml
index 10e2703..a6946a8 100644
--- a/single-master/cf-service.yml
+++ b/single-master/cf-service.yml
@@ -83,19 +83,19 @@
   GerritRAM:
       Description: RAM to allocate to the Gerrit container
       Type: Number
-      Default: 70000
+      Default: 6000
   GerritCPU:
       Description: vCPU to allocate to the Gerrit container
       Type: Number
-      Default: 10240
+      Default: 1024
   GerritHeapLimit:
       Description: Gerrit Heap limit
       Type: String
-      Default: 35g
+      Default: 6g
   JgitCacheSize:
       Description: JGit cache size
       Type: String
-      Default: 12g
+      Default: 3g
   LDAPServer:
       Description: LDAP server URL
       Type: String
diff --git a/single-master/setup.env.template b/single-master/setup.env.template
index 8696dcd..dc9adc5 100644
--- a/single-master/setup.env.template
+++ b/single-master/setup.env.template
@@ -1,14 +1,14 @@
 SERVICE_STACK_NAME:=$(AWS_PREFIX)-service
-CLUSTER_INSTANCE_TYPE:=m4.10xlarge
+CLUSTER_INSTANCE_TYPE:=m4.large
 DNS_ROUTING_STACK_NAME:=$(AWS_PREFIX)-dns-routing
 HOSTED_ZONE_NAME:=mycompany.com
 SUBDOMAIN:=$(AWS_PREFIX)-master-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=70000
-GERRIT_CPU=10240
-GERRIT_HEAP_LIMIT=35g
-JGIT_CACHE_SIZE=12g
+GERRIT_RAM=6000
+GERRIT_CPU=1024
+GERRIT_HEAP_LIMIT=6g
+JGIT_CACHE_SIZE=3g
 
 GERRIT_INSTANCE_ID=gerrit-single-master