AuroraLantean / rust-aws-lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS Lambda

Source

Semicolon YouTuber: https://www.youtube.com/watch?v=qL2mh1k3cTc&list=PLDi2liHqCnVomqnjLp9Jq1jk-XFWque6C

Prerequisites and Installation

curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

Setup

  1. Clone the repository:
git clone git@github.com:AuroraLantean/rust-aws-lambda.git
cd rust-aws-lambda
  1. Build binaries
cargo lambda build --release --arm64
zip dummy.zip target/lambda/aws-lambda/bootstrap -j
cp dummy.zip ~/
  1. Deployment to AWS
  • Loging to AWS, on top right, set data center to one close to you.
  • Search for "Lambda", click on "Create A Function", then "Author from scratch".
  • Configuration: Function Name: dummy, Runtime = Amazon Linux 2023(for Go/Rust/C++), Architecture = arm64(according to what architecture you have built your lambda function), then click on "Create Function"
  • Under Code tab: Code Source, click on "Upload from", then select your built lambda function
  • Under Configuration, and Function URL: Create function URL, Auth = None(so the API is open to the public)
  • Copy the function URL, use one of the API senders below
  • Under "Monitor" tab, click on "View CloudWatch logs"

API Endpoints

https://abc123.lambda-url.ap-northeast-2.on.aws/

https://abc123.lambda-url.ap-northeast-2.on.aws/?name=Jack

Use Insomnia to send Requests

Use Slumber to send Requests

slumber request -p production root
slumber request -p production get_tasks | jq
slumber request -p production add_task1
slumber request -p production update_task1
slumber request -p production delete_task1

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE.

About

License:GNU General Public License v3.0


Languages

Language:Rust 100.0%