1. 8
    Change the properties of a lambda function deployed with AWS CDK
    1m 27s

Change the properties of a lambda function deployed with AWS CDK

InstructorTomasz Łakomy

Share this video with your friends

Send Tweet

Every resource we deploy to AWS with CDK has some default values configured for us so that we don't have to configure everything ourselves.

This comes in handy because it allows us to focus on building our infrastructure and solving our problems instead of configuring everything.

With that being said - CDK allows us to configure various properties of our resources! In this quick lesson we're going to learn how to configure the memory size and timeout of an AWS Lambda function.

Quang Le
~ 4 years ago

Not sure why there is a compilation error on timeout: cdk.Duration.seconds(10) as

  Types have separate declarations of a private property 'amount'.

26       timeout: cdk.Duration.seconds(10)
         ~~~~~~~

  node_modules/@aws-cdk/aws-lambda/lib/function.d.ts:67:14
    67     readonly timeout?: Duration;
                    ~~~~~~~
    The expected type comes from property 'timeout' which is declared here on type 'FunctionProps'

Does there anyone have any idea? Thanks

Tomasz Łakomyinstructor
~ 4 years ago

Hey! Is your code open source? I'd like to take a look and help :)

Akash Manohar
~ 3 years ago

@quang I got the same error. Open package.json and look for the difference in versions for aws-cdk, aws-cdk/core and aws-cdk/aws-lambda. Change everything to the same verison.

For example: I had 1.222.0 for aws-cdk/aws-lambda but aws-cdk and aws-cdk/core were at 1.221.0. I changed everything by hand to 1.222.0 and that resolved the error.

Also for compatibility I started using the "cdk" binary within the node_modules dir of the project. So all my cdk commands are like this example:

$(npm bin)/cdk diff