Code Monkey home page Code Monkey logo

rust-lambda's Introduction

Writing AWS Lambda Functions in Rust

AWS Lambda Functions in Rust Build Status MIT License

This repository contains a working example of how to create serverless lambda functions using Rust that can be deployed onto Amazon Web Services.

The project is elaborated in more detail on SilentByte | Writing AWS Lambda Functions in Rust.

Building & Deploying the Project

To build this project, it is required to have Rust/Cargo, NodeJS 12, and Docker installed. Having an AWS account with properly configured access keys is not mandatory for building the project but required for deployment.

Steps

  1. Clone this repository.

  2. Install the Serverless Framework: npm install -g serverless.

  3. Within the project directory, run npm install.

  4. Run the following command to build and test the lambda function. This will compile the Rust project and build a Docker image for execution, so it may take a while to complete.

    serverless invoke local -f lucky_numbers -d \
               '{"body": "{\"name\":\"SilentByte\", \"count\": 10}"}'
  5. To deploy the project onto AWS, simply run serverless deploy. If the deployment succeeded, the CLI command will show you the URL of the API endpoint that has been created. You can then test against it using CURL by running:

    curl -X POST \
         -H "Content-Type: application/json" \
         -d '{"name":"SilentByte","count": 10}' \
         'https://wkawb52awb.execute-api.us-east-1.amazonaws.com/dev/lucky_numbers'

    With a result that should be similar to this JSON object:

    {
      "message": "Hi, 'SILENTBYTE'. Your lucky numbers are:",
      "numbers": [8, 23, 26, 21, 32, 24, 8, 40, 34, 2]
    }

License

See LICENSE.txt.

rust-lambda's People

Contributors

silentbyte avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.