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

CloudFormation: Custom resource support for .NET Core Lambda functions

Open NeilBostrom opened this issue 8 years ago • 15 comments

I wanted to write some custom resources for my CloudFormation templates using .NET core in AWS Lambdas. All the samples are in JS and Python at the moment:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-custom-resources-lambda-lookup-amiids.html

I'm assuming CloudFormation event models are not currently supported by the SDK? I found S3 models and others but no CloudFormation ones.

I've written a version of the request / response model for CloudFormation in Lambdas. Is this something you would be interested in me creating a PR for?

I also have a working version of cfn-response in .NET which feels like it would be super handy to have in the SDK for people to be able to call on their Lambda response calls. The version is based around the documentation at:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule

Let me know if you are interested in any of the above and I can look at creating a PR for it.

NeilBostrom avatar Jan 04 '17 09:01 NeilBostrom

I'm not familiar with this Lambda/CloudFormation feature. Let me process your links and think about how it fits in with our tooling.

normj avatar Jan 05 '17 09:01 normj

I would be happy to be the first step be adding a nuget package for the event objects (say, Amazon.Lambda.CloudFormationEvents) so that work on this could start to gel.

zapproved avatar Mar 21 '17 20:03 zapproved

Did you want me to throw some of my code in to a PR?

Muppets avatar Mar 21 '17 20:03 Muppets

Did anything come of this? I haven't found an example. I'm able to catch the incoming requests via SNS/Lambda integration, but don't see an event class for this or a reponse class object

oldnerd avatar Feb 05 '18 18:02 oldnerd

I have an interest in creating Lambda backed custom resources in .NET as well. Therefore I too am curious as to whether anything came out of this.

@NeilBostrom would you be comfortable open sourcing your request / response models and your .net port of cfn-response?

alexconwayspok avatar Jun 06 '18 14:06 alexconwayspok

@alexconwayspok Sure, it's a few classes and a sample that looks up a specific AMI by name.

https://gist.github.com/NeilBostrom/97048a42e536a3b94f37dce2e4ac0c38

NeilBostrom avatar Jun 06 '18 15:06 NeilBostrom

Thanks for the gist @NeilBostrom. It would be great to see this feature within the SDK some day.

swlasse avatar Jul 12 '18 08:07 swlasse

@normj Did you want me to try to put a PR for this feature together? Might need some thoughts from you and your team on how you would want it integrated with the rest of the SDK but I'm happy to help do some legwork.

NeilBostrom avatar Jul 12 '18 09:07 NeilBostrom

@NeilBostrom FWIW, in case you submit a PR, I will be happy to provide my view on it.

swlasse avatar Jul 13 '18 12:07 swlasse

Any news about this?

matheusmaximo avatar Mar 04 '19 10:03 matheusmaximo

I have the same requirement, currently I want to create a serverless application using net core, and need to use a custom cloudformation resource to configure parts of Cognito that are not accessible via cloud formation. I am currently using a JS Custom Resource to achieve this, but would be much better to have a homogeneous approach.

@NeilBostrom , thanks for sharing your code, this is at least a starting point.

scottjbaldwin avatar Mar 23 '19 05:03 scottjbaldwin

Add one more vote for this feature. I'd like to be able to integrate C# lambda with my CloudFormation-driven deployment process.

@NeilBostrom Thanks for the sample code. It'll be useful in the meantime.

johniwasz avatar Jun 18 '19 16:06 johniwasz

I took @NeilBostrom Gist, and expanded it to make life a bit easier.

You can find my changes here: https://gist.github.com/ApocDev/11ce0d06ad06a0d63f67bbf184aa388b

Example of usage (to create MySQL users after database creation): https://gist.github.com/ApocDev/d6b13f932564492cea780b90dd537608

ApocDev avatar Sep 06 '19 15:09 ApocDev

I had the same requirement and decided to build a Helper library around this. There is no documentation yet, but code and usage help is available on Gitlab. Available as Nuget Package.

SaurabhHarwande avatar Jan 02 '21 16:01 SaurabhHarwande