Live Blogging at DeveloperWeek: An Introduction to Microservices with the Serverless Framework
Tags: webdev, aws
Published: 2020-02-13 01:54:28

---
title: Live Blogging at DeveloperWeek: An Introduction to Microservices with the Serverless Framework
published: true
description: My take on another DeveloperWeek session. This was a crash course in how to get started with microservices using the Serverless Framework.
tags: #webdev #aws
---
<em>I'm live blogging my experience at DeveloperWeek, en masse, <a href="https://daedtech.com/live-blogging-developer-week-2020-day-1/">at my site</a>. You can follow along there, or look for me to post some talk summaries here, individually.</em>

This is a talk by <a title="Fernando Medina Corey" href="https://www.linkedin.com/in/fmc-sea/">Fernando Medina Corey</a>, of <a href="https://serverless.com/">Serverless</a>. He led into the talk with the caveat that he wouldn't be able to help us all debug a setup.

I'll cut him some slack, as long as I'm one of the people he stops the talk to help.

Anyway, he outlined 4 different goals:
<ol>
 	<li>Develop/test a microservice</li>
 	<li>Deploy to AWS</li>
 	<li>Debug the service</li>
 	<li>Monitor the service</li>
</ol>
Let's do it.  How would this go?  He has material for people afterward.
<ol>
 	<li>Create an AWS account</li>
 	<li>Install the AWS CLI.</li>
 	<li>Configure the AWS CLI</li>
 	<li>Install the Serverless Framwork: binary installer for Mac/Linux, Chocolatey on Windows, NPM.</li>
 	<li>Clone the project.</li>
</ol>
All of this will get to the point of building his toy application, "Serverless Jams."  I like where this is going.

Serverless Jams allows you to add a phone number, receive a voting code text, and then vote on songs.  The idea is to exercise a number of different APIs.

We're going to do this with Amazon API gateway, Lambda, a DynamoDB table, and Simple Notification Service.
<h3>What does the code look like?</h3>
Well, it looks like Python, at least on the backend, with 3 files. The client has Javascript, markup, and YAML.  On the backend:
<ul>
 	<li>generate_code.ph</li>
 	<li>get_votes.py</li>
 	<li>vote.py</li>
</ul>
Simple enough.  Now, on the front-end:
<ul>
 	<li>app.js</li>
 	<li>index.html</li>
</ul>
And then serverless.yaml, which wires things up from a configuration perspective.  This is where the magic happens, and Fernando walked us through all of the information that needs to go in here to create the right sets of permissions.

I know only enough about this to shoot myself in the foot, but he's making me feel like I'd be able to handle it in an afternoon.

In furtherance of this, Fernando asked how many lines of code all of this would take, combined with the front and back end?

The answer? 436 lines of code, "with me being a pretty poor front end developer."

(I'm with you there, Fernando, but I think if we switched to a language without significant whitespace on the backend, we could probably slam all of it into 50 lines, tops)
<h3>Deployment Options</h3>
With the structure and code squared away, he mentioned 3 potential deployment options.
<ol>
 	<li>Local AWS Keys (with 2 different sub-options)</li>
 	<li>Using the Serverless Dashboard, assuming you've created an account.</li>
 	<li>Serverless CI/CD.  (He won't touch on this today, but this is a good approach for teams that have established a serverless approach)</li>
</ol>
<h3>Demo Time!</h3>
And, with that, he popped open an IDE and started working.  Then it was time to sign up for serverless and get into the dashboard. He did this all pretty quickly, but it honestly looked really straightforward.

<a href="https://daedtech.com/wp-content/uploads/2020/02/20200212_161748-scaled.jpg"><img class="aligncenter wp-image-12420 size-full" src="https://daedtech.com/wp-content/uploads/2020/02/20200212_161748-scaled-e1581553687519.jpg" alt="" width="800" height="600" /></a>

After development, configuration and deployment, it was time to test and debug. First issue was that he mistyped his phone number, and the second was that he's already used his number for another demo. So this led to the actually-even-cooler situation where someone in the audience gave a phone number, received the code, and entered it.

At the end, perhaps not surprisingly, everything worked.  This left a little time for a deeper dive, and the audience voted to take a more detailed look at the front end.

In the end, enthusiastic applause.
<h3>My Takeaway:</h3>
This was a lot of fun to watch and well-presented. And there's something infectious about watching a talk that's basically, "look, this cool thing is totally more doable than you might have thought."

My takeaway here is that technologies like Lambas make glue code much more approachable.  But that's been true for a while, and I was aware of that.

But now, looking at Serverless as an orchestration framework, for lack of a better term, I have the sense that I can put together some very well integrated functionality very quickly. I have, perhaps, a false sense of confidence that I could do this in an afternoon.  But in reality, I can't imagine it'd take terribly longer.

If I put on my "old man programmer" hat, I can recall a time when building an app that sent me authentication codes via text would have required weeks, lots of planning and integration, and much pain. And it'd probably have been expensive.

Now, a lot of cool things are possible.  Look for me to auto-spam you all text messages sometime soon.