Git Product home page Git Product logo

serverless-rust's Introduction

serverless rust Build Status npm

A โšก Serverless framework โšก plugin for Rustlang applications ๐Ÿฆ€

๐Ÿ“ฆ Install

Install the plugin with npm

$ npm i -D serverless-rust

๐Ÿ’ก This serverless plugin assumes you are building Rustlang lambdas targeting the AWS Lambda "provided" runtime. The AWS Lambda Rust Runtime makes this easy.

Add the following to your serverless project's serverless.yml file

service: demo
provider:
  name: aws
  runtime: rust
plugins:
  # this adds informs serverless to use
  # the serverless-rust plugin
  - serverless-rust
# creates one artifact for each function
package:
  individually: true
functions:
  test:
    # handler value syntax is `{cargo-package-name}.{bin-name}`
    # or `{cargo-package-name}` for short when you are building a
    # default bin for a given package.
    handler: your-cargo-package-name
    events:
      - http:
          path: /test
          method: GET

๐Ÿ’ก The Rust Lambda runtime requires a binary named bootstrap. This plugin renames the binary cargo builds to bootstrap for you before packaging. You do not need to do this manually in your Cargo configuration.

๐Ÿ–๏ธ customize

You can optionally adjust the default settings of the dockerized build env using a custom section of your serverless.yaml configuration

custom:
  # this section allows for customization of the default
  # serverless-rust plugin settings
  rust:
    # flags passed to cargo
    cargoFlags: '--features enable-awesome'
    # custom docker tag
    dockerTag: 'some-custom-tag'

๐ŸŽจ Per function customization

If your serverless project contains multiple functions, you may sometimes need to customize the options above at the function level. You can do this by defining a rust key with the same options inline in your function specification.

functions:
  test:
    rust:
      # function specific flags passed to cargo
      cargoFlags: '--features enable-awesome'
    # handler value syntax is `{cargo-package-name}.{bin-name}`
    # or `{cargo-package-name}` for short when you are building a
    # default bin for a given package.
    handler: your-cargo-package-name
    events:
      - http:
          path: /test
          method: GET

๐Ÿคธ usage

Every serverless workflow command should work out of the box.

invoke your lambdas locally

$ npx serverless invoke local -f hello -d '{"hello":"world"}'

deploy your lambdas to the cloud

$ npx serverless deploy

invoke your lambdas in the cloud directly

$ npx serverless invoke -f hello -d '{"hello":"world"}'

view your lambdas logs

$ npx serverless logs -f hello

๐Ÿ—๏ธ serverless templates

^0.2.*

0.1.*

Older versions targeted the python 3.6 AWS Lambda runtime and rust crowbar and lando applications

Doug Tangren (softprops) 2018-2019

serverless-rust's People

Contributors

chdsbd avatar ilmari avatar jasondavies avatar maxcountryman avatar softprops avatar

Watchers

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