in dcv_session_manager_infrastructure/dcv_session_manager_infrastructure_stack.py [0:0]
def create_dcv_windows(self, config, vpc, role_dcv, dcv_security_group):
# Userdata of the instances
data_dcv_windows = open("userdata/dcv_windows.ps", "rb").read()
dcv_windows_userdata = ec2.UserData.for_windows()
# Change some placeholders inside the userdata of the instances
data_dcv_windows_format = str(data_dcv_windows, 'utf-8').format(arn_secret_password=config['arn_efadmin_password'],
StackName=core.Aws.STACK_NAME,
RegionName=core.Aws.REGION)
# Add the userdata to the instances
dcv_windows_userdata.add_commands(data_dcv_windows_format)
# Search for the latest AMIs for the instances
windows_ami_dcv_linux = ec2.MachineImage.lookup(
name="DCV-Windows*NVIDIA*",
owners=["amazon"]
)
# Windows DCV instances ASG
asg_dcv_windows = self.create_asg("dcv_windows", vpc, config['ec2_type_dcv_linux'], windows_ami_dcv_linux, dcv_windows_userdata,
role_dcv, config['key_name'], config['windows_dcv_number'], dcv_security_group, "/dev/sda1", config['ebs_dcv_windows_size'])
return asg_dcv_windows