I need a simple AWS Lambda script that acts as an API endpoint.
Input: tenant-id, Username, Security-Token, KPI-id, tenant, start_date, end_date, interval
Logic: check if valid call (check if token and user is ok), based on KPI do simple SQL on DynamoDB:
Case1: SELECT SUM of products*salesamount
Case2: SELECT SUM of all transactions in interval from start_date
Output: JSON string of the results from DynamoDB.