├── .github ├── renovate.json └── workflows │ └── main.yml ├── .gitignore ├── .husky ├── .gitignore └── pre-commit ├── .npmignore ├── README.md ├── bin └── rust-lambda.ts ├── build-function.sh ├── cdk.json ├── jest.config.js ├── lib └── rust-lambda-stack.ts ├── package.json ├── resources ├── Cargo.lock ├── Cargo.toml ├── rustfmt.toml └── src │ └── main.rs ├── test └── rust-lambda.test.ts ├── tsconfig.json ├── ubuntu-config └── yarn.lock /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base"], 3 | "masterIssue": true, 4 | "schedule": ["on the 17 day of the month"], 5 | "packageRules": [ 6 | { 7 | "matchUpdateTypes": [ 8 | "minor", 9 | "patch", 10 | "pin", 11 | "digest", 12 | "lockFileMaintenance", 13 | "rollback", 14 | "bump" 15 | ], 16 | "automerge": true 17 | }, 18 | { 19 | "packagePatterns": [".*aws-cdk"], 20 | "groupName": "cdk deps" 21 | }, 22 | { 23 | "packagePatterns": ["^jest", "ts-jest"], 24 | "groupName": "test-utils" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Install build packages 15 | run: sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu 16 | 17 | - name: Checkout 18 | uses: actions/checkout@v3 19 | 20 | - name: Use Node 12 21 | uses: actions/setup-node@v3 22 | with: 23 | node-version: 14.x 24 | 25 | - name: Use cached node_modules 26 | uses: actions/cache@v2 27 | with: 28 | path: node_modules 29 | key: nodeModules-${{ hashFiles('**/yarn.lock') }} 30 | restore-keys: | 31 | nodeModules- 32 | 33 | - uses: actions/cache@v2 34 | with: 35 | path: | 36 | ~/.cargo/bin/ 37 | ~/.cargo/registry/index/ 38 | ~/.cargo/registry/cache/ 39 | ~/.cargo/git/db/ 40 | resources/target/ 41 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 42 | restore-keys: | 43 | ${{ runner.os }}-cargo- 44 | 45 | - name: Install dependencies 46 | run: yarn install --frozen-lockfile 47 | 48 | - name: Install Rust stable toolchain 49 | uses: actions-rs/toolchain@v1 50 | with: 51 | toolchain: stable 52 | target: aarch64-unknown-linux-musl 53 | override: true 54 | 55 | - name: Build function 56 | run: cp ./ubuntu-config ~/.cargo/config && ./build-function.sh 57 | 58 | - name: Run Tests 59 | run: yarn test --coverage --maxWorkers=2 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | !jest.config.js 3 | *.d.ts 4 | node_modules 5 | target 6 | 7 | # CDK asset staging directory 8 | .cdk.staging 9 | cdk.out 10 | 11 | # misc 12 | .DS_Store 13 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn lint-staged 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | 4 | # CDK asset staging directory 5 | .cdk.staging 6 | cdk.out 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust runtime for Lambda with the CDK 2 | 3 | [![Build Status](https://github.com/ryands17/rust-lambda/actions/workflows/main.yml/badge.svg)](https://github.com/ryands17/rust-lambda/actions/workflows/main.yml) 4 | 5 | This is a CDK project that deploys a Rust function using the Rust runtime for Lambda. This creates a basic handler that logs some data sent as input. 6 | 7 | **Update**: I have updated the Lambda function to use the newly introduced [Graviton Processor](https://aws.amazon.com/blogs/aws/aws-lambda-functions-powered-by-aws-graviton2-processor-run-your-functions-on-arm-and-get-up-to-34-better-price-performance/) for faster and cheaper workloads. 8 | 9 | ## Prerequisites 10 | 11 | - Follow instructions mentioned in [this post](https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws-lambda/) that explains how to build Rust functions for AWS Lambda. 12 | 13 | **_Note_**: As we are using `arm` as the architecture, we need to add the following target: 14 | 15 | ``` 16 | rustup target add aarch64-unknown-linux-musl 17 | ``` 18 | 19 | And then follow the instructions as specified [in this post](https://john-millikin.com/notes-on-cross-compiling-rust) for cross-compilation. 20 | 21 | - Create a `cdk.context.json` with the `region` key to specify the region of your choice (default is `us-east-2`). 22 | 23 | ```json 24 | { 25 | "region": "us-east-1" 26 | } 27 | ``` 28 | 29 | The `cdk.json` file tells the CDK Toolkit how to execute your app. 30 | 31 | ## Useful commands 32 | 33 | - `yarn build` compile typescript to js 34 | - `yarn watch` watch for changes and compile 35 | - `yarn test` perform the jest unit tests 36 | - `yarn deploy` deploy this stack to your default AWS account/region 37 | - `yarn cdk diff` compare deployed stack with current state 38 | - `yarn cdk synth` emits the synthesized CloudFormation template 39 | -------------------------------------------------------------------------------- /bin/rust-lambda.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import 'source-map-support/register' 3 | import * as cdk from '@aws-cdk/core' 4 | import { RustLambdaStack } from '../lib/rust-lambda-stack' 5 | 6 | const app = new cdk.App() 7 | new RustLambdaStack(app, 'RustLambdaStack', { 8 | env: { region: app.node.tryGetContext('region') || 'us-east-2' }, 9 | }) 10 | -------------------------------------------------------------------------------- /build-function.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd resources 4 | cargo build --release --target aarch64-unknown-linux-musl 5 | (cd target/aarch64-unknown-linux-musl/release && mkdir -p lambda && cp bootstrap lambda/) 6 | -------------------------------------------------------------------------------- /cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "npx ts-node --prefer-ts-exts bin/rust-lambda.ts", 3 | "context": { 4 | "@aws-cdk/core:newStyleStackSynthesis": true, 5 | "@aws-cdk/core:enableStackNameDuplicates": "true", 6 | "aws-cdk:enableDiffNoFail": "true", 7 | "@aws-cdk/core:stackRelativeExports": "true", 8 | "@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true, 9 | "@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true, 10 | "@aws-cdk/aws-kms:defaultKeyPolicies": true, 11 | "@aws-cdk/aws-s3:grantWriteWithoutAcl": true, 12 | "@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ['/test'], 3 | testMatch: ['**/*.test.ts'], 4 | transform: { 5 | '^.+\\.tsx?$': 'ts-jest' 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /lib/rust-lambda-stack.ts: -------------------------------------------------------------------------------- 1 | import * as cdk from '@aws-cdk/core' 2 | import * as lambda from '@aws-cdk/aws-lambda' 3 | import { RetentionDays } from '@aws-cdk/aws-logs' 4 | 5 | export class RustLambdaStack extends cdk.Stack { 6 | constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { 7 | super(scope, id, props) 8 | 9 | // Function that calls Rust 10 | new lambda.Function(this, 'rust-hello', { 11 | description: 12 | 'Deploying a Rust function on Lambda using the custom runtime', 13 | code: lambda.Code.fromAsset( 14 | 'resources/target/aarch64-unknown-linux-musl/release/lambda' 15 | ), 16 | runtime: lambda.Runtime.PROVIDED_AL2, 17 | architectures: [lambda.Architecture.ARM_64], 18 | handler: 'not.required', 19 | environment: { 20 | RUST_BACKTRACE: '1', 21 | }, 22 | logRetention: RetentionDays.ONE_WEEK, 23 | }) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rust-lambda", 3 | "private": true, 4 | "version": "1.0.0", 5 | "bin": { 6 | "rust-lambda": "bin/rust-lambda.js" 7 | }, 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "test": "jest", 12 | "cdk": "cdk", 13 | "deploy": "./build-function.sh && cdk deploy", 14 | "prepare": "husky install" 15 | }, 16 | "devDependencies": { 17 | "@aws-cdk/assert": "1.203.0", 18 | "@types/jest": "27.5.2", 19 | "@types/node": "16.18.119", 20 | "aws-cdk": "1.203.0", 21 | "jest": "27.5.1", 22 | "lint-staged": "12.5.0", 23 | "prettier": "2.8.8", 24 | "ts-jest": "27.1.5", 25 | "ts-node": "10.9.2", 26 | "typescript": "4.9.5" 27 | }, 28 | "dependencies": { 29 | "@aws-cdk/aws-lambda": "1.203.0", 30 | "@aws-cdk/core": "1.203.0", 31 | "husky": "7.0.4", 32 | "source-map-support": "0.5.21" 33 | }, 34 | "lint-staged": { 35 | "*.{js,ts,json,md}": "prettier --write" 36 | }, 37 | "prettier": { 38 | "semi": false, 39 | "singleQuote": true 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resources/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.20.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.3" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "async-stream" 31 | version = "0.3.0" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "3670df70cbc01729f901f94c887814b3c68db038aad1329a418bae178bc5295c" 34 | dependencies = [ 35 | "async-stream-impl", 36 | "futures-core", 37 | ] 38 | 39 | [[package]] 40 | name = "async-stream-impl" 41 | version = "0.3.0" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" 44 | dependencies = [ 45 | "proc-macro2", 46 | "quote", 47 | "syn 1.0.107", 48 | ] 49 | 50 | [[package]] 51 | name = "atty" 52 | version = "0.2.14" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 55 | dependencies = [ 56 | "hermit-abi 0.1.18", 57 | "libc", 58 | "winapi", 59 | ] 60 | 61 | [[package]] 62 | name = "autocfg" 63 | version = "1.1.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 66 | 67 | [[package]] 68 | name = "backtrace" 69 | version = "0.3.68" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" 72 | dependencies = [ 73 | "addr2line", 74 | "cc", 75 | "cfg-if", 76 | "libc", 77 | "miniz_oxide", 78 | "object", 79 | "rustc-demangle", 80 | ] 81 | 82 | [[package]] 83 | name = "base64" 84 | version = "0.22.1" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 87 | 88 | [[package]] 89 | name = "bitflags" 90 | version = "1.2.1" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 93 | 94 | [[package]] 95 | name = "bytes" 96 | version = "1.0.1" 97 | source = "registry+https://github.com/rust-lang/crates.io-index" 98 | checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" 99 | 100 | [[package]] 101 | name = "cc" 102 | version = "1.0.79" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 105 | 106 | [[package]] 107 | name = "cfg-if" 108 | version = "1.0.0" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 111 | 112 | [[package]] 113 | name = "colored" 114 | version = "2.0.0" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" 117 | dependencies = [ 118 | "atty", 119 | "lazy_static", 120 | "winapi", 121 | ] 122 | 123 | [[package]] 124 | name = "fnv" 125 | version = "1.0.7" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 128 | 129 | [[package]] 130 | name = "futures" 131 | version = "0.3.24" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" 134 | dependencies = [ 135 | "futures-channel", 136 | "futures-core", 137 | "futures-executor", 138 | "futures-io", 139 | "futures-sink", 140 | "futures-task", 141 | "futures-util", 142 | ] 143 | 144 | [[package]] 145 | name = "futures-channel" 146 | version = "0.3.24" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" 149 | dependencies = [ 150 | "futures-core", 151 | "futures-sink", 152 | ] 153 | 154 | [[package]] 155 | name = "futures-core" 156 | version = "0.3.24" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" 159 | 160 | [[package]] 161 | name = "futures-executor" 162 | version = "0.3.24" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" 165 | dependencies = [ 166 | "futures-core", 167 | "futures-task", 168 | "futures-util", 169 | ] 170 | 171 | [[package]] 172 | name = "futures-io" 173 | version = "0.3.24" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" 176 | 177 | [[package]] 178 | name = "futures-macro" 179 | version = "0.3.24" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" 182 | dependencies = [ 183 | "proc-macro2", 184 | "quote", 185 | "syn 1.0.107", 186 | ] 187 | 188 | [[package]] 189 | name = "futures-sink" 190 | version = "0.3.24" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" 193 | 194 | [[package]] 195 | name = "futures-task" 196 | version = "0.3.24" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" 199 | 200 | [[package]] 201 | name = "futures-util" 202 | version = "0.3.24" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" 205 | dependencies = [ 206 | "futures-channel", 207 | "futures-core", 208 | "futures-io", 209 | "futures-macro", 210 | "futures-sink", 211 | "futures-task", 212 | "memchr", 213 | "pin-project-lite", 214 | "pin-utils", 215 | "slab", 216 | ] 217 | 218 | [[package]] 219 | name = "gimli" 220 | version = "0.27.3" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" 223 | 224 | [[package]] 225 | name = "hermit-abi" 226 | version = "0.1.18" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" 229 | dependencies = [ 230 | "libc", 231 | ] 232 | 233 | [[package]] 234 | name = "hermit-abi" 235 | version = "0.3.9" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 238 | 239 | [[package]] 240 | name = "http" 241 | version = "1.0.0" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" 244 | dependencies = [ 245 | "bytes", 246 | "fnv", 247 | "itoa 1.0.1", 248 | ] 249 | 250 | [[package]] 251 | name = "http-body" 252 | version = "1.0.0" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" 255 | dependencies = [ 256 | "bytes", 257 | "http", 258 | ] 259 | 260 | [[package]] 261 | name = "http-body-util" 262 | version = "0.1.0" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" 265 | dependencies = [ 266 | "bytes", 267 | "futures-util", 268 | "http", 269 | "http-body", 270 | "pin-project-lite", 271 | ] 272 | 273 | [[package]] 274 | name = "http-serde" 275 | version = "2.0.0" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "7fb7239a6d49eda628c2dfdd7e982c59b0c3f0fb99ce45c4237f02a520030688" 278 | dependencies = [ 279 | "http", 280 | "serde", 281 | ] 282 | 283 | [[package]] 284 | name = "httparse" 285 | version = "1.8.0" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 288 | 289 | [[package]] 290 | name = "hyper" 291 | version = "1.1.0" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" 294 | dependencies = [ 295 | "bytes", 296 | "futures-channel", 297 | "futures-util", 298 | "http", 299 | "http-body", 300 | "httparse", 301 | "itoa 1.0.1", 302 | "pin-project-lite", 303 | "tokio", 304 | "want", 305 | ] 306 | 307 | [[package]] 308 | name = "hyper-util" 309 | version = "0.1.3" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" 312 | dependencies = [ 313 | "bytes", 314 | "futures-channel", 315 | "futures-util", 316 | "http", 317 | "http-body", 318 | "hyper", 319 | "pin-project-lite", 320 | "socket2", 321 | "tokio", 322 | "tower", 323 | "tower-service", 324 | "tracing", 325 | ] 326 | 327 | [[package]] 328 | name = "itoa" 329 | version = "0.4.7" 330 | source = "registry+https://github.com/rust-lang/crates.io-index" 331 | checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" 332 | 333 | [[package]] 334 | name = "itoa" 335 | version = "1.0.1" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 338 | 339 | [[package]] 340 | name = "lambda_runtime" 341 | version = "0.13.0" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "ed49669d6430292aead991e19bf13153135a884f916e68f32997c951af637ebe" 344 | dependencies = [ 345 | "async-stream", 346 | "base64", 347 | "bytes", 348 | "futures", 349 | "http", 350 | "http-body", 351 | "http-body-util", 352 | "http-serde", 353 | "hyper", 354 | "hyper-util", 355 | "lambda_runtime_api_client", 356 | "pin-project", 357 | "serde", 358 | "serde_json", 359 | "serde_path_to_error", 360 | "tokio", 361 | "tokio-stream", 362 | "tower", 363 | "tower-layer", 364 | "tracing", 365 | ] 366 | 367 | [[package]] 368 | name = "lambda_runtime_api_client" 369 | version = "0.11.1" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | checksum = "c90a10f094475a34a04da2be11686c4dcfe214d93413162db9ffdff3d3af293a" 372 | dependencies = [ 373 | "bytes", 374 | "futures-channel", 375 | "futures-util", 376 | "http", 377 | "http-body", 378 | "http-body-util", 379 | "hyper", 380 | "hyper-util", 381 | "tokio", 382 | "tower", 383 | "tower-service", 384 | "tracing", 385 | "tracing-subscriber", 386 | ] 387 | 388 | [[package]] 389 | name = "lazy_static" 390 | version = "1.4.0" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 393 | 394 | [[package]] 395 | name = "libc" 396 | version = "0.2.150" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" 399 | 400 | [[package]] 401 | name = "lock_api" 402 | version = "0.4.6" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" 405 | dependencies = [ 406 | "scopeguard", 407 | ] 408 | 409 | [[package]] 410 | name = "log" 411 | version = "0.4.22" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 414 | 415 | [[package]] 416 | name = "matchers" 417 | version = "0.1.0" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 420 | dependencies = [ 421 | "regex-automata 0.1.10", 422 | ] 423 | 424 | [[package]] 425 | name = "memchr" 426 | version = "2.5.0" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 429 | 430 | [[package]] 431 | name = "miniz_oxide" 432 | version = "0.7.1" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 435 | dependencies = [ 436 | "adler", 437 | ] 438 | 439 | [[package]] 440 | name = "mio" 441 | version = "1.0.2" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" 444 | dependencies = [ 445 | "hermit-abi 0.3.9", 446 | "libc", 447 | "wasi", 448 | "windows-sys 0.52.0", 449 | ] 450 | 451 | [[package]] 452 | name = "object" 453 | version = "0.31.1" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" 456 | dependencies = [ 457 | "memchr", 458 | ] 459 | 460 | [[package]] 461 | name = "once_cell" 462 | version = "1.17.0" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" 465 | 466 | [[package]] 467 | name = "parking_lot" 468 | version = "0.12.0" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" 471 | dependencies = [ 472 | "lock_api", 473 | "parking_lot_core", 474 | ] 475 | 476 | [[package]] 477 | name = "parking_lot_core" 478 | version = "0.9.1" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" 481 | dependencies = [ 482 | "cfg-if", 483 | "libc", 484 | "redox_syscall", 485 | "smallvec", 486 | "windows-sys 0.32.0", 487 | ] 488 | 489 | [[package]] 490 | name = "pin-project" 491 | version = "1.0.6" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6" 494 | dependencies = [ 495 | "pin-project-internal", 496 | ] 497 | 498 | [[package]] 499 | name = "pin-project-internal" 500 | version = "1.0.6" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5" 503 | dependencies = [ 504 | "proc-macro2", 505 | "quote", 506 | "syn 1.0.107", 507 | ] 508 | 509 | [[package]] 510 | name = "pin-project-lite" 511 | version = "0.2.12" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" 514 | 515 | [[package]] 516 | name = "pin-utils" 517 | version = "0.1.0" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 520 | 521 | [[package]] 522 | name = "proc-macro2" 523 | version = "1.0.78" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" 526 | dependencies = [ 527 | "unicode-ident", 528 | ] 529 | 530 | [[package]] 531 | name = "quote" 532 | version = "1.0.35" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 535 | dependencies = [ 536 | "proc-macro2", 537 | ] 538 | 539 | [[package]] 540 | name = "redox_syscall" 541 | version = "0.2.10" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" 544 | dependencies = [ 545 | "bitflags", 546 | ] 547 | 548 | [[package]] 549 | name = "regex" 550 | version = "1.9.4" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" 553 | dependencies = [ 554 | "aho-corasick", 555 | "memchr", 556 | "regex-automata 0.3.7", 557 | "regex-syntax 0.7.5", 558 | ] 559 | 560 | [[package]] 561 | name = "regex-automata" 562 | version = "0.1.10" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 565 | dependencies = [ 566 | "regex-syntax 0.6.29", 567 | ] 568 | 569 | [[package]] 570 | name = "regex-automata" 571 | version = "0.3.7" 572 | source = "registry+https://github.com/rust-lang/crates.io-index" 573 | checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" 574 | dependencies = [ 575 | "aho-corasick", 576 | "memchr", 577 | "regex-syntax 0.7.5", 578 | ] 579 | 580 | [[package]] 581 | name = "regex-syntax" 582 | version = "0.6.29" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 585 | 586 | [[package]] 587 | name = "regex-syntax" 588 | version = "0.7.5" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" 591 | 592 | [[package]] 593 | name = "resources" 594 | version = "1.0.0" 595 | dependencies = [ 596 | "lambda_runtime", 597 | "log", 598 | "serde_json", 599 | "simple_logger", 600 | "tokio", 601 | ] 602 | 603 | [[package]] 604 | name = "rustc-demangle" 605 | version = "0.1.23" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 608 | 609 | [[package]] 610 | name = "ryu" 611 | version = "1.0.5" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 614 | 615 | [[package]] 616 | name = "scopeguard" 617 | version = "1.1.0" 618 | source = "registry+https://github.com/rust-lang/crates.io-index" 619 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 620 | 621 | [[package]] 622 | name = "serde" 623 | version = "1.0.196" 624 | source = "registry+https://github.com/rust-lang/crates.io-index" 625 | checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" 626 | dependencies = [ 627 | "serde_derive", 628 | ] 629 | 630 | [[package]] 631 | name = "serde_derive" 632 | version = "1.0.196" 633 | source = "registry+https://github.com/rust-lang/crates.io-index" 634 | checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" 635 | dependencies = [ 636 | "proc-macro2", 637 | "quote", 638 | "syn 2.0.48", 639 | ] 640 | 641 | [[package]] 642 | name = "serde_json" 643 | version = "1.0.133" 644 | source = "registry+https://github.com/rust-lang/crates.io-index" 645 | checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" 646 | dependencies = [ 647 | "itoa 1.0.1", 648 | "memchr", 649 | "ryu", 650 | "serde", 651 | ] 652 | 653 | [[package]] 654 | name = "serde_path_to_error" 655 | version = "0.1.11" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "f7f05c1d5476066defcdfacce1f52fc3cae3af1d3089727100c02ae92e5abbe0" 658 | dependencies = [ 659 | "serde", 660 | ] 661 | 662 | [[package]] 663 | name = "sharded-slab" 664 | version = "0.1.7" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 667 | dependencies = [ 668 | "lazy_static", 669 | ] 670 | 671 | [[package]] 672 | name = "signal-hook-registry" 673 | version = "1.3.0" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" 676 | dependencies = [ 677 | "libc", 678 | ] 679 | 680 | [[package]] 681 | name = "simple_logger" 682 | version = "2.3.0" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "48047e77b528151aaf841a10a9025f9459da80ba820e425ff7eb005708a76dc7" 685 | dependencies = [ 686 | "atty", 687 | "colored", 688 | "log", 689 | "time", 690 | "winapi", 691 | ] 692 | 693 | [[package]] 694 | name = "slab" 695 | version = "0.4.7" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" 698 | dependencies = [ 699 | "autocfg", 700 | ] 701 | 702 | [[package]] 703 | name = "smallvec" 704 | version = "1.6.1" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" 707 | 708 | [[package]] 709 | name = "socket2" 710 | version = "0.5.5" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" 713 | dependencies = [ 714 | "libc", 715 | "windows-sys 0.48.0", 716 | ] 717 | 718 | [[package]] 719 | name = "syn" 720 | version = "1.0.107" 721 | source = "registry+https://github.com/rust-lang/crates.io-index" 722 | checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" 723 | dependencies = [ 724 | "proc-macro2", 725 | "quote", 726 | "unicode-ident", 727 | ] 728 | 729 | [[package]] 730 | name = "syn" 731 | version = "2.0.48" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" 734 | dependencies = [ 735 | "proc-macro2", 736 | "quote", 737 | "unicode-ident", 738 | ] 739 | 740 | [[package]] 741 | name = "thread_local" 742 | version = "1.1.8" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" 745 | dependencies = [ 746 | "cfg-if", 747 | "once_cell", 748 | ] 749 | 750 | [[package]] 751 | name = "time" 752 | version = "0.3.5" 753 | source = "registry+https://github.com/rust-lang/crates.io-index" 754 | checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" 755 | dependencies = [ 756 | "itoa 0.4.7", 757 | "libc", 758 | "time-macros", 759 | ] 760 | 761 | [[package]] 762 | name = "time-macros" 763 | version = "0.2.3" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6" 766 | 767 | [[package]] 768 | name = "tokio" 769 | version = "1.41.1" 770 | source = "registry+https://github.com/rust-lang/crates.io-index" 771 | checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" 772 | dependencies = [ 773 | "backtrace", 774 | "bytes", 775 | "libc", 776 | "mio", 777 | "parking_lot", 778 | "pin-project-lite", 779 | "signal-hook-registry", 780 | "socket2", 781 | "tokio-macros", 782 | "windows-sys 0.52.0", 783 | ] 784 | 785 | [[package]] 786 | name = "tokio-macros" 787 | version = "2.4.0" 788 | source = "registry+https://github.com/rust-lang/crates.io-index" 789 | checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" 790 | dependencies = [ 791 | "proc-macro2", 792 | "quote", 793 | "syn 2.0.48", 794 | ] 795 | 796 | [[package]] 797 | name = "tokio-stream" 798 | version = "0.1.5" 799 | source = "registry+https://github.com/rust-lang/crates.io-index" 800 | checksum = "e177a5d8c3bf36de9ebe6d58537d8879e964332f93fb3339e43f618c81361af0" 801 | dependencies = [ 802 | "futures-core", 803 | "pin-project-lite", 804 | "tokio", 805 | ] 806 | 807 | [[package]] 808 | name = "tower" 809 | version = "0.4.8" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "f60422bc7fefa2f3ec70359b8ff1caff59d785877eb70595904605bcc412470f" 812 | dependencies = [ 813 | "futures-core", 814 | "futures-util", 815 | "pin-project", 816 | "tokio", 817 | "tower-layer", 818 | "tower-service", 819 | "tracing", 820 | ] 821 | 822 | [[package]] 823 | name = "tower-layer" 824 | version = "0.3.1" 825 | source = "registry+https://github.com/rust-lang/crates.io-index" 826 | checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" 827 | 828 | [[package]] 829 | name = "tower-service" 830 | version = "0.3.1" 831 | source = "registry+https://github.com/rust-lang/crates.io-index" 832 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 833 | 834 | [[package]] 835 | name = "tracing" 836 | version = "0.1.37" 837 | source = "registry+https://github.com/rust-lang/crates.io-index" 838 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 839 | dependencies = [ 840 | "cfg-if", 841 | "log", 842 | "pin-project-lite", 843 | "tracing-attributes", 844 | "tracing-core", 845 | ] 846 | 847 | [[package]] 848 | name = "tracing-attributes" 849 | version = "0.1.23" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" 852 | dependencies = [ 853 | "proc-macro2", 854 | "quote", 855 | "syn 1.0.107", 856 | ] 857 | 858 | [[package]] 859 | name = "tracing-core" 860 | version = "0.1.30" 861 | source = "registry+https://github.com/rust-lang/crates.io-index" 862 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 863 | dependencies = [ 864 | "once_cell", 865 | "valuable", 866 | ] 867 | 868 | [[package]] 869 | name = "tracing-serde" 870 | version = "0.1.3" 871 | source = "registry+https://github.com/rust-lang/crates.io-index" 872 | checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" 873 | dependencies = [ 874 | "serde", 875 | "tracing-core", 876 | ] 877 | 878 | [[package]] 879 | name = "tracing-subscriber" 880 | version = "0.3.18" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" 883 | dependencies = [ 884 | "matchers", 885 | "once_cell", 886 | "regex", 887 | "serde", 888 | "serde_json", 889 | "sharded-slab", 890 | "thread_local", 891 | "tracing", 892 | "tracing-core", 893 | "tracing-serde", 894 | ] 895 | 896 | [[package]] 897 | name = "try-lock" 898 | version = "0.2.3" 899 | source = "registry+https://github.com/rust-lang/crates.io-index" 900 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 901 | 902 | [[package]] 903 | name = "unicode-ident" 904 | version = "1.0.6" 905 | source = "registry+https://github.com/rust-lang/crates.io-index" 906 | checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" 907 | 908 | [[package]] 909 | name = "valuable" 910 | version = "0.1.0" 911 | source = "registry+https://github.com/rust-lang/crates.io-index" 912 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 913 | 914 | [[package]] 915 | name = "want" 916 | version = "0.3.0" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 919 | dependencies = [ 920 | "log", 921 | "try-lock", 922 | ] 923 | 924 | [[package]] 925 | name = "wasi" 926 | version = "0.11.0+wasi-snapshot-preview1" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 929 | 930 | [[package]] 931 | name = "winapi" 932 | version = "0.3.9" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 935 | dependencies = [ 936 | "winapi-i686-pc-windows-gnu", 937 | "winapi-x86_64-pc-windows-gnu", 938 | ] 939 | 940 | [[package]] 941 | name = "winapi-i686-pc-windows-gnu" 942 | version = "0.4.0" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 945 | 946 | [[package]] 947 | name = "winapi-x86_64-pc-windows-gnu" 948 | version = "0.4.0" 949 | source = "registry+https://github.com/rust-lang/crates.io-index" 950 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 951 | 952 | [[package]] 953 | name = "windows-sys" 954 | version = "0.32.0" 955 | source = "registry+https://github.com/rust-lang/crates.io-index" 956 | checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" 957 | dependencies = [ 958 | "windows_aarch64_msvc 0.32.0", 959 | "windows_i686_gnu 0.32.0", 960 | "windows_i686_msvc 0.32.0", 961 | "windows_x86_64_gnu 0.32.0", 962 | "windows_x86_64_msvc 0.32.0", 963 | ] 964 | 965 | [[package]] 966 | name = "windows-sys" 967 | version = "0.48.0" 968 | source = "registry+https://github.com/rust-lang/crates.io-index" 969 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 970 | dependencies = [ 971 | "windows-targets 0.48.0", 972 | ] 973 | 974 | [[package]] 975 | name = "windows-sys" 976 | version = "0.52.0" 977 | source = "registry+https://github.com/rust-lang/crates.io-index" 978 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 979 | dependencies = [ 980 | "windows-targets 0.52.6", 981 | ] 982 | 983 | [[package]] 984 | name = "windows-targets" 985 | version = "0.48.0" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 988 | dependencies = [ 989 | "windows_aarch64_gnullvm 0.48.0", 990 | "windows_aarch64_msvc 0.48.0", 991 | "windows_i686_gnu 0.48.0", 992 | "windows_i686_msvc 0.48.0", 993 | "windows_x86_64_gnu 0.48.0", 994 | "windows_x86_64_gnullvm 0.48.0", 995 | "windows_x86_64_msvc 0.48.0", 996 | ] 997 | 998 | [[package]] 999 | name = "windows-targets" 1000 | version = "0.52.6" 1001 | source = "registry+https://github.com/rust-lang/crates.io-index" 1002 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1003 | dependencies = [ 1004 | "windows_aarch64_gnullvm 0.52.6", 1005 | "windows_aarch64_msvc 0.52.6", 1006 | "windows_i686_gnu 0.52.6", 1007 | "windows_i686_gnullvm", 1008 | "windows_i686_msvc 0.52.6", 1009 | "windows_x86_64_gnu 0.52.6", 1010 | "windows_x86_64_gnullvm 0.52.6", 1011 | "windows_x86_64_msvc 0.52.6", 1012 | ] 1013 | 1014 | [[package]] 1015 | name = "windows_aarch64_gnullvm" 1016 | version = "0.48.0" 1017 | source = "registry+https://github.com/rust-lang/crates.io-index" 1018 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1019 | 1020 | [[package]] 1021 | name = "windows_aarch64_gnullvm" 1022 | version = "0.52.6" 1023 | source = "registry+https://github.com/rust-lang/crates.io-index" 1024 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1025 | 1026 | [[package]] 1027 | name = "windows_aarch64_msvc" 1028 | version = "0.32.0" 1029 | source = "registry+https://github.com/rust-lang/crates.io-index" 1030 | checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" 1031 | 1032 | [[package]] 1033 | name = "windows_aarch64_msvc" 1034 | version = "0.48.0" 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" 1036 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1037 | 1038 | [[package]] 1039 | name = "windows_aarch64_msvc" 1040 | version = "0.52.6" 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" 1042 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 1043 | 1044 | [[package]] 1045 | name = "windows_i686_gnu" 1046 | version = "0.32.0" 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" 1048 | checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" 1049 | 1050 | [[package]] 1051 | name = "windows_i686_gnu" 1052 | version = "0.48.0" 1053 | source = "registry+https://github.com/rust-lang/crates.io-index" 1054 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1055 | 1056 | [[package]] 1057 | name = "windows_i686_gnu" 1058 | version = "0.52.6" 1059 | source = "registry+https://github.com/rust-lang/crates.io-index" 1060 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1061 | 1062 | [[package]] 1063 | name = "windows_i686_gnullvm" 1064 | version = "0.52.6" 1065 | source = "registry+https://github.com/rust-lang/crates.io-index" 1066 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 1067 | 1068 | [[package]] 1069 | name = "windows_i686_msvc" 1070 | version = "0.32.0" 1071 | source = "registry+https://github.com/rust-lang/crates.io-index" 1072 | checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" 1073 | 1074 | [[package]] 1075 | name = "windows_i686_msvc" 1076 | version = "0.48.0" 1077 | source = "registry+https://github.com/rust-lang/crates.io-index" 1078 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1079 | 1080 | [[package]] 1081 | name = "windows_i686_msvc" 1082 | version = "0.52.6" 1083 | source = "registry+https://github.com/rust-lang/crates.io-index" 1084 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1085 | 1086 | [[package]] 1087 | name = "windows_x86_64_gnu" 1088 | version = "0.32.0" 1089 | source = "registry+https://github.com/rust-lang/crates.io-index" 1090 | checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" 1091 | 1092 | [[package]] 1093 | name = "windows_x86_64_gnu" 1094 | version = "0.48.0" 1095 | source = "registry+https://github.com/rust-lang/crates.io-index" 1096 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1097 | 1098 | [[package]] 1099 | name = "windows_x86_64_gnu" 1100 | version = "0.52.6" 1101 | source = "registry+https://github.com/rust-lang/crates.io-index" 1102 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1103 | 1104 | [[package]] 1105 | name = "windows_x86_64_gnullvm" 1106 | version = "0.48.0" 1107 | source = "registry+https://github.com/rust-lang/crates.io-index" 1108 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1109 | 1110 | [[package]] 1111 | name = "windows_x86_64_gnullvm" 1112 | version = "0.52.6" 1113 | source = "registry+https://github.com/rust-lang/crates.io-index" 1114 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1115 | 1116 | [[package]] 1117 | name = "windows_x86_64_msvc" 1118 | version = "0.32.0" 1119 | source = "registry+https://github.com/rust-lang/crates.io-index" 1120 | checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" 1121 | 1122 | [[package]] 1123 | name = "windows_x86_64_msvc" 1124 | version = "0.48.0" 1125 | source = "registry+https://github.com/rust-lang/crates.io-index" 1126 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1127 | 1128 | [[package]] 1129 | name = "windows_x86_64_msvc" 1130 | version = "0.52.6" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1133 | -------------------------------------------------------------------------------- /resources/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | authors = ["Ryan"] 3 | edition = "2018" 4 | name = "resources" 5 | version = "1.0.0" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | lambda_runtime = "0.13.0" 11 | log = "0.4.20" 12 | serde_json = "1.0.113" 13 | simple_logger = "2.3.0" 14 | tokio = {version = "1.36.0", features = ["full"]} 15 | 16 | [[bin]] 17 | name = "bootstrap" 18 | path = "src/main.rs" 19 | -------------------------------------------------------------------------------- /resources/rustfmt.toml: -------------------------------------------------------------------------------- 1 | tab_spaces = 2 2 | -------------------------------------------------------------------------------- /resources/src/main.rs: -------------------------------------------------------------------------------- 1 | use lambda_runtime::{handler_fn, Context, Error}; 2 | use log::LevelFilter; 3 | use serde_json::{json, Value}; 4 | use simple_logger::SimpleLogger; 5 | 6 | #[tokio::main] 7 | async fn main() -> Result<(), Error> { 8 | SimpleLogger::new() 9 | .with_level(LevelFilter::Info) 10 | .init() 11 | .unwrap(); 12 | 13 | let func = handler_fn(handler); 14 | lambda_runtime::run(func).await?; 15 | Ok(()) 16 | } 17 | 18 | async fn handler(event: Value, _: Context) -> Result { 19 | let message = event["message"].as_str().unwrap_or("world"); 20 | let first_name = event["firstName"].as_str().unwrap_or("Anonymous"); 21 | 22 | let response = format!("Hello, {}! Your name is {}", message, first_name); 23 | log::info!("{}", response); 24 | 25 | Ok(json!({ "response": response })) 26 | } 27 | -------------------------------------------------------------------------------- /test/rust-lambda.test.ts: -------------------------------------------------------------------------------- 1 | import { expect as expectCDK, haveResourceLike } from '@aws-cdk/assert' 2 | import * as cdk from '@aws-cdk/core' 3 | import * as RustLambda from '../lib/rust-lambda-stack' 4 | import { Code, CodeConfig } from '@aws-cdk/aws-lambda' 5 | 6 | let fromAssetMock: jest.SpyInstance 7 | 8 | beforeAll(() => { 9 | fromAssetMock = jest.spyOn(Code, 'fromAsset').mockReturnValue({ 10 | isInline: false, 11 | bind: (): CodeConfig => { 12 | return { 13 | s3Location: { 14 | bucketName: 'my-bucket', 15 | objectKey: 'my-key', 16 | }, 17 | } 18 | }, 19 | bindToResource: () => { 20 | return 21 | }, 22 | } as any) 23 | }) 24 | 25 | afterAll(() => { 26 | fromAssetMock?.mockRestore() 27 | }) 28 | 29 | test('Lambda function and corresponding IAM role is created', () => { 30 | const app = new cdk.App() 31 | const stack = new RustLambda.RustLambdaStack(app, 'RustLambda') 32 | 33 | expectCDK(stack).to( 34 | haveResourceLike('AWS::IAM::Role', { 35 | AssumeRolePolicyDocument: { 36 | Statement: [ 37 | { 38 | Action: 'sts:AssumeRole', 39 | Effect: 'Allow', 40 | Principal: { 41 | Service: 'lambda.amazonaws.com', 42 | }, 43 | }, 44 | ], 45 | Version: '2012-10-17', 46 | }, 47 | ManagedPolicyArns: [], 48 | }) 49 | ) 50 | 51 | expectCDK(stack).to( 52 | haveResourceLike('AWS::Lambda::Function', { 53 | Role: {}, 54 | Architectures: ['arm64'], 55 | Description: 56 | 'Deploying a Rust function on Lambda using the custom runtime', 57 | Environment: { 58 | Variables: { 59 | RUST_BACKTRACE: '1', 60 | }, 61 | }, 62 | Handler: 'not.required', 63 | Runtime: 'provided.al2', 64 | }) 65 | ) 66 | }) 67 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": ["ESNext"], 6 | "declaration": true, 7 | "strict": true, 8 | "noImplicitAny": true, 9 | "strictNullChecks": true, 10 | "noImplicitThis": true, 11 | "alwaysStrict": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": false, 14 | "noImplicitReturns": true, 15 | "noFallthroughCasesInSwitch": false, 16 | "inlineSourceMap": true, 17 | "inlineSources": true, 18 | "experimentalDecorators": true, 19 | "strictPropertyInitialization": false, 20 | "skipLibCheck": true, 21 | "typeRoots": ["./node_modules/@types"] 22 | }, 23 | "exclude": ["cdk.out"] 24 | } 25 | -------------------------------------------------------------------------------- /ubuntu-config: -------------------------------------------------------------------------------- 1 | [target.aarch64-unknown-linux-musl] 2 | linker = "aarch64-linux-gnu-gcc" 3 | rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ] 4 | 5 | --------------------------------------------------------------------------------