event["deviceEvent"]["buttonClicked"]["clickType"] print("ClickType:" + clickType) if( clickType == "SINGLE"): topicName = "iotdemo/topic/1" elif( clickType == "DOUBLE"): topicName = "iotdemo/topic/2" elif( clickType == "LONG"): topicName = "iotdemo/topic/3" print("topicName:" + topicName) iot = boto3.client('iot-data', region_name='ap-northeast-1') payload_data = "Hello from AWS lambda_handler" iot.publish(topic=topicName, qos=0, payload=payload_data) # TODO implement return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') }