diff --git a/cloudlift/config/environment_configuration.py b/cloudlift/config/environment_configuration.py index ab73d231..de8bc43b 100644 --- a/cloudlift/config/environment_configuration.py +++ b/cloudlift/config/environment_configuration.py @@ -117,6 +117,7 @@ def _create_config(self): private_subnet_2_cidr = prompt( "Private Subnet 2 CIDR", default=list(vpc_cidr.subnets(new_prefix=22))[3]) cluster_min_instances = prompt("Min instances in cluster", default=1) + instance_root_volume = prompt("Instance Root Volume Size", default=30) cluster_max_instances = prompt("Max instances in cluster", default=5) cluster_instance_type = prompt("Instance type", default='m5.xlarge') key_name = prompt("SSH key name") @@ -152,7 +153,8 @@ def _create_config(self): "min_instances": cluster_min_instances, "max_instances": cluster_max_instances, "instance_type": cluster_instance_type, - "key_name": key_name + "key_name": key_name, + "instance_root_volume": instance_root_volume }, "environment": { "notifications_arn": notifications_arn, @@ -253,12 +255,14 @@ def _validate_changes(self, configuration): "max_instances": {"type": "integer"}, "instance_type": {"type": "string"}, "key_name": {"type": "string"}, + "instance_root_volume": {"type": "integer"} }, "required": [ "min_instances", "max_instances", "instance_type", - "key_name" + "key_name", + "instance_root_volume" ] }, "environment": { diff --git a/cloudlift/deployment/cluster_template_generator.py b/cloudlift/deployment/cluster_template_generator.py index 0fb6f01e..4be1c6d8 100644 --- a/cloudlift/deployment/cluster_template_generator.py +++ b/cloudlift/deployment/cluster_template_generator.py @@ -587,7 +587,17 @@ def _add_ec2_auto_scaling(self): SecurityGroupIds=[GetAtt(self.sg_hosts, 'GroupId')], InstanceType=Ref('InstanceType'), ImageId=FindInMap("AWSRegionToAMI", Ref("AWS::Region"), "AMI"), - KeyName=Ref(self.key_pair) + Metadata=lc_metadata, + KeyName=Ref(self.key_pair), + BlockDeviceMappings=[ + { + "DeviceName": "/dev/xvda", + "Ebs": { + "VolumeSize": Ref("InstanceRootVolume"), + "VolumeType": "gp3" + } + } + ] ) launch_template = LaunchTemplate( "LaunchTemplate", @@ -657,6 +667,9 @@ def _add_cluster_parameters(self): Type="String", Default=self.notifications_arn) self.template.add_parameter(self.notification_sns_arn) + self.instance_root_volume = Parameter("InstanceRootVolume", Description="Root device volume size in GB's", Type="Number", Default=str( + self.configuration['cluster']['instance_root_volume'])) + self.template.add_parameter(self.instance_root_volume) self.template.add_parameter(Parameter( "InstanceType", Description='', Type="String", Default=self.configuration['cluster']['instance_type'])) @@ -771,6 +784,7 @@ def _add_metadata(self): 'MinSize', 'MaxSize', 'InstanceType', + 'InstanceRootVolume', 'VPC', 'Subnet1', 'Subnet2', @@ -785,6 +799,9 @@ def _add_metadata(self): 'InstanceType': { 'default': 'Type of instance' }, + 'InstanceRootVolume': { + 'default': 'Root Volume Size' + }, 'KeyPair': { 'default': 'Select the key with which you want to login to the ec2 instances'}, 'MaxSize': { diff --git a/cloudlift/version/__init__.py b/cloudlift/version/__init__.py index fdc685fc..4f3eeec2 100644 --- a/cloudlift/version/__init__.py +++ b/cloudlift/version/__init__.py @@ -1 +1 @@ -VERSION = '1.5.2' +VERSION = '1.5.3' \ No newline at end of file