aws-lambda-dotnet icon indicating copy to clipboard operation
aws-lambda-dotnet copied to clipboard

Ability to assign Lambda Layers on the function

Open tim-hampton opened this issue 10 months ago • 1 comments

Describe the feature

Similar to how we can already assign a Role or ResourceName to a Lambda function using the LambdaFunctionAttribute, we would like to be able to assign a Layer(s) to a Lambda function and also to have it update the CF template's serverless.template file.

Use Case

We have multiple stages that we deploy our Lambda functions to currently, and we have the ability to dynamically change the Role by using conditional build directives in C#, but only because the LambdaFunctionAttribute already exists. Unfortunately we have to manually edit the layer(s) for a given function directly in the serverless.template prior to deploying our Lambdas.

Proposed Solution

Ideally it would be implemented as an attribute, like the LambdaFunctionAttribute is done. If it would be more appropriate to add a Layers property to the existing LambdaFunctionAttribute, that would be acceptable too.

Other Information

The only alternative we've considered is using a PowerShell script to make the change for us when building the project.

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

AWS .NET SDK and/or Package version used

AWSSDK.Core 3.7.302.20, AWSSDK.Lambda 3.7.303.37

Targeted .NET Platform

.Net 6+

Operating System and version

Any

tim-hampton avatar Apr 09 '24 18:04 tim-hampton