How to run an External Adapter on AWS Lambda

Learn how to setup and run an external adapter on AWS Lambda

Published 27th February 2019 • Updated 27th February 2019
Share this guide:

Introduction

In order to increase uptime and reduce maintenance overhead, it can be beneficial to use serverless services to execute your Chainlink external adapters. One of these is AWS Lambda, which will run an external adapter on in this guide.

Also read: How to run an External Adapter on GCP

Prerequisites

  • An AWS account, funded with access to AWS Lambda
  • You want to run an external adapter that supports AWS Lambda
    Tip: Use our list and filter/look for the AWS Lambda symbol λ

Step 1  Create a new AWS Lambda function

Navigate to the AWS Lambda section of the AWS Console. The quickest method is to click the Services menu and type in Lambda. You will be presented by a form. Make sure you select Author from scratch.

Name
Give your function a name that makes sense, so you remember it's purpose.
Runtime
Set to what's appropriate for your adapter.
Role
Create a new role or chose an existing one.
AWS Lambda create function form

Submit the form to create the function. This may take a few seconds.

Step 2  Upload the adapter

Once created, you should be presented a page showing the configuration of your function. This includes your adapter's code, environment variables and other configuration options.

AWS Lambda function configuration

We now have to upload the adapter that you prepared earlier (Prepare external adapter for AWS/GCP).

Under Function code, change Code entry type to Upload a .zip file. Select the ZIP file you prepared and upload. Also change Handler to what's relevant for your adapter (in this case, change to index.handler).

If you need to set Environment variables, you could also do this now. Just enter the keys and values in the panel below.

When done, click Save in the top right corner. The Function code panel should now show the source code of the adapter you uploaded.

Step 3  Add API Gateway/Endpoint

Click on the Designer panel to expand it. By default, your function should be selected. If it's not, select it. From the left Add trigger menu, click API Gateway. A new Configure triggers panel should appear.

In the new form that appears, select Create a new API. For security, select Open.

Add API gateway

When done, click Add then the Save button you clicked previously. Once completed saving, an API Endpoint URL should appear in the API Gateway panel.

That's it! Your external adapter has now been setup and is ready on AWS Lambda! You should now be ready to proceed to How to link Chainlink to URL endpoint using the URL for your AWS Lambda function.

Copyright © 2021 Fiews, LLC
Privacy PolicyCookie Policy
AboutAdvertiseAPI