DynamoDB and Serverless Powered Pokemon API with CDK

Take advantage of the AWS CDK to program your infrastructure as code while advancing your Rust and Serverless knowledge with the same infrastructure lego blocks platforms like Netlify use to power their own offerings. Use DynamoDB to store resources, AWS Lambda to execute Rust binaries, and AWS Gateway to expose our lambdas to the internet.

Watch 1 hour, 5 minutes of guided lessons.

Extra Workshop Details

Companies like Netlify make it easy to get up and running with Serverless functions. Sometimes you want to have more control, pay a lower price, or integrate with different technologies.

In those cases, the same powerful components Netlify uses to drive their Functions offering are available to you with AWS Lambda and the rest of AWS' offerings.

We'll cover AWS from scratch, assuming absolutely nothing about what you already know and learn how to deploy Rust code to AWS Lambda.

const pokemonLambda = new aws_lambda.Function(this, "PokemonHandler", {
runtime: aws_lambda.Runtime.PROVIDED_AL2,
handler: "pokemon-handler",
code: aws_lambda.Code.fromAsset("../lambdas/pokemon-api"),
memorySize: 1024,

Then we'll take advantage of the composability of AWS services to plug our Lambda into DynamoDB, a Fast NoSQL Key-Value Database. Forget worrying about SQL connection pools, DynamoDB can handle connections from as many lambdas as you can throw at it, with millisecond performance as you scale.

async fn get_global_client() -> &'static Client {
.get_or_init(|| async {
let shared_config =
let client = Client::new(&shared_config);

While we can, and will, run our lambda code from the CLI, most of the time we'll want an API to be accessible from the internet. AWS Gateway provides authentication, rate-limiting, and of course, a public HTTP-accessible URL that will route to our lambda.

async fn handler(
event: LambdaEvent<ApiGatewayV2httpRequest>,
) -> Result<ApiGatewayV2httpResponse, Error> {
let (event, _context) = event.into_parts();
match event.path_parameters.get("pokemon") {

In addition to the main course, we'll cover cross-compilation using modern tools like cargo-zigbuild. We'll talk about why we need to cross-compile and what libc is.

cargo zigbuild --target x86_64-unknown-linux-gnu.2.26 --release