This repository contains the AWS Lambda functions to support CRUD operations for HSDS organization datasets. The Lambda functions are vended behind an API and are listening to APIGatewayEvents.
Install sam (see docs).
Move to the organization-handler-lambda
cd function/organization-handler-lambda
Build the lambda
sam build
Invoke the lambda
sam local invoke OrganizationLambdaTest --event event.json
You start an http server to invoke the Lambda function. If you look at the
template.yaml
file, you will find the following definition:
Events:
Api:
Type: Api
Properties:
Path: /organizations
Method: GET
This will publish a GET HTTP endpoint on http://127.0.0.1:3000/organizations
that will invoke the lambda.
If you want to test any other endpoint you will need to change the Path
and Method
property in the template.yaml
file.
You can start the development server running
cd function/organization-handler-lambda
sam build
sam local start-api
Any changes made to the Lambda function will be reflected automatically without having to run
sam local start-api
. However, if you make any changes to the template.yaml
file you will need
to run sam build
.
Make sure that the init.sh
command is executable.
chmod +x initdb/init.sh
Spin up the docker container with DynamoDB.
docker-compose up -d
This will create a container with DynamoDB. The database can be accessed in port 8080.
We will be following the Google Java Style Guide. To format your code before pushing you need to run the formatter:
cd function/organization-handler-lambda
mvn formatter:format