lorennorman / ruby-on-lambda

Automation scripts to help run Ruby 2.1 programs on AWS Lambda
MIT License
143 stars 27 forks source link

Lambda function must first be created? #2

Closed manuelmeurer closed 8 years ago

manuelmeurer commented 8 years ago

Hey,

First: thanks for putting this code on here, helped me a lot!

I'm trying to get a "hello world" to work, followed the instructions in the README but at the point where aws lambda update-function-code is called, I see this error:

A client error (ResourceNotFoundException) occurred when calling the UpdateFunctionCode operation: Function not found: arn:aws:lambda:us-east-1:080694036296:function:helloRuby

From aws lambda update-function-code help:

Updates the code for the specified Lambda function. This operation must
only be used on an existing Lambda  function  and  cannot  be  used  to
update the function configuration.

Maybe update-function-code could be used to create functions as well back when you wrote your code? I'll try to make it work with create-function now, but when rerunning it, we'll probably need to check if the function exists first...

lorennorman commented 8 years ago

Awesome, glad it has been helpful! Sorry it didn't all Just Work :(

I don't have time to unravel this right now and get my brain back into it to really help you, but here's a quick comment: I had already created the lambda function via the AWS management console. If you haven't done that yet, it doesn't make any sense to try and "update its code"...

...and as I re-read the name of this issue, I realize that's just what you're asking! So yeah, I need to update the readme to take a more "first time use" perspective.

Does this clear things up enough for you to take it from here? How else can I be helpful?

manuelmeurer commented 8 years ago

Yeah, that's what I thought! :smile: If I can make it work with create-function, I'll send you a PR.

manuelmeurer commented 8 years ago

I created an Ansible role based on your shell script: https://github.com/krautcomputing/ansible-aws-lambda-ruby Thanks again for putting this up, it helped a lot! :smile:

lorennorman commented 8 years ago

Bravo! I'm a big fan of Ansible, as well. Thanks for making this and for the mentions!