loading words...

Feb 22, 2019 00:01:43

some serverless tricks

by @swizecteller | 192 words | 🐣 | 116💌

Swizec Teller

Current day streak: 0🐣
Total posts: 116💌
Total words: 32303 (129 pages 📄)

Last night @davidwells showed me some Serverless tricks. #200wordsTIL

thread 👇

---

Serverless, if you don't know is a framework thingy that makes it easier to use AWS services. In particular the whole serverless lambda function ecosystem.

https://xkcd.com/1053/

---

Instead of futzing around with Amazon's for engineers by engineers impossible to understand dashboard, you write a serverless.yml file and Serverless handles the rest.

---

serverless.yml means your infrastructure is under git version control too, not just your code. Very powerful.

Plus you can deploy both code and infrastructure updates with `serverless deploy` 👌

---

So the first trick @davidwells showed me was that you can follow logs from your Lambda function. No need to go see on AWS dashboard.

sls logs -f <func name> -t

---

That didn't work for me so he showed me another trick: Last N minutes of logs

sls logs -f <func --startTime 2m

---

Logs have a delay sometimes. You have to try a few times before you get the latest logs. Never more than a few seconds, I'm just impatient.

---

Then there's also a faster way to deploy. Pushes just the code changes I'm told.

`sls deploy function -f privateEndpoint`



contact: email - twitter / Terms / Privacy