aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.58k stars 477 forks source link

CloudFormation: Custom resource support for .NET Core Lambda functions #26

Open NeilBostrom opened 7 years ago

NeilBostrom commented 7 years ago

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.

normj commented 7 years ago

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

zapproved commented 7 years ago

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.

Muppets commented 7 years ago

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

oldnerd commented 6 years ago

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

alexconwayspok commented 6 years ago

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?

NeilBostrom commented 6 years ago

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

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

swlasse commented 6 years ago

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

NeilBostrom commented 6 years ago

@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.

swlasse commented 6 years ago

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

matheusmaximo commented 5 years ago

Any news about this?

scottjbaldwin commented 5 years ago

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.

johniwasz commented 5 years ago

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.

ApocDev commented 5 years ago

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

SaurabhHarwande commented 3 years ago

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.

dguisinger commented 4 months ago

I also would like an official nuget package for this.