Default EFS throughput mode to bursting
Change the default throughput mode of EFS from the very expensive
provisioned (1024 MiB/s) to the cheaper bursting mode.
When provisioning the dual-master recipe, one can now choose to change
those defaults to something different by providing the relevant
values in the setup.env:
* FILESYSTEM_THROUGHPUT_MODE
* FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS
Bug: Issue 13219
Change-Id: I3e9de7f66431b8e76aa258fe6c65131cc7228b7c
diff --git a/dual-master/Makefile b/dual-master/Makefile
index 203e0f3..1800e57 100644
--- a/dual-master/Makefile
+++ b/dual-master/Makefile
@@ -29,6 +29,12 @@
ifdef CLUSTER_INSTANCE_TYPE
$(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=InstanceType,ParameterValue=$(CLUSTER_INSTANCE_TYPE))
endif
+ifdef FILESYSTEM_THROUGHPUT_MODE
+ $(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=FileSystemThroughputMode,ParameterValue=$(FILESYSTEM_THROUGHPUT_MODE))
+endif
+ifdef FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS
+ $(eval CLUSTER_OPTIONAL_PARAMS := $(CLUSTER_OPTIONAL_PARAMS) ParameterKey=ProvisionedThroughputInMibps,ParameterValue=$(FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS))
+endif
$(AWS_FC_COMMAND) create-stack \
--stack-name $(CLUSTER_STACK_NAME) \
diff --git a/dual-master/README.md b/dual-master/README.md
index 52bf9ff..c8d3fdb 100644
--- a/dual-master/README.md
+++ b/dual-master/README.md
@@ -87,6 +87,10 @@
* `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`
+* `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`.
### 2 - Deploy
diff --git a/dual-master/cf-cluster.yml b/dual-master/cf-cluster.yml
index 07b4cc2..ca1c947 100644
--- a/dual-master/cf-cluster.yml
+++ b/dual-master/cf-cluster.yml
@@ -48,6 +48,19 @@
Description: An environment name used to build the log stream names
Type: String
Default: test
+ FileSystemThroughputMode:
+ Description: Gerrit shared filesystem throughput mode
+ Type: String
+ Default: bursting
+ AllowedValues: [bursting, provisioned]
+ ProvisionedThroughputInMibps:
+ Description: The fs throughput, measured in MiB/s. Valid values are 1-1024.
+ Type: Number
+ Default: 256
+
+Conditions:
+ isProvisionedThroughput: !Equals [!Ref FileSystemThroughputMode, "provisioned"]
+
Resources:
# ECS Resources
ECSCluster:
@@ -238,8 +251,8 @@
FileSystem:
Type: AWS::EFS::FileSystem
Properties:
- ThroughputMode: provisioned
- ProvisionedThroughputInMibps: 1024
+ ThroughputMode: !Ref FileSystemThroughputMode
+ ProvisionedThroughputInMibps: !If [isProvisionedThroughput, !Ref ProvisionedThroughputInMibps, !Ref "AWS::NoValue"]
FileSystemTags:
- Key: Name
Value: "multi-master-git-repo"
diff --git a/dual-master/setup.env.template b/dual-master/setup.env.template
index c340d14..2c6638a 100644
--- a/dual-master/setup.env.template
+++ b/dual-master/setup.env.template
@@ -20,6 +20,8 @@
GERRIT_HEAP_LIMIT=35g
JGIT_CACHE_SIZE=12g
+FILESYSTEM_THROUGHPUT_MODE=bursting
+
LDAP_SERVER:=ldap://yourldap.yourcompany.com
LDAP_USERNAME:=cn=admin,dc=example,dc=org
LDAP_ACCOUNT_BASE:=dc=example,dc=org