in source/Lambda/innovation_tgw_route_tables.py [0:0]
def create(event, context):
logger.info(event)
try:
props = event["ResourceProperties"]
mgmt = props['Appstream_Account_ID']
tgw_id = props['Tgw_ID']
egress_attach_id = props['Egress_Attach']
sbx_attach_id = props['Sbx_Attach']
tb = props['Template_Base_Path']
credentials = assume_role(mgmt)
logger.info("Running TGW Stack")
run_stack( mgmt, tb+"InnovationSandboxTransitGatewaySetup.template", credentials, [
{
'ParameterKey': 'TGID',
'ParameterValue': tgw_id
},
{
'ParameterKey': 'EGREEATTCH',
'ParameterValue': egress_attach_id
},
{
'ParameterKey': 'SBXTGATTCH',
'ParameterValue': sbx_attach_id
}
],'InnovationMgmtTGWStack')
responseData = {"Message":"Successfly Deployed Innovation Architecture"}
send(event, context, SUCCESS,
responseData, "TGW_RT_Setup")
except Exception as e:
message = {'MESSAGE': 'Exception occurred while creating/attaching SCPs',
'FILE': __file__.split('/')[-1], 'METHOD': inspect.stack()[0][3], 'EXCEPTION': str(e), 'TRACE': traceback.format_exc()}
logger.exception(message)
errorResponseData = {
"Message":"TGW Route Tables Setup Failed"
}
send(event, context, FAILED,
errorResponseData, "TGW_RT_Setup")