awslabs / aws-lambda-powershell-runtime

This new PowerShell custom runtime for AWS Lambda makes it even easier to run Lambda functions written in PowerShell to process events.
Apache License 2.0
57 stars 17 forks source link

cdk example #4

Closed pharindoko closed 1 year ago

pharindoko commented 1 year ago

do you have any example / codesnippet that explains how to create the powershell layer and a related powershell lambda function in aws cdk ?

pharindoko commented 1 year ago

hello, is there anyone that can answer my questions :) ?

julianwood commented 1 year ago

Hi, we don't have an existing example yet but would be great to have one. Some resources I've spotted which could help (depending on what language you prefer to write CDK) Numerous CDK Patterns: https://serverlessland.com/patterns?framework=CDK An example custom runtime: https://www.proud2becloud.com/building-a-deno-serverless-application-using-lambda-custom-runtime-cdk/

pharindoko commented 1 year ago

hey @julianwood, hmm means I have to use SAM first to generate the layer and then create the lambdas itself via cdk ... That`s kinda ugly. Guess I will try to attach a container to the lambda directly using a dockerfile or switch to use python/nodejs as runtime.

br,

flo

julianwood commented 1 year ago

You wouldn't need to use SAM, you could use CDK to create the layer as well. Here are some examples: https://bobbyhadz.com/blog/aws-cdk-lambda-layers https://dev.to/upupkenchoong/how-to-provision-lambda-and-lambda-layer-with-cdk-2ff4

You can chose any language, hopefully the examples in Python and Node get you on your way.

pharindoko commented 1 year ago

thanks @julianwood,

Ive checked those samples ... both samples are fairly easy to implement as python and node are used as runtime. Is there any cdk sample for a lambda layer using a custom runtime (provided.al2). I havent found one :-/

br,

flo

pharindoko commented 1 year ago

Hey,

in your readme you claim that it is possible to build this custom runtime using CDK, SLS or other tools.
I only see your SAM example.

I want to have a sample for CDK or at least a docker container or something I can use to build it on my own.
I don`t want to use SAM.

Building, deploying, and invoking PowerShell Lambda functions

You can build the custom runtime using a number of tools, including the the [AWS Command Line Interface (AWS CLI)](https://aws.amazon.com/cli/), or with infrastructure as code tools such as [AWS CloudFormation](https://aws.amazon.com/cloudformation/), [AWS Serverless Application Model (AWS SAM)](https://aws.amazon.com/serverless/sam/), [Serverless Framework](https://serverless.com/framework/), and [AWS Cloud Development Kit (AWS CDK)](https://aws.amazon.com/cdk/).

I`m disappointed because I would have expected more.
I`ve seen this blog entry and this serverless-land video.

br,

flo

pharindoko commented 1 year ago

Ok I understood now that I have to execute the make commands to get the custom runtime for the layer...