How to get Lambda functions configuration using async await?

Issue

I want to get the configuration of a lambda function using the GetFunctionConfiguration API.

Currently the code I am using is based on callbacks but I want to transform it to use async await.

var params = {
  FunctionName: "my-function",
};

lambda.getFunctionConfiguration(params, function (err, data) {
  // Do Something
});

Solution

This is what I was looking for. Chaining a .promise call will return a promise so it can now be used with async/await.

const data = await lambda.getFunctionConfiguration(params).promise()

Answered By – Anonymous Panda

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.