Code Monkey home page Code Monkey logo

rust-aws-lambda's Introduction

AWS Lambda Rust Application Example

This repository contains an architecture of an AWS Lambda Rust Application. This couldn't have been possible without the great article from SilentByte.

To-do soon : Putting a good structure of tests

Architecture

This application is composed of four crates (subprojects) :

  • lambda_dispatcher : contains the necessary interface for working with AWS Lambda
  • spotipal_api : contains the DTO objects used for requests and responses
  • spotipal_business : this contains the main business logic of the application
  • webserver : a webserver wrapper permitting you to launch your app locally, mainly for dev purposes but you could use it to deploy your app in production without the using of the lambdas

Launching a local webserver

You will need Rust Nightly toolchain installed on your computer

You can launch your webserver localy thanks to the webserver included, with the following command :

cargo run --bin webserver

This should launch your webserver. You should make a POST request at http://localhost:3000/hello-world with the following content :

{
  "name": "Dimitri"
}

And you will have a nice hello world message with your name on it !

Testing locally your lambda

You will need Serverless installed on your computer, and Docker installed, and running

You will probably want to test your lambda before deploying it. Serverless allows local invocation of the lambda, using the following request :

serverless invoke local -f hello-world -d '{"body": "{\"name\":\"Dimitri\"}"}'

And the emulated lambda will answer you ! Victory !

Deploying your lambda

For this, you will need to configure your serverless account, login with it, and connect it to your aws account.

Once it's done, you will just have to do this :

serverless deploy

And your lambda should be uploaded and running in seconds !

rust-aws-lambda's People

Contributors

bachrc 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.