troposphere icon indicating copy to clipboard operation
troposphere copied to clipboard

Do you support python lamba?

Open emayssat-ms opened this issue 8 years ago • 6 comments

Hello, I see your nodejs example which I am going to test. But is it possible to have a python example? Maybe I just need to change the code with python one. One issue though is access to libraries/modules.

emayssat-ms avatar Jan 05 '17 22:01 emayssat-ms

I'm not aware of anything in troposphere that prevents you from using the python2.7 runtime and uploading Python code into AWS lambda using troposphere and CloudFormation.

markpeek avatar Jan 05 '17 23:01 markpeek

Troposphere works great to deploy lambda functions using the python runtime though you will need to create a deployment package if you need additional modules. The AWS documentation provides a basic overview on creating a deployment package. AWS has also extended Cloudformation with the Serverless Application Model and Cloudformation Transforms. These features can simplify your development workflow but unfortunately, Troposphere support has not yet been implemented. At the moment, I just patch the Troposphere generated template.

vaneek avatar Jan 06 '17 13:01 vaneek

@vaneek I was getting around to playing with SAM. Does it work fine with a json template? If so adding the Transforms section should be trivial. I meant to add it to 1.9.1 but I got hung up prototyping yaml support last weekend (which needs more thought/work).

markpeek avatar Jan 06 '17 15:01 markpeek

@markpeek Hi Mark, I was using YAML as it was easier for me to patch the template. I suppose it will work fine with json as well - the documentation shows json and yaml formats. SAM has introduced a new resource types, AWS::Serverless::Function, AWS::Serverless::Api and AWS::Serverless::SimpleTable. The serverless/lambda function transform is referenced in the Template Anatomy section of the Cloudformation documentation but nothing in the Template Reference section. I hope AWS will improve the documentation. There is also some information in the Lambda deployment documentation but I ended up digging through the AWS CLI source code to realize it wasn't listed in the cloudformation resource types(d'oh!).

There is a repository on github with better documentation. Hopefully this will make its way into the proper documentation.

vaneek avatar Jan 06 '17 19:01 vaneek

https://github.com/awslabs/aws-cfn-template-flip JSON --> YAML by AWS ! Python module included!

Enjoy!

emayssat-ms avatar Jan 10 '17 17:01 emayssat-ms

@emayssat-ms Thanks for the pointer. Here's the quick implementation if you want to try it.

markpeek avatar Jan 10 '17 17:01 markpeek