How To Test your AWS Lambda Function Locally with CDK

How To Test your AWS Lambda Function Locally with CDK

Be A Better Dev

2 года назад

40,921 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@xavierperez3001
@xavierperez3001 - 01.06.2023 17:55

Thank you for this.

Ответить
@djstacktrace
@djstacktrace - 14.03.2023 18:27

Is it possible to test locally via sam if os.environ is added to the code e.g. DB_HOST, DB_PORT for function env variables?

Ответить
@10SURA
@10SURA - 02.02.2023 00:29

What if the lambda connected to dynamo db ? will be connected to the AWS DynamoDB or we need to connect have local dynamo db instance up and running in this case ?

Ответить
@madrag
@madrag - 03.12.2022 00:42

Nice tutorial. Can you make simialar to this but this time how to debug cdk app (python) with context (for example -c stage=prepord) in visual studio code? How correctly setup lunch.json?

Ответить
@JohnnysaidWhat
@JohnnysaidWhat - 24.11.2022 21:42

Do you recommend this process for building step functions? I would think since the step function new visual editor generates a json definition file it’s easy enough to through into version control. Then you can use this to test individual lambdas within the step function locally. Does that makes sense? Or is there a way to use the json definition in this framework without any cdk and still have it included in deployments?

Ответить
@marian6040
@marian6040 - 13.11.2022 15:55

Excelent. I needed this. Thanks. Could you please make a video about awssdkcalls with cdk python?
I’m having a hard time understanding how to find the different information about it.

Ответить
@user-vm7we6bm7x
@user-vm7we6bm7x - 29.08.2022 08:48

keep in mind that you have to install aws-cdk.aws-lambda-python-alpha separately

Ответить
@sercantor1
@sercantor1 - 14.05.2022 11:24

That was really helpful man, thank you

Ответить
@pankajjoshi6658
@pankajjoshi6658 - 30.04.2022 14:30

Thanks.

Ответить
@christopherjohncali5237
@christopherjohncali5237 - 29.04.2022 17:33

Great video. Is there a link to docs for this? Looking for the javascript-specific implementation.

Ответить
@chrisrabe
@chrisrabe - 19.04.2022 01:16

That was very useful. I didn't know that you can do this! Thank you. Here I was testing my lambdas via the lamba management console like a noob

Ответить
@Garejoor
@Garejoor - 20.03.2022 04:23

if you are using websocket this doesn't work - try to make the decoupled enough so the websocket dependency is not a must

Ответить
@rugged9769
@rugged9769 - 18.03.2022 10:10

For the simple function used in this video, you don’t really need CDK. SAM can do everything and Sam local invoke will work too. I believe CDK is necessary when you lambda need to invoke other AWS services like s3 or dynamoDB

Ответить
@geoffrey-rf7pg
@geoffrey-rf7pg - 14.03.2022 09:43

This is good for basic lambdas but usually when you have to deal with other stuff such as SSM parameters, it becomes really dificult to test it this way, in my own experience.

Ответить
@rito081984
@rito081984 - 12.03.2022 02:15

This is very good . Thanks for this video

Ответить
@joesilva-rodriguez9
@joesilva-rodriguez9 - 09.03.2022 07:57

Can I do this in TS and cdk? Or is this Sam specific?

Ответить
@nachum800
@nachum800 - 06.03.2022 09:59

Great video, very clear and easy to follow!

Thank you

Ответить
@JoaoLuizHilario
@JoaoLuizHilario - 05.03.2022 04:35

Nice trick, but what about when we have to do some stuff with Aurora, DynamoDB or S3 inside the lambda function. And when is using API Gateway using Cognito Authorizers ? Will always need to set CLI session?

Ответить
@ianpogi5
@ianpogi5 - 04.03.2022 00:26

Thanks for the video! For real life scenario, how do you run this for multiple microservices with API gateway? I ask because I want to unify all my IaaC to CDK but the in ability to test locally stops me from doing that. Serverless framework + serverless-offline plugin does this very easily.

Ответить
@Johnathanaa7
@Johnathanaa7 - 03.03.2022 20:36

Man doesn't miss. I was reading the blog post by amazon for this like a week ago and you already have a video..

Ответить
@ToNmAnAyO
@ToNmAnAyO - 03.03.2022 19:32

serverless is also a good tool for aws lambdas

Ответить
@XStrikeSuper
@XStrikeSuper - 03.03.2022 19:15

Will you also do a video what the best way to do an integration test to hit real AWS service? Eg: Send a message to SQS which trigger a lambda function to add item in DynamoDb. How do we test this as part of integration test?

Ответить
@MrDadidou
@MrDadidou - 03.03.2022 18:33

really nice. i'm wondering how i can integrate my lambda layers with this.
Need to RTFM a bit

Ответить
@rahulsaha2859
@rahulsaha2859 - 03.03.2022 18:18

A great video. Always wanted to test lambda locally.

Ответить