I am new to Cloud Programming, and need to trigger the Lambda function below (function name = dbscan-py) with a button-click in my HTML code but can't figure out how to, nor know how to debug to see if it's getting triggered.
import json
import boto3
dynamodb = boto3.client('dynamodb')
def dump_table(table_name):
results = []
last_evaluated_key = None
while True:
if last_evaluated_key:
response = client.scan(
TableName=table_name,
ExclusiveStartKey=last_evaluated_key
)
else:
response = dynamodb.scan(TableName=table_name)
last_evaluated_key = response.get('LastEvaluatedKey')
results.extend(response['Items'])
if not last_evaluated_key:
break
return results
def lambda_handler(event, context):
table_rows=dump_table('log')
# table_rows is an array/list of rows objects [{ },{},{}]
text=repr(table_rows)
# text is human readable in python
return {
'statusCode': 200,
'body': text
}