https://pulumi.com logo
Title
b

bland-smartphone-19451

07/29/2021, 7:57 AM
Hi, I'm new to the pulumi, i have a aws lambda function which implements with Rust, does pulumi support deploy the rust lambda function?
g

great-sunset-355

07/29/2021, 8:30 AM
Runtime is just a string, so as long as you supply valid runtime value then yes, see https://www.pulumi.com/docs/reference/pkg/aws/lambda/function/#inputs for more info
b

bland-smartphone-19451

07/29/2021, 8:36 AM
after, i supply valid runtime(eg. provide), how to upload the rust executable file (usually called bootstrap)
g

great-sunset-355

07/29/2021, 9:43 AM
Are you new to Infrastructure as Code as well?
I'd recommend reading pulumi examples
b

bland-smartphone-19451

07/29/2021, 11:56 AM
i very familiar with aws sam, i have a project that use sam to manage aws lambda functions and related resources, but use rust as well, i want translate the project to pulumi ,i have read the pulumi examples, i just don't know how to handle this scenario🤣
g

great-sunset-355

07/29/2021, 12:06 PM
SAM abstracts quite a bit from you, I reckon it creates a lambda and loads the Rust binary from S3. So to use it with pulumi you'll need to upload the binary to S3 (pulumi resource S3 object) and then attach this to the lambda
🙌 1
m

most-father-39313

07/29/2021, 2:17 PM
hey @bland-smartphone-19451 I've spent the last couple days doing exactly this. Here's a gist with my code: https://gist.github.com/newhouseb/1944cf4bdeeb5bc799bc327fc8a25f59 Couple notes: • You need to specify a handler even though it's not used, because somewhere in Pulumi it'll otherwise try to use a handler of "" which AWS does not like. • You might already be familiar but awsx's apigateway functions use API Gateway V1. Rust packages like lambda_web require V2, so I had to manually set up everything with aws.apigatewayv2
(and also assuming you already know all the things about musl & libc if you've deployed rust in a Lambda elsewhere)
b

bland-smartphone-19451

07/29/2021, 3:36 PM
thank you
g

great-sunset-355

07/29/2021, 6:02 PM
what's the advantage of using Rust in lambda?
m

most-father-39313

07/29/2021, 6:41 PM
Well, I like the type-safety and overall correctness that Rust enforces and I like AWS Lambda because I don't like to manage servers and most of my services are small enough scale that even a single dedicated VM would be overkill
👍 1