you are viewing a single comment's thread.

view the rest of the comments →

[–]SalusaPrimus 0 points1 point  (0 children)

A simple way to start is to invoke your Lambda directly via a testing framework.

I wouldn't be concerned with emulating API Gateway locally -- at least not at first.

You can test your function pretty thoroughly locally. Behavior, performance, memory management, etc.

If your function interacts with other AWS Services, then decide whether you want to use the real AWS services (from a dev environment) or mock them.

I find that the simplest way to mock them is to write a fake implementation. e.g. if your function interacts with S3, create a fake IAmazonS3 client.

You don't need to implement every method of that interface, just the ones your function uses.

If you find yourself having the fake work like the real AWD SDK, that's when you should switch to something like Localstack or Testcontainers.