Sample serverless application written in Rust

Overview

Serverless Rust Demo

build

Architecture diagram

This is a simple serverless application built in Rust. It consists of an API Gateway backed by four Lambda functions and a DynamoDB table for storage.

This single crate will create four different binaries, one for each Lambda function. It uses an hexagonal architecture pattern to decouple the entry points, from the main domain logic, and the storage layer.

Requirements

Usage

# Compile and prepare Lambda functions
make build

# Deploy the functions on AWS
make deploy

# Run local and integration tests against the API in the cloud
make tests

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Comments
  • Build broken on Apple Silicon computers (and/or Graviton2 builds)

    Build broken on Apple Silicon computers (and/or Graviton2 builds)

    Hello @nmoutschen, branching out our discussions over here from https://twitter.com/braincode/status/1443549985803431947...

    Also, btw, this is an issue I originally reported upstream on https://github.com/briansmith/ring/issues/1332

    $ git clone https://github.com/aws-samples/serverless-rust-demo.git
    Cloning into 'serverless-rust-demo'...
    remote: Enumerating objects: 43, done.
    remote: Counting objects: 100% (43/43), done.
    remote: Compressing objects: 100% (32/32), done.
    remote: Total 43 (delta 13), reused 34 (delta 10), pack-reused 0
    Receiving objects: 100% (43/43), 14.43 KiB | 3.61 MiB/s, done.
    Resolving deltas: 100% (13/13), done.
    $ cd serverless-rust-demo
    $ make build
    cargo build --release --target aarch64-unknown-linux-gnu
        Updating crates.io index
        Updating git repository `https://github.com/awslabs/aws-sdk-rust`
       Compiling libc v0.2.103
       Compiling proc-macro2 v1.0.29
       Compiling unicode-xid v0.2.2
       Compiling syn v1.0.77
       Compiling autocfg v1.0.1
       Compiling cfg-if v1.0.0
       Compiling log v0.4.14
       Compiling pin-project-lite v0.2.7
       Compiling once_cell v1.8.0
       Compiling lazy_static v1.4.0
       Compiling memchr v2.4.1
       Compiling bytes v1.1.0
       Compiling smallvec v1.7.0
       Compiling futures-core v0.3.17
       Compiling itoa v0.4.8
       Compiling parking_lot_core v0.8.5
       Compiling scopeguard v1.1.0
       Compiling proc-macro-hack v0.5.19
       Compiling futures-channel v0.3.17
       Compiling proc-macro-nested v0.1.7
       Compiling futures-task v0.3.17
       Compiling futures-sink v0.3.17
       Compiling pin-utils v0.1.0
       Compiling slab v0.4.4
       Compiling futures-io v0.3.17
       Compiling ryu v1.0.5
       Compiling fnv v1.0.7
       Compiling hashbrown v0.11.2
       Compiling httparse v1.5.1
       Compiling tower-service v0.3.1
       Compiling try-lock v0.2.3
       Compiling percent-encoding v2.1.0
       Compiling httpdate v1.0.1
       Compiling cc v1.0.70
       Compiling spin v0.5.2
       Compiling untrusted v0.7.1
       Compiling semver v1.0.4
       Compiling either v1.6.1
       Compiling regex-syntax v0.6.25
       Compiling ppv-lite86 v0.2.10
       Compiling base64 v0.13.0
       Compiling anyhow v1.0.44
       Compiling serde_derive v1.0.130
       Compiling serde v1.0.130
       Compiling tower-layer v0.3.1
       Compiling zeroize v1.4.2
       Compiling matches v0.1.9
       Compiling serde_json v1.0.68
       Compiling openssl-probe v0.1.4
       Compiling hex v0.4.3
       Compiling async-trait v0.1.51
       Compiling fixedbitset v0.2.0
       Compiling remove_dir_all v0.5.3
       Compiling crossbeam-utils v0.8.5
       Compiling unicode-segmentation v1.8.0
       Compiling ansi_term v0.12.1
       Compiling multimap v0.8.3
       Compiling fastrand v1.5.0
       Compiling urlencoding v1.3.3
       Compiling xmlparser v0.13.3
       Compiling instant v0.1.11
       Compiling tracing-core v0.1.20
       Compiling sharded-slab v0.1.3
       Compiling thread_local v1.1.3
       Compiling indexmap v1.7.0
       Compiling tokio v1.12.0
       Compiling futures-macro v0.3.17
       Compiling futures-util v0.3.17
       Compiling num-traits v0.2.14
       Compiling num-integer v0.1.44
       Compiling lock_api v0.4.5
       Compiling http v0.2.5
       Compiling itertools v0.10.1
       Compiling bytes-utils v0.1.1
       Compiling form_urlencoded v1.0.1
       Compiling ring v0.16.20
       Compiling heck v0.3.3
       Compiling regex v1.5.4
       Compiling regex-automata v0.1.10
       Compiling want v0.3.0
       Compiling tracing-log v0.1.2
    error: failed to run custom build command for `ring v0.16.20`
    
    Caused by:
      process didn't exit successfully: `/Users/rvalls/dev/umccr/serverless-rust-demo/target/release/build/ring-5100f9369a354546/build-script-build` (exit status: 101)
      --- stdout
      OPT_LEVEL = Some("3")
      TARGET = Some("aarch64-unknown-linux-gnu")
      HOST = Some("aarch64-apple-darwin")
      CC_aarch64-unknown-linux-gnu = None
      CC_aarch64_unknown_linux_gnu = Some("aarch64-linux-gnu-gcc")
      CFLAGS_aarch64-unknown-linux-gnu = None
      CFLAGS_aarch64_unknown_linux_gnu = None
      TARGET_CFLAGS = None
      CFLAGS = None
      CRATE_CC_NO_DEFAULTS = None
      DEBUG = Some("false")
      CARGO_CFG_TARGET_FEATURE = None
    
      --- stderr
      running "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-DNDEBUG" "-c" "-o/Users/rvalls/dev/umccr/serverless-rust-demo/target/aarch64-unknown-linux-gnu/release/build/ring-5243877d4a8e9964/out/aesv8-armx-linux64.o" "/Users/rvalls/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-linux64.S"
      thread 'main' panicked at 'failed to execute ["aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-DNDEBUG" "-c" "-o/Users/rvalls/dev/umccr/serverless-rust-demo/target/aarch64-unknown-linux-gnu/release/build/ring-5243877d4a8e9964/out/aesv8-armx-linux64.o" "/Users/rvalls/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-linux64.S"]: No such file or directory (os error 2)', /Users/rvalls/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:653:9
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    make: *** [build] Error 101
    
    opened by brainstorm 10
  • Error(

    Error("data did not match any variant of untagged enum LambdaRequest")

    Hi Nicolas, Excellent work thank you so much!

    I was trying to run it locally, everything seemed fine but I cannot interact with local sam.

    here are the steps that I ran:

    • updated some dependencies from 0.0.24-alpha to 0.0.25-alpha because it seems 0.0.24-alpha are not available anymore
    • build and deploy the first time to create was resources
    docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
    
    make build 
    sam deploy --stack-name serverless-rust-demo --resolve-s3 --capabilities CAPABILITY_IAM
    
    • run the local API
    sam local start-api --debug --profile default
    

    -try to insert an item

    curl -X PUT -H "Content-Type: application/json" -d '{"id"": "i1", "name": "name1", "price": "1"}' http://localhost:3000/i1
    

    some resulting logs

    2021-11-17 06:59:10,537 | Mounting PutProductFunction at http://127.0.0.1:3000/{id} [PUT]
    2021-11-17 06:59:10,537 | Mounting DeleteProductFunction at http://127.0.0.1:3000/{id} [DELETE]
    2021-11-17 06:59:10,537 | Mounting GetProductFunction at http://127.0.0.1:3000/{id} [GET]
    2021-11-17 06:59:10,537 | Mounting GetProductsFunction at http://127.0.0.1:3000/ [GET]
    2021-11-17 06:59:10,537 | You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
    2021-11-17 06:59:10,537 | Localhost server is starting up. Multi-threading = True
    2021-11-17 06:59:10  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
    2021-11-17 06:59:19,628 | Constructed String representation of Event Version 2.0 to invoke Lambda. Event: {"version": "2.0", "routeKey": "PUT /<id>", "rawPath": "/i1", "rawQueryString": "", "cookies": [], "headers": {"Host": "127.0.0.1:3000", "User-Agent": "curl/7.68.0", "Accept": "*/*", "Content-Type": "application/json", "Content-Length": "44", "X-Forwarded-Proto": "http", "X-Forwarded-Port": "3000"}, "queryStringParameters": {}, "requestContext": {"accountId": "123456789012", "apiId": "1234567890", "http": {"method": "PUT", "path": "/i1", "protocol": "HTTP/1.1", "sourceIp": "127.0.0.1", "userAgent": "Custom User Agent String"}, "requestId": "d448b162-7c1c-4bad-bba2-0f10bf9257f4", "routeKey": "PUT /<id>", "stage": "$default", "time": "16/Nov/2021:19:59:10 +0000", "timeEpoch": 1637092750, "domainName": "localhost", "domainPrefix": "localhost"}, "body": "{\"id\"\": \"i1\", \"name\": \"name1\", \"price\": \"1\"}", "pathParameters": {"id": "i1"}, "stageVariables": null, "isBase64Encoded": false}
    2021-11-17 06:59:19,629 | Found one Lambda function with name 'PutProductFunction'
    2021-11-17 06:59:19,629 | Invoking bootstrap (provided.al2)
    2021-11-17 06:59:19,629 | Environment variables overrides data is standard format
    2021-11-17 06:59:19,629 | Loading AWS credentials from session with profile 'default'
    2021-11-17 06:59:19,639 | Resolving code path. Cwd=/home/pc/Documents/funspace/serverless-rust-demo-main, CodeUri=/home/pc/Documents/funspace/serverless-rust-demo-main/build/put-product
    2021-11-17 06:59:19,639 | Resolved absolute path to code is /home/pc/Documents/funspace/serverless-rust-demo-main/build/put-product
    2021-11-17 06:59:19,639 | Code /home/pc/Documents/funspace/serverless-rust-demo-main/build/put-product is not a zip/jar file
    2021-11-17 06:59:19,651 | Skip pulling image and use local one: public.ecr.aws/sam/emulation-provided.al2:rapid-1.35.0-arm64.
    
    2021-11-17 06:59:19,651 | Mounting /home/pc/Documents/funspace/serverless-rust-demo-main/build/put-product as /var/task:ro,delegated inside runtime container
    2021-11-17 06:59:20,136 | Starting a timer for 5 seconds for function 'PutProductFunction'
    START RequestId: ba4e9de5-a60f-499a-9912-74010803ddee Version: $LATEST
    {"timestamp":"Nov 16 19:59:20.255","level":"INFO","fields":{"message":"config file not found","path":"~/.aws/config"},"target":"aws_config::profile::parser::source","span":{"name":"load_config_file"},"spans":[{"name":"get_store"},{"name":"load_config_file"}]}
    {"timestamp":"Nov 16 19:59:20.270","level":"INFO","fields":{"message":"config file loaded","path":"~/.aws/config","size":"0"},"target":"aws_config::profile::parser::source","span":{"name":"load_config_file"},"spans":[{"name":"get_store"},{"name":"load_config_file"}]}
    {"timestamp":"Nov 16 19:59:20.271","level":"INFO","fields":{"message":"config file not found","path":"~/.aws/credentials"},"target":"aws_config::profile::parser::source","span":{"name":"load_credentials_file"},"spans":[{"name":"get_store"},{"name":"load_credentials_file"}]}
    {"timestamp":"Nov 16 19:59:20.271","level":"INFO","fields":{"message":"config file loaded","path":"~/.aws/credentials","size":"0"},"target":"aws_config::profile::parser::source","span":{"name":"load_credentials_file"},"spans":[{"name":"get_store"},{"name":"load_credentials_file"}]}
    {"timestamp":"Nov 16 19:59:20.273","level":"WARN","fields":{"message":"failed to get selected 'default' profile"},"target":"aws_config::profile::retry_config","span":{"name":"get_store"},"spans":[{"name":"get_store"}]}
    {"timestamp":"Nov 16 19:59:20.301","level":"INFO","fields":{"message":"Initializing DynamoDB store with table name: Table"},"target":"products::utils","span":{"name":"get_store"},"spans":[{"name":"get_store"}]}
    Error: Error("data did not match any variant of untagged enum LambdaRequest", line: 0, column: 0)
    END RequestId: ba4e9de5-a60f-499a-9912-74010803ddee
    REPORT RequestId: ba4e9de5-a60f-499a-9912-74010803ddee  Init Duration: 0.16 ms  Duration: 310.09 msBilled Duration: 400 ms  Memory Size: 128 MB     Max Memory Used: 128 MB
    2021-11-17 06:59:20,734 | Cleaning all decompressed code dirs
    2021-11-17 06:59:20,735 | Unable to find Click Context for getting session_id.
    2021-11-17 06:59:20,735 | Invalid lambda response received: Lambda response must be valid json
    2021-11-17 06:59:20 127.0.0.1 - - [17/Nov/2021 06:59:20] "PUT /i1 HTTP/1.1" 502 -
    

    What am I doing wrong, please? Thanks

    opened by johhnsmmith198 6
  • fix: switch to cross for cross-compilation

    fix: switch to cross for cross-compilation

    Issue #, if available: https://github.com/aws-samples/serverless-rust-demo/issues/2

    Description of changes:

    Switch to cross for cross-compiling to aarch64-unknown-linux-gnu.

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by nmoutschen 5
  • 'Missing Id' in DynamoDBEvent parsing - eventVersion 1.1 instead of eventVersion1.0?

    'Missing Id' in DynamoDBEvent parsing - eventVersion 1.1 instead of eventVersion1.0?

    Thank you for putting this project together - I'm learning Rust (I have some background with Haskell and Purescript), and love tests and hexagons. I have no experience with DynamoDBEvents, nor investigating issues with it, so I may be seeing this wrong, any suggestions appreciated.

    Steps to reproduce:

    • checkout 730e50d (could also be 1d42a99, I just watched the twitch stream, thanks)
    • deploy to eu-central-1
    • run make tests-integ

    Expected result:

    • Most runs of DDBStreamsFunction succeed (not sure about the test with the broken product id)

    Actual result:

    • All runs of DDBStreamsFunction fail (great to see the provided retry logic works)

    From a CloudWatch log:

    {"timestamp":"Nov 16 10:03:52.779","level":"INFO","fields":{"message":"Transform events"},"target":"products::entrypoints::lambda::dynamodb","span":{"name":"parse_events"},"spans":[{"name":"parse_events"}]}
    49
    2021-11-16T10:03:52.779+00:00
    {"timestamp":"Nov 16 10:03:52.779","level":"ERROR","fields":{"message":"InternalError: Missing id"},"target":"lambda_runtime"}
    

    Possible fix: Also (or only?) allow lowercased field names (price, name and id), and parse ApproximateCreationDateTime as a float instead of an int.

    I changed src/entrypoints/lambda/dynamodb/mod.rs to print the incoming JSON value (I had to change the type to Value, because parsing changes the casing to be snake_case. not complaining, but makes extracting a unit test harder) and then copied that into a test in that mod.rs .

    The existing unit tests in src/entrypoints/lambda/dynamodb/model.rs have "eventVersion": "1.0", the incoming JSON had "eventVersion": "1.1". I have searched, but not been able to find documentation for the various versions.

    I don't understand why the casing of the filenames changes, as they are part of the dynamodb model. Full messy branch here, this now works for me and sends messages to EventBridge. It is not ready for a pull request, I still don't understand what is going on here. Just curious about your ideas.

    opened by mostalive 4
  • Add basic CI

    Add basic CI

    Description of changes: Add continuous integration via GHA to catch issues like #2 early.

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by brainstorm 4
  • Question: why is the MemorySize for DDBStreamsFunction 3072 ?

    Question: why is the MemorySize for DDBStreamsFunction 3072 ?

    Hi, again thanks for putting this sample together, it is much appreciated.

    I'm wondering why, unlike the other lambda functions that have 128MB as default, DDBStreamsFunction has MemorySize: 3072. I couldn't find it in the commit history, and it seems to use 24MB or so (which is great!) when running the tests.

    opened by mostalive 2
  • Use cargo-lambda to build binaries

    Use cargo-lambda to build binaries

    This Cargo subcommand abstracts away most of the boilerplate necessary to work with zigbuild and organize binaries.

    You can see more information in the links below:

    https://crates.io/crates/cargo-lambda https://github.com/calavera/cargo-lambda

    Signed-off-by: David Calavera [email protected]

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by calavera 1
  • Feature/cleanup eventbridge

    Feature/cleanup eventbridge

    Description of changes:

    • Removed outdated comments
    • Use DynConnector for eventbridge (same as the store refactoring)

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by hffmnn 1
  • Use http status code constants

    Use http status code constants

    Description of changes:

    This changes the api gateway lambda entrypoints to use http status code constants from http instead of literals. No functional change, but I think it increases readability and reduces risk of errors and the cognitive load (I don't have to know what e.g. status code `201' means) when using the constants.

    This also included some typo fixes.

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by mbergkvist 1
  • Add link to .NET sample

    Add link to .NET sample

    Issue #, if available:

    Add link to .NET samples.

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by jeastham1993 0
  • chore: bump aws sdk to 0.7

    chore: bump aws sdk to 0.7

    Issue #, if available:

    Description of changes:

    Bump the AWS SDK to 0.7

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by nmoutschen 0
  • Running Locally?

    Running Locally?

    Hey! 👋

    Nice project! The artillery load tests is a cool addition, too. 👍

    I am wondering if it's possible to run this project locally.

    I think something like serverless-offline would be a nice way to "host the lambdas locally"...

    However, when I try to use it I get an error that the Rust runtime is not supported...

    Any ideas for this? How can people productively develop something using this project?

    Thanks!

    opened by JimLynchCodes 1
  • feat: serde dynamo

    feat: serde dynamo

    🔥 Don't merge: this is rather experimental and up for discussion! 🔥 Note: So far I didn't deploy the API with theses changes so I am not sure, if it works as expected.

    No issue, I wanted to try out serde_dynamo crate with the experimental support for the official aws-sdk.

    Description of changes:

    • Use serde_dynamo from_item and from_items and remove handcrafted From and TryFrom implementations
    • Use serde_dynamo from_attribute_value and remove src/store/dynamodb/ext.rs
    opened by hffmnn 1
  • [Question] Cleanup of hexagonal structure

    [Question] Cleanup of hexagonal structure

    Hi and thanks a lot for this repository.

    I am just getting started with the hexagonal architecture (and Rust in general) and I am wondering about some things in the current setup of the hexagonal architecture in this repo:

    • Why is model.rs not part of the domain?
    • Why does lib.rs have the comment Domain logic for the service but is not part of the domain?
    • Why aren't the port traits part of the Domain but part of the store? And what is a store in the naming conventions of a hexagonal architecture?

    Don't get me wrong: I really like the repository, but I wonder if the boundaries could be a little bit more enforced.

    When looking at another great example of a hexagonal architecture (in rust) and the source code of it, it looks like it is structured a little bit better, even if there are also issues around some implementation details: https://github.com/alexislozano/pokedex/issues/1

    Screenshot 2022-02-03 at 16 35 22

    Would it be of interest for you to restructure the existing code? Maybe I can help.

    opened by hffmnn 0
  • feat(container): add rocket implementation

    feat(container): add rocket implementation

    Issue #, if available:

    Description of changes: Add support for running this in a container with Rocket

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by nmoutschen 0
  • chore: add custom tracing layer

    chore: add custom tracing layer

    Issue #, if available:

    Description of changes:

    Add a custom layer for tracing to mimick Lambda Powertools' log structure.

    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

    opened by nmoutschen 0
  • My ideal DX for Rust on AWS Lambda

    My ideal DX for Rust on AWS Lambda

    Screen Shot 2021-10-04 at 2 09 05 pm

    Challenge accepted, @nmoutschen! ;)

    Here's my (first ever) attempt at an Amazon (less-than-)6-pager for an "ideal world DX for Rust and AWS lambda". My hope is that it gets circulated at AWS, reaches leaders willing to take ownership of the goals outlined below so that customers (like me) get to enjoy better Rust lambdas developer experience and unleash its untapped potential.

    It is now a draft since "Strategic priorities" might not be in line with how reports like this are structured, but bear with me... happy to edit/improve if there's uptake ;)

    Introduction

    This document aims to outline the current state of AWS Lambda runtime support for Rust and share strategic priorities on next iterations for its developer tooling ecosystem. AWS serverless teams mission is to work with developers interested in migrating current idle-prone workloads into optimized, safe and GC-free Rust lambdas.

    Given the uptake of serverless and the recent move towards more cost-efficient ARM64 lambdas, removing Rust developer friction can increase organic adoption and, in turn, attract other developers that can port high performance computing workloads from on-premise HPC to Rust lambda (where applicable). AWS serverless teams focus for Q4 2021 should be to establish Rust as a first class citizen of the lambda ecosystem by improving the devops tooling around it, running benchmarks against other runtimes and updating documentation, app templates and demo repositories accordingly to ease onboarding.

    Goals

    In Q4 2021 AWS Rust serverless should plan focusing on achieving the following goals:

    • Increase tooling quality: Better integration of sam-cli and/or sam-cli-cdk local runtime execution and deployment for all host systems and targets (i.e Apple Silicon). Also integrate with the native cargo Rust tool (no Makefile(s)).

    • Measure and increase performance: Remove MUSL wrapping misconceptions from documentation. Through benchmarking and allocator tuning, Rust lambdas (could/should?) outperform wall time and memory consumption against other runtimes by at least 5-10% on average. Run the tests and add those to CI to spot performance regressions as best practices change.

    • Change runtime naming: Currently Rust lambdas are offered as provided.al2 runtime, unintentionally leaving Rust as a "second class citizen" against the rest of officially supported runtimes. Simply aliasing provided.al2 to rust-1.x to mirror i.e "python3.9" lambdas could signal "supported and quality runtime at AWS". No changes w.r.t runtime underneath are needed and experts can continue using provided.al2, just aliasing/naming...Easy win?

    Tenets

    The following tenets are guiding principles we use to evaluate and prioritize Rust AWS lambda tooling improvement activities:

    Quality over quantity

    SAM CLI and/or CDK should be the canonical way to deploy rust lambdas without interfering with the expected Rust developer build tool: cargo. Several third party Rust crates are attempting to fill some of DX experience gaps from SAM and other official AWS tooling: cargo-aws-lambda, aws-build, minlambda, mu_runtime, rocket_lamb, warp_lambda. While this contributions are welcome, it also shows that the shortcomings could be addressed upstream in the official tooling.

    Reduce developer friction

    We want to focus on educating developers through in-depth technical content and tool documentation instead of relying solely on community knowledge transfer.

    Invent and Simplify

    We want Rust developers to feel at home when they approach AWS Rust lambdas and that means an officially supported aws cargo subcommand (via an officially supported AWS Rust crate).

    Strategic priorities?

    Ideally bring SAM-CLI, rust_lambda_runtime and other relevant Rust tooling ecosystem teams together and build an example that is deployable on Graviton2 instances with the following cargo commands (ideal scenario), supported officially by AWS via its documentation:

    1. cargo aws build
    2. cargo aws deploy

    If the user wants to debug the lambda locally:

    1. cargo aws build
    2. cargo aws run [invoke | start-api]

    The official cargo aws subcommand could potentially call other aws services (simple AWS CLI and/or SAM-CLI-(CDK) wrapper), but there's no need to wrap them all on a first iteration for this tooling.

    Mentions

    Please let me know if you wish to be removed from this thread, I have no intention to inconvenience anybody. I just think that, if anyone, you have the means to make a difference on this topic :)

    @softprops @davidbarsky @jonhoo @mjasay @praneetap @jfuss @sapessi @singledigit @hoffa @coltonweaver @bahildebrand @jdisanti @rcoh

    opened by brainstorm 6
Owner
AWS Samples
AWS Samples
Rust Axum+SQLx Sample

rust-axum-sqlx-sample Install git clone https://github.com/web3ten0/rust-axum-sqlx-1.git cd rust-axum-sqlx-1/local docker-compose up -d sh scripts/exe

web3ten0 5 Jul 9, 2022
Sample code of Yew (0.18). Something like a PuyoPuyo.

RusRus Requirements Docker Depend on Yew ver 0.18.0 Usase docker build -t rusrus . # start serve docker run -p 8080:8080 --rm -it -v $(pwd):/app -w /

null 5 Jan 10, 2022
This repository contains the sample code for Rainer Stropek's talk at Eurorust 2022.

Building Web APIs with Rust - State of the Union Introduction This repository contains the sample code for Rainer Stropek's talk at Eurorust 2022. The

Rainer Stropek 24 Feb 9, 2023
Sample Artemis bot to fill UniswapX orders using on-chain liquidity

UniswapX Atomic Filler This is a sample Artemis bot that fills UniswapX orders atomically using Uniswap v2 and v3 liquidity. Feel free to fork and mod

null 102 Jul 25, 2023
⚡Rust Serverless Framework

Zapp Rust Serverless Framework The Zapp project was launched with the goal of reducing software development, operation and maintenance costs. Build Se

Epics 6 Dec 23, 2022
A Rust application which funnels external webhook event data to an Urbit chat.

Urbit Webhook Funnel This is a simple Rust application which funnels external webhook event data to an Urbit chat. This application is intended to be

Robert Kornacki 15 Jan 2, 2022
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
Reference implementation of a full-stack Rust application

Full-stack Rust with WebAssembly Look Ma, No JavaScript !!! My very first Rust project (implementation of the "Connect 5" game), I used as a learning

Vassil 64 Dec 27, 2022
Build, bundle & ship your Rust WASM application to the web.

Trunk Build, bundle & ship your Rust WASM application to the web. ”Pack your things, we’re going on an adventure!” ~ Ferris Trunk is a WASM web applic

Anthony Dodd 2.2k Jan 7, 2023
Web Application with using Rust(Actix, Diesel and etc)

Santa Service App Used technology stack Web Server with using Rust (Actix, Actix-web, Diesel) Data base (Postgres) Console Application (Tokio) Tasks o

null 3 Jan 8, 2023
Oso is an open source policy engine for authorization that’s embedded in your application

Oso What is Oso? Oso is an open source policy engine for authorization that’s embedded in your application. It provides a declarative policy language

oso 2.8k Jan 4, 2023
The official DAW application of the RustyDAW project (name in progress)

rusty-daw-application The official DAW application of the RustyDAW project (name in progress) Take a look at the design doc. Join our community at the

null 15 Jun 14, 2021
a port of yaxpeax-dis that runs as a web application

this a rough translation of yaxpeax-dis, the CLI tool, to instead accept architectures and data to disassemble as an HTTP request. the package is then deployed to dis.yaxpeax.net as a compute@edge application.

iximeow 5 Aug 8, 2021
A web application to configuration Caddy based on MoonZoon.

Cream A web application to configuration Caddy based on MoonZoon. MoonZoon is a Rust Fullstack Framework. Live demo Run on a local machine Check you'v

Tw 4 Sep 19, 2022
Starknet application for Ledger Nano S, SP, X

Ledger Starkware app Please visit our website at zondax.ch This project contains the Starkware app (https://starkware.co/) for Ledger Nano S and X. Le

Ledger 12 Sep 8, 2022
Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

null 45 Sep 6, 2023
Axum + JWT authentication Middleware that allows you to start building your application fast

axum_jwt_ware Integration Guide Simple Axum + JWT authentication middleware with implemented Login and refresh token. Goal I aim to simplify the proce

Eze Sunday 3 Dec 2, 2023
A html document syntax and operation library written in Rust, use APIs similar to jQuery.

Visdom A server-side html document syntax and operation library written in Rust, it uses apis similar to jQuery, left off the parts thoes only worked

轩子 80 Dec 21, 2022
A Blog & RSS system written in Rust based on Luke Smith's LB.

OB - Oliver's Blog Script A Blog and RSS system written in Rust. Features Converts blog entries written in Markdown into HTML. ✍?? Keeps a rolling blo

Oliver Brotchie 19 Aug 28, 2022