In this section, we will establish an API Gateway to facilitate data reception from the sensors. This API Gateway will trigger the Lambda function, which will subsequently store the data in Amazon S3 and OpenSearch Service.
Access the API Gateway console.
On the REST API card, select Build.
For Create new API, opt for New API. Name the API as sensor-data
and then initiate Create API.
In the Resources section, from the Actions menu, choose Create Method. From the dropdown, select POST.
For POST - Setup, ensure:
upload-data
.In the POST - Method Execution section, opt for TEST.
In the Request Body box, input the following JSON:
{
"sensorID" : "0047",
"temperature" : "23"
}
Successfully, you’ve set up and tested an API Gateway to receive data from sensors and activate the Lambda function.