The document discusses moving a Slack commands application from a single Express app hosting all commands to individual serverless functions (Lambda) per command. It provides examples of the code structure for a sample "user stats" command function, how it is executed by AWS Lambda, and how CloudFormation templates are used to define and deploy the Lambda function and its resources to AWS.
5. we use to
◍ get user stats
◍ monitor/test unpacker
uploads
◍ ask yoda who’s on call
◍ see who’s out tmrw
◍ pick a random teammate
Place your screenshot here
@AnjanaVakil JazzCon.Tech 2018
8. All commands in a single app: Downsides
Security
◍ Permissions?
Secrets?
◍ Least privilege
Maintenance
◍ Many different
teams involved
◍ Ownership?
Support?
◍ Code gumbo
Cost
◍ Always running
◍ No per-command
breakdown
@AnjanaVakil JazzCon.Tech 2018
10. “
While swing music tended to feature
orchestrated big band arrangements,
bebop music highlighted improvisation.
@AnjanaVakil JazzCon.Tech 2018
wikipedia
13. “I kept thinking there's bound to be something
else. I could hear it sometimes. I couldn't play it....
I found that by using the higher intervals of a
chord as a melody line and backing them with
appropriately related changes, I could play the
thing I'd been hearing. It came alive.
- Charlie Parker
@AnjanaVakil JazzCon.Tech 2018
wikipedia
15. “As bebop was not intended for dancing, it
enabled the musicians to play at faster tempos.
Bebop musicians explored advanced harmonies,
complex syncopation, altered chords, extended
chords, chord substitutions, asymmetrical
phrasing, and intricate melodies.
@AnjanaVakil JazzCon.Tech 2018
wikipedia
17. “there’s bound to be something else”
◍ Assign a single owner/gatekeeper?
◍ Multiple single-command apps?
◍ Separate commands from router app
@AnjanaVakil JazzCon.Tech 2018
19. what do you mean “serverless”
Actual Server
You own a computer
You put code on it
You run it constantly
(and you pay constantly)
You keep it healthy
Cloud Server
AWS owns a computer (or 2)
You put code on it
AWS runs it constantly
(and you pay constantly)
You tell AWS how to keep
it healthy
“No” Server
AWS owns a computer
You put code on it
AWS runs it when you ask
(and you pay only then)
AWS keeps it healthy
@AnjanaVakil JazzCon.Tech 2018
20. ◍ Only concern: Input -> Output
◍ No state maintained between calls
◍ Can be side-effecting, though
(e.g. API call, database write)
◍ Limited resources & exec time (5m)
what do you mean “function”
@AnjanaVakil JazzCon.Tech 2018
21. Lose the server if it’s...
◍ small
◍ short-lived
◍ self-contained
◍ needed occasionally
to lambda or not to lambda
Keep the server if it’s...
◍ heavy
◍ long-running
◍ interdependent
◍ needed constantly
@AnjanaVakil JazzCon.Tech 2018
53. why
did we do all that?
@AnjanaVakil JazzCon.Tech 2018
54. Before (single app)
◍ Many secrets in one
stack
◍ Updating your code
updates whole stack
◍ No fine-grained cost
analysis
Refactoring to Lambda: Benefits
After (multiple Lambdas)
◍ Each stack only knows
its own secrets
◍ Updating your code
leaves others untouched
◍ Each stack/fn can be
tagged & cost-monitored
@AnjanaVakil JazzCon.Tech 2018