Example #1
0
    def test_launch_config(self):
        # This unit test is based on #753 and #1343
        self.set_http_response(status_code=200)
        dev_sdf = EBSBlockDeviceType(snapshot_id='snap-12345')
        dev_sdg = EBSBlockDeviceType(snapshot_id='snap-12346')

        bdm = BlockDeviceMapping()
        bdm['/dev/sdf'] = dev_sdf
        bdm['/dev/sdg'] = dev_sdg

        lc = launchconfig.LaunchConfiguration(
            connection=self.service_connection,
            name='launch_config',
            image_id='123456',
            instance_type='m1.large',
            user_data='#!/bin/bash',
            security_groups=['group1', 'group2'],
            spot_price='price',
            block_device_mappings=[bdm],
            associate_public_ip_address=True,
            volume_type='atype',
            delete_on_termination=False,
            iops=3000)

        response = self.service_connection.create_launch_configuration(lc)

        self.assert_request_parameters(
            {
                'Action': 'CreateLaunchConfiguration',
                'BlockDeviceMappings.member.1.DeviceName': '/dev/sdf',
                'BlockDeviceMappings.member.1.Ebs.DeleteOnTermination':
                'false',
                'BlockDeviceMappings.member.1.Ebs.SnapshotId': 'snap-12345',
                'BlockDeviceMappings.member.2.DeviceName': '/dev/sdg',
                'BlockDeviceMappings.member.2.Ebs.DeleteOnTermination':
                'false',
                'BlockDeviceMappings.member.2.Ebs.SnapshotId': 'snap-12346',
                'EbsOptimized': 'false',
                'LaunchConfigurationName': 'launch_config',
                'ImageId': '123456',
                'UserData': base64.b64encode('#!/bin/bash').decode('utf-8'),
                'InstanceMonitoring.Enabled': 'false',
                'InstanceType': 'm1.large',
                'SecurityGroups.member.1': 'group1',
                'SecurityGroups.member.2': 'group2',
                'SpotPrice': 'price',
                'AssociatePublicIpAddress': 'true',
                'VolumeType': 'atype',
                'DeleteOnTermination': 'false',
                'Iops': 3000,
            },
            ignore_params_values=['Version'])
Example #2
0
    def test_launch_config(self):
        # This unit test is based on #753 and #1343
        self.set_http_response(status_code=200)
        dev_sdf = EBSBlockDeviceType(snapshot_id='snap-12345')
        dev_sdg = EBSBlockDeviceType(snapshot_id='snap-12346')

        bdm = BlockDeviceMapping()
        bdm['/dev/sdf'] = dev_sdf
        bdm['/dev/sdg'] = dev_sdg

        lc = launchconfig.LaunchConfiguration(
            connection=self.service_connection,
            name='launch_config',
            image_id='123456',
            instance_type='m1.large',
            security_groups=['group1', 'group2'],
            spot_price='price',
            block_device_mappings=[bdm])

        response = self.service_connection.create_launch_configuration(lc)

        self.assert_request_parameters(
            {
                'Action': 'CreateLaunchConfiguration',
                'BlockDeviceMappings.member.1.DeviceName': '/dev/sdf',
                'BlockDeviceMappings.member.1.Ebs.DeleteOnTermination':
                'false',
                'BlockDeviceMappings.member.1.Ebs.SnapshotId': 'snap-12345',
                'BlockDeviceMappings.member.2.DeviceName': '/dev/sdg',
                'BlockDeviceMappings.member.2.Ebs.DeleteOnTermination':
                'false',
                'BlockDeviceMappings.member.2.Ebs.SnapshotId': 'snap-12346',
                'EbsOptimized': 'false',
                'LaunchConfigurationName': 'launch_config',
                'ImageId': '123456',
                'InstanceMonitoring.Enabled': 'false',
                'InstanceType': 'm1.large',
                'SecurityGroups.member.1': 'group1',
                'SecurityGroups.member.2': 'group2',
                'SpotPrice': 'price',
            },
            ignore_params_values=['Version'])