def create()

in source/Lambda/innovation_run_mgmt_stack.py [0:0]


def create(event, context):

    logger.info(event)

    try:

        props = event["ResourceProperties"]

        appstream_act_id= props['Appstream_Account_ID']
        sbx_act_id = props['Sandbox_Account_ID']
        tb = props['Template_Base_Path']

        credentials = assume_role(appstream_act_id)

        s3_public_settings(appstream_act_id, credentials)

        logger.info("Running Management Stack")
        run_stack(
            appstream_act_id, tb + "InnovationSandboxManagementAccount.template", credentials, [{
                'ParameterKey': 'SbxAccountId',
                'ParameterValue': sbx_act_id
            },
                {
                    'ParameterKey': 'UUID',
                    'ParameterValue': str(uuid.uuid4()).replace('-', '')
                }
            ], 'InnovationSbxMgmtStack')

        tgw_id_details = get_transit_gateway_id_mgmt(credentials)

        tgw_id = tgw_id_details[0]

        egress_attach_id = tgw_id_details[1]

        eip = get_elastic_ip_mgmt(credentials)

        responseData = {
            "TGW_ID": tgw_id,
            "EGRESS_ATTACH_ID": egress_attach_id,
            "EIP": eip[0],
            "EIP2": eip[1]
        }

        send(event, context, SUCCESS,
             responseData, "AppStream_Account_Network_Setup")
    except Exception as e:
        message = {'MESSAGE': 'Error while launching the stack in the AppStream Account',
                              'FILE': __file__.split('/')[-1], 'METHOD': inspect.stack()[0][3], 'EXCEPTION': str(e), 'TRACE': traceback.format_exc()}
        logger.exception(message)
        raise