aws-lambda

mj_langford 2017-11-01T18:51:31.000434Z

@gonewest818 Hey, just saw your messages on here. That project is a bit out of date.

mj_langford 2017-11-01T18:51:42.000486Z

Proxy was painful and never worked well for me

mj_langford 2017-11-01T18:52:16.000180Z

As to logging, you sometimes need to manually turn on cloudwatch for an API in the AWS API page.

mj_langford 2017-11-01T18:52:57.000244Z

I too have been looking at sls, the java startup time was painful as hell

mj_langford 2017-11-01T18:53:35.000489Z

There is a slight error in the wrapper library that I worked around a bit in the real app we were writing with this stack

mj_langford 2017-11-01T18:53:41.000586Z

but I didn't port back to the presentation yet

mj_langford 2017-11-01T18:53:50.000251Z

It makes exceptions harder to see.

mj_langford 2017-11-01T18:55:03.000639Z

If you look at the resource directory, you can see the AWS api spec we were using

mj_langford 2017-11-01T18:55:20.000271Z

for that presentation, and see how it does not use proxy, and that worked

mj_langford 2017-11-01T18:55:32.000593Z

But you do have to be careful with IAM being setup well for each item.

mj_langford 2017-11-01T18:55:49.000176Z

The sls (aka, Serverless) project does stuff with AWS Cloudformation that helps set that all up

mj_langford 2017-11-01T18:56:10.000502Z

But basically: This stuff is all extremely poorly documented, and it's like pulling teeth to get logging of what is wrong a lot of time

mj_langford 2017-11-01T18:56:30.000126Z

I strongly suggest looking into the tool https://github.com/jorgebastida/awslogs

mj_langford 2017-11-01T18:56:40.000773Z

it's very helpful in getting cloudwatch logs that have meaningful info

mj_langford 2017-11-01T19:00:15.000006Z

I also believe at the time of my demo...amazon dynamodb + lambda had a slightly different permission model. You may need to make the dynamodb table with a different IAM permission level than you have to make this all work

gonewest818 2017-11-01T19:25:49.000422Z

thanks @mj_langford. Now that I’m using lambada directly I’ve stopped following the template from your presentation, and I’ve got something that’s fairly different. I’m still using lein-clj-lambda to deploy code and manage the API gateway. I’m logging with timbre. Next on my list is integrating dynamodb via faraday.

gonewest818 2017-11-01T19:31:47.000554Z

It hasn’t been effortless, to say the least. I had to fork and modify lein-clj-lambda to increase the timeout on another AWS api call that was taking longer than expected to succeed. (and it took me a while to recognize that the call would succeed if given more time). I also had to fork faraday and update it’s delared dependency on the aws java sdk to match other libraries in my project.

gonewest818 2017-11-01T19:44:27.000289Z

and it took me some time browsing logs and reading docs to figure out how the API gateway {proxy+} integration passes the path, body, and query parameters along to lambda. I was surprised I couldn’t find a document that simply said “you’re going to get an event, it’ll be json, it’s going to have a dictionary, and in that dictionary the keys you need are ‘path’ and ‘queryStringParameters’.”