AWS serverless
|
|
Import node modules to Lambda
|
|
Connect Lambda Node to API gateway
Make sure the returning object is in the correct format
Usually in this format!
123456var response = {'body': "correct",'statusCode': 200,"headers": { "Access-Control-Allow-Origin":'*'}};callback(null, response);How to access the arguments(GET)
1let msg = event["queryStringParameters"]["msg"];You can console.log the event to figure out for the POST method!
Connect Lambda Python to API gateway
Make sure returning in the correct format
12345678return dict(statusCode=200,headers={'Content-Type': 'application/json','Access-Control-Allow-Origin': '*'},body=json.dumps({'message': botmsg}))How to access the arguments(POST)
12receiveData = json.loads(event["body"])botmsg = autoReply(receiveData["message"])
AWS S3
|
|
Upload file to S3
S3 CORS configuration:
|
|
For React user, we can install
|
|
Code:
|
|
DynamoDB
Upload Data to the table
|
|
Specific json format can be checked in the file:
https://docs.aws.amazon.com/zh_cn/amazondynamodb/latest/developerguide/samples/sampledata.zip
Connect to DynamoDB with NodeJS
|
|
Search for Item numbers in the table
|
|
ElasticSearch with Lambda function IAM role
|
|