ECR FHIR receiver Lambda function
Prerequisites:
- Java 17 or Higher
- AWS SDK - STS or Eclipse
- AWS Account
- Maven 3.3.x
- GIT
Clone the repository using the below command in command prompt
git clone https://github.com/drajer-health/ecr-fhir-receiver-lambda.git
Import Project as Maven Project Build ECR FHIR Receiver AWS Lambda Service:
Navigate to ecr-fhir-receiver-lambda directory ..../
and run Maven build to build lambda jar file.
$ mvn clean install
This will generate a war file under target/ecr-fhir-receiver-lambda.jar.
Login to your AWS Account
-
Click on Services then select Lambda
-
Click on Create Function
-
Select "Author from Scratch" option
-
Enter:
Function Name: ecrFHIRReceiverLambda
Runtime: Java 17
Permissions: Create a new role with basic Lambda permissions or select your organization specific security
- Click on "Create Function"
At this point Lambda function would be created, navigate to the newly created function and configure the lambda function and environment variable.
-
Under the "Code" tab select "Upload from"
-
Select .zip or .jar file option
-
Click upload and navigate to your local workspace target folder and select ecr-fhir-receiver-lambda.jar and click "Save"
-
Click on "Edit" on "Runtime Settings"
-
Enter below value for Handler
com.drajer.ecr.receiver.lambda.ECRFHIRReceiverLambdaFunctionHandler
-
Click "Save"
-
Click on "Configuration" tab and then "Environment Variables"
-
Click on "Edit" to add new environment variable
-
Click on "Add new environment variable"
-
Enter
-
Click on "Configuration" tab and then "Monitoring and operations tools"
-
Click on "Edit" under "Additional monitoring tools"
-
Click on "Enable" for "Lambda service traces"
-
Click on "Save"
Key: HTTP_POST_URL
Value: <<THIS SHOULD BE YOUR FHIR SERVER URL FOR THE REQUEST TO BE FORWARDED>>
-
Click on "Test" tab
-
Use the test/resource/ecrFHIRReceiverTestData.json data to test newly created Lambda Function
-
Click on Services and search for "API Gateway"
-
Click on "Create New"
-
Click on "Build" on Rest API option
-
Enter
Choose Protocol: REST
Create New API: New API
Settings:
API Name: $process-message
Description: eCR FHIR Receiver Lambda function to forward ecr data to FHIR service
EndPoint Type: Regional or based on your organizational needs
-
Click Create API
-
Click on "Actions -> Create Resource"
-
Enter
Resource Name*: $process-message
Resource Path*: $process-message
-
Click "Create Resource"
-
Select $process-message and then click "Actions -> Create Method"
-
Select "ANY" and click on tick mark
-
Enter
Integration Type: Lambda Function
Use Lambda Proxy Integration: Checked
Lambda Function: ecrFHIRReceiverLambda
-
Click "Save"
-
Click "Ok" to add permissions for lambda and API gateway
-
Click "Actions -> Deploy API"
-
Select "Deployment Stage"
-
Enter
Stage Name*: dev
Stage Description: Development Environment
Deployment Description: Development Environment
-
Click "Deploy"
-
API Gateway is configured !!!!
NOTE: Make a note of API Gateway end point and use ECRFHIRReceiverLambdaHttpClient.java to run the test