Skip to content

Commit

Permalink
feat: Allow for disk size in ec2 instances
Browse files Browse the repository at this point in the history
Our EC2 code allows adding and removing volumes, but not setting the
default volume size. For a t3.micro, it is only 8G. This is causing some
cloud-init tests to fail.

This commit allows for specifying default disk size, and sets the
default to 15G.
  • Loading branch information
TheRealFalcon committed Oct 23, 2023
1 parent f2cfeeb commit d3ef6c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1!5.8.0
1!5.9.0
12 changes: 12 additions & 0 deletions pycloudlib/ec2/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ def launch(
user_data=None,
vpc=None,
*,
disk_size_gb: int = 15,
username: Optional[str] = None,
**kwargs,
):
Expand All @@ -357,6 +358,7 @@ def launch(
instance_type: string, instance type to launch
user_data: string, user-data to pass to instance
vpc: optional vpc object to create instance under
disk_size_gb: size of instance disk in GB
username: username to use when connecting via SSH
kwargs: other named arguments to add to instance JSON
Expand All @@ -381,6 +383,16 @@ def launch(
"Tags": [{"Key": "Name", "Value": self.tag}],
}
],
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"DeleteOnTermination": True,
"VolumeSize": disk_size_gb,
"VolumeType": "gp3",
},
}
],
}

if user_data:
Expand Down

0 comments on commit d3ef6c5

Please sign in to comment.