- Goals
- Assumptions
- Installing Prerequisits
- A note about linking on macOS
- A note on debug and release builds
- A note about the GNU Make Standard Library
- Running
- Inspirations and Sources
Install rustup
, the Rust installer and version manager. Run the following command and follow the instructions on screen. You should be able to just accept the defaults.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
To verify the installation was successful run:
cargo --version
And you should see outpup like:
cargo 1.43.0 (2cbe9048e 2020-05-03)
AWS Lambda will run our function in an Amazon Linux Environment. So we will use musl libc "libc" implementaiton so we can staticly link our binaries for running on Lambda. We will use this to eliminates the need an EC2 instance with Amazon Linux to compile our lambda functions.
The musl libc tools are installed via Homebrew. Please make sure you have it installed before proceeding.
Install the target for musl:
rustup target add x86_64-unknown-linux-musl
Install musl-tools:
brew install filosottile/musl-cross/musl-cross
Install the target for musl:
rustup target add x86_64-unknown-linux-musl
Install musl-tools:
sudo apt install musl-tools
We require SAM CLI v0.50+. The SAM CLI is installed via Homebrew on both macOS and Linux. Please make sure those are installed and follow these instructions. For full installation details, please see the offical docs.
brew tap aws/tap
brew install aws-sam-cli
sam --version
We require version 0.50.0 or greater:
SAM CLI, version 0.51.0
Docker is required for local invocation. However, only a small portion of AWS' infastructure can be simulated locally via Docker. So this can be of limited use.
Under macOS we need to tell cargo
about our musl based linker.
So we have added a config file in the .cargo
directory: .cargo/config
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"
Currently this project is set to only do debug builds. In the future, I plan the ability to switch between build and debug. And, hopefully, add local debugging.
The files gsml
and __gsml
are the GNU Make Standard Library or GMSL.
They provide useful functions but so far we are only using lc
to lowercase strings.
This might be overkill when we could be using the stardard shell command tr
.
But I expect as more functionality is added to this project more will be used.
The GMSL is released under the BSD License.
- AWS Lambda Functions written in Rust by Roberto Huertas