Medplum Bot Layers | Medplum

Overview of Medplum Bots

Medplum Bots are functions that execute upon specific triggers. Think of them as AWS Lambda functions optimized for the Medplum environment. They are written, deployed, and triggered via FHIR Subscriptions, streamlining various integrations in Medplum.

Introduction to AWS Lambda Layers

Lambda Layers are .zip file archives that contain additional code or data, primarily used for library dependencies, custom runtimes, or configuration files. The reasons to use Lambda Layers are practical:

  1. Size Management: By moving function dependencies to a layer, deployment packages remain smaller.
  2. Code Organization: Layers allow for separation between core function logic and its dependencies. This means either can be updated independently.
  3. Dependency Sharing: Layers make it possible to set up dependencies once and use them across multiple functions.
  4. Utilizing Lambda Console Code Editor: For quick code edits, the editor is useful but has limitations with larger deployment packages. Layers can help mitigate this size issue.

How Medplum Uses Lambda Layers

Medplum's process for Lambda Layers is straightforward:

A Note for Self-Hosters

If you're hosting Medplum on your own infrastructure, remember that Bot layers don't auto-publish. To update the Bot Layer:

  1. Clone the Medplum Repo ( Note: You can clone the main Medplum repo instead of creating a fork)
  2. Build the Project
  3. Deploy: Utilize ./scripts/deploy-bot-layer.sh to deploy the new version.

Learn More