This is a sample serverless app with 2 parts:
- REST APIs for storing lat/long data to DynamoDB (Folder - Front-User-API)
- and then Pushing that data to ElasticSearch (Folder - ElasticSearch-Kibana-Cognito)
- ElasticSearch
- Kibana with Cognito Auth
- API to save lat/long data to DynamoDb Table
- Push data to elasticsearch via DynamoDB stream
- Deploy ElasticSearch Stack first
- Then Deploy DynamoDB and User APIs
- Clone to your machine
$ git clone [email protected]:yashwant/serverless-elasticsearch-kibana-logger.git
- Install dependencies
$ cd serverless-elasticsearch-kibana-logger/ElasticSearch-Kibana-Cognito
$ npm install
- Rename aws_params.tp to aws_params.yml & change parameters accordingly
$ mv aws_params.tp aws_params
- Deploy
$ serverless deploy
- Install dependencies
$ cd ../Front-User-API
$ npm install
- Rename aws_params.tp to aws_params.yml & change parameters accordingly
$ mv aws_params.tp aws_params
- Deploy
$ serverless deploy
You can use the REST API post method to post lat/long parameters.
POST method header
Content-Type: application/json
POST method sample body
{
"lat": 12.011,
"long": 13.003
}
To check the data in Elasticsearch via Kibana dashboard, create a new user in cognito userpool and verify that user.
- Create new user
$ aws cognito-idp sign-up --region us-east-1 --client-id <client id> --username <email> --password <password>
- Confirm user
$ aws cognito-idp admin-confirm-sign-up --region us-east-1 --user-pool-id <pool id> --username <user email>
- You can find Kibana dashboard URL via aws console Elasticsearch service.
- Login to kibana using credentials generated in above step.