From d126e5a67bd4e9185003283834192a6862621c54 Mon Sep 17 00:00:00 2001 From: c-bordon Date: Tue, 30 Jul 2024 15:17:28 -0300 Subject: [PATCH] Fixed custom storage for AMIs --- deployability/modules/allocation/aws/provider.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deployability/modules/allocation/aws/provider.py b/deployability/modules/allocation/aws/provider.py index 7822889859..512c55767a 100644 --- a/deployability/modules/allocation/aws/provider.py +++ b/deployability/modules/allocation/aws/provider.py @@ -198,12 +198,15 @@ def __create_ec2_instance(config: AWSConfig) -> str: # Describe the AMI to get the root device name ami = client.describe_images(ImageIds=[config.ami]) root_device_name = ami['Images'][0]['RootDeviceName'] + ami_storage = ami['Images'][0]['BlockDeviceMappings'][0]['Ebs']['VolumeSize'] + + if ami_storage > config.storage: + config.storage = ami_storage if config.platform == 'windows': with open(windosUserData_file, 'r') as file: userData = file.read() userData = userData.replace('ChangeMe', config.key_name) - config.storage = 60 else: with open(userData_file, 'r') as file: userData = file.read() @@ -278,12 +281,11 @@ def __parse_config(cls, params: CreationPayload, credentials: AWSCredentials, is # Parse the configuration. if platform == 'macos': os_specs['zone'] = os_specs['zone'] + 'c' + config['storage'] = 0 if arch == 'arm64': config['type'] = 'mac2.metal' - config['storage'] = 100 if arch == 'amd64': config['type'] = 'mac1.metal' - config['storage'] = 100 else: for spec in size_specs: if fnmatch.fnmatch(arch, spec):