/serverless-rust

Exploring using Rust with AWS Lambda, API Gateway and CDK.

Primary LanguageRustMIT LicenseMIT

Serverless Rust

CI

Overview

This project explores building an AWS Lambda function with the Rust custom runtime.

Requirements

Development

For Mac OS, make sure you download and link the target and linker for the AWS Lambda Rust runtime:

make install-runtime-target

Deployment

First, set an AWS_PROFILE environment variable in a .envrc file following the example in .envrc.example.

direnv allow .

Install NPM dependencies for CDK infrastructure:

make install-cdk-deps

Make sure your AWS account is bootstrapped for CDK applications

make bootstrap-env

Deploy CDK stacks to AWS form your local machine:

make build-release package-binary deploy

Localstack

This project uses Localstack for local development. Localstack supports deploying and running AWS resources in a local Docker environment. To use Localstack run:

docker-compose up

# one-time bootstrap
make bootstrap-localstack

# deploy resources in Docker
make deploy-localstack

# check localstack services are running
curl -get http://localhost:4566/health

# call the deployed API in localstack
make call-local-api

References