https://pulumi.com logo
p

proud-tiger-5743

09/25/2018, 10:37 PM
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

white-balloon-205

09/25/2018, 11:58 PM
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

lemon-spoon-91807

09/25/2018, 11:59 PM
in the latest bits, you can just do:
new aws.lambda.CallbackFunction(name, { func: (ev, context) => { } })
too!
(but like, bleeding edge dev-bits)
p

proud-tiger-5743

09/26/2018, 12:04 AM
@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

lemon-spoon-91807

09/26/2018, 12:05 AM
it's currently in pulumi/aws master branch 🙂
p

proud-tiger-5743

09/26/2018, 12:05 AM
Which version??
l

lemon-spoon-91807

09/26/2018, 12:06 AM
looking 😄
w

white-balloon-205

09/26/2018, 12:07 AM
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

lemon-spoon-91807

09/26/2018, 12:07 AM
👍 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

proud-tiger-5743

09/26/2018, 12:08 AM
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

lemon-spoon-91807

09/26/2018, 12:08 AM
yup yup!
FYI, @proud-tiger-5743 and i took this offline and walked through this.