in dcv_session_manager_infrastructure/dcv_session_manager_infrastructure_stack.py [0:0]
def create_enginframe(self, config, lb_enginframe, vpc, role_ef, ef_security_group, closing_hook, starting_hook, interactive_builtin_linux_desktop, interactive_builtin_windows_desktop):
# Userdata of the instances
data_enginframe = open("userdata/enginframe.sh", "rb").read()
enginframe_userdata = ec2.UserData.for_linux()
# Change some placeholders inside the userdata of the instances
data_enginframe_format = str(data_enginframe, 'utf-8').format(arn_secret_password=config['arn_efadmin_password'],
StackName=core.Aws.STACK_NAME,
RegionName=core.Aws.REGION,
ALB_DNS_NAME=lb_enginframe.load_balancer_dns_name,
closing_hook=closing_hook.s3_object_url,
starting_hook=starting_hook.s3_object_url,
interactive_builtin_linux_desktop=interactive_builtin_linux_desktop.s3_object_url,
interactive_builtin_windows_desktop=interactive_builtin_windows_desktop.s3_object_url)
# Add the userdata to the instances
enginframe_userdata.add_commands(data_enginframe_format)
# Search for the latest AMIs for the instances
linux_ami_enginframe = ec2.AmazonLinuxImage(generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
edition=ec2.AmazonLinuxEdition.STANDARD,
virtualization=ec2.AmazonLinuxVirt.HVM,
storage=ec2.AmazonLinuxStorage.GENERAL_PURPOSE
)
# EnginFrame instance ASG
asg_enginframe = self.create_asg("Enginframe", vpc, config['ec2_type_enginframe'], linux_ami_enginframe, enginframe_userdata,
role_ef, config['key_name'], 1, ef_security_group, "/dev/xvda", config['ebs_engingframe_size'])
return asg_enginframe