https://pulumi.com logo
Title
e

elegant-laptop-80400

11/21/2022, 6:08 PM
are there some examples of using aws-sdk inside of an inline lambda code? like
const lambda = new aws.lambda.CallbackFunction("mylambda", {
  callback: async e => {
    // aws sdk code here
  }
});
The serialization isn't going right for me and I am getting module not found error when it runs
b

better-translator-47169

11/22/2022, 8:33 PM
I believe you can use the sdk inline as follows if you
import * as aws _from_ '@pulumi/aws';
. Using DynamoDB as an example.
callback: async (event, context, callback) => {
      const client = new aws.sdk.DynamoDB.DocumentClient();
      const { Items } = await client
        .scan({
          TableName: table.name.get(),
        })
        .promise();
      callback(null, {Items});
    },
e

elegant-laptop-80400

11/22/2022, 8:35 PM
Thanks! that is what I figured out eventually. And I had to use v2 of the api to get it working.