AWS Lambda to retrieves images from Photos DB.
It is intended for this to be an integration an HTTP API with DynamoDB.
Currently, there are no tests for this code. Pure cowboy stuff at the moment!
cargo test
To build the Rust binary
$ cargo build --release
$ cargo build --release --target x86_64-unknown-linux-musl
To build the AWS Lambda zip file
$ cp ./target/x86_64-unknown-linux-musl/release/get-photos-lambda ./bootstrap && zip lambda.zip bootstrap && rm bootstrap
Create AWS Lambda for the first time
$ aws lambda create-function --function-name get-photos \
--handler not.used.in.rust \
--zip-file fileb://./lambda.zip \
--runtime provided \
--role arn:aws:iam::409276471434:role/get-photos-lambda \
--environment Variables={RUST_BACKTRACE=1} \
--tracing-config Mode=Active
To update the code of an existing AWS Lambda
$ aws lambda update-function-code --function-name get-photos \
--zip-file fileb://./lambda.zip
To simplify the building and deployment use the following tool.
$ cargo install cargo-aws-lambda
$ cargo aws-lambda {your aws function's full ARN} {your-binary-name}
To test your deployed AWS Lambda works correctly
$ aws lambda invoke --function-name get-photos \
--cli-binary-format raw-in-base64-out \
--payload '{"firstName": "world"}' \
output.json
$ cat output.json # Prints: {"message":"Hello, world!"}