The AWS Rust SDK Experience
I finally found the opportunity to use Rust in a real application. I needed to create an AWS Lambda, which wasn’t very complex, and AWS has a Rust SDK, so the stars aligned. I have been wanting to use Rust more over the years, and I can say that the experience has been great. The AWS SDK appears comprehensive and has many features I enjoyed using.
One of the signatures for an EventBridge event is EventBridge<T1 = Value>
, which I like. The T
allows you to build a custom type using serde to deserialize the detail property on the EventBridge JSON object. There are a few attributes you have to define, which I hope to cover in a future post, that make it a little easier.
The last thing I have to say on the AWS Rust SDK side is that the unit testing story is good. I don’t think it’s as full-featured as the Python story. I decided to rely on mocks using mockall, when in Python, I would have used Moto. Moto isn’t so manual as everything is already mocked and tracks the state.
I have been slow to adopt Dev Containers in my IDE workflow, and I tried that out on this project. Why did I take so long to try them out? After some trial and error, I settled on using a custom Dockerfile for my dev container. I used the cargo-lambda base image, then I installed clippy, fmt, and just. One minor annoyance is having to authorize the Q Developer extension when the container is rebuilt.
These are just some quick thoughts from my first experience using the AWS Rust SDK. I look forward to writing about other interesting things that I discover along the way in this area.
Thanks for reading,
Jamie
If you enjoy the content, then consider buying me a coffee.