Is it possible, either with `serverless` or `aws` ...
# general
p
Is it possible, either with
serverless
or
aws
to write a lambda function inline, in JS? The goal is to bind it to Kinesis, but I'd like to not have to create a separate folder, if possible. Can you write regular JS here?
Copy code
let lambda = new aws.lambda.Function("mylambda", {
    runtime: foo,
    code: CAN CODE GO HERE?,
    timeout: 300,
    handler: foo,
    role: role.arn,
    environment: { 
        variables: {
            "COUNTER_TABLE": counterTable.name
        }
    },
}, { dependsOn: [fullAccess] });
w
You can create a
new aws.serverless.Function
and then pass its
.function
property as a
aws.lambda.Function
object. We're actually actively working on making this more discoverable and simpler. /cc @lemon-spoon-91807.
l
in the latest bits, you can just do:
new aws.lambda.CallbackFunction(name, { func: (ev, context) => { } })
too!
(but like, bleeding edge dev-bits)
p
@white-balloon-205 How would that work exactly? Do I write my function externally and pass it as a Handler, or something similar?
@lemon-spoon-91807 - is that a separate branch somewhere?
l
it's currently in pulumi/aws master branch 🙂
p
Which version??
l
looking 😄
w
I recommend focusing on using what’s already released - it’ll be easier than trying to get dev builds working unless there is something you really want to try.
l
👍 to what look said
i'll point you to waht's available now
but there will be some nicer stuff soon (it just has to bake a bit first)
p
Sounds good - @white-balloon-205's method sounds fine - would you be able to share a little boilerplate as to how those would wire up?
l
yup yup!
FYI, @proud-tiger-5743 and i took this offline and walked through this.