SyntaxHighlighter

SyntaxHighlighter

Wednesday, August 30, 2017

Serverless Tip: Use the "artifact" Directive to Deploy Your Pre-Built Lambda Zip File

tl;dr: you can deploy pre-built zip files (e.g. for your Python Lambda) using the "artifact" directive in the serverless framework.

AWS Lambda is Great!

I've been doing a lot of work recently with AWS Lambda. And I'm a fan. The combination of API Gateway + Lambda + Python, together with other AWS services including DynamoDB and S3, not to mention the awesome array of Python open source libraries, means I'm churning out all sorts of microservices with glee.

The serverless paradigm is quite different than the traditional (serverfull?) paradigm. As well as adjusting the architectural style to take advantage of what Lambda offers, deploying the code and all of its dependencies is quite different. After looking at some alternatives, we concluded that the Serverless Framework best fit our requirements.

The Serverless Framework is Great!

Rather than crafting complex CloudFormation configurations to manage my microservices in AWS, I use the Serverless Framework. (The framework also works with Apache OpenWhisk, Microsoft Azure and Google Cloud). Essentially Serverless is a simpler CloudFormation, specific to Lambda-centric deployments. (To be clear, it doesn't just help with deployments of AWS Lambda - Serverless covers a wide and growing range of AWS services).

Mainly by studying (*cough* copy-n-pasting *cough*) the extensive range of examples, and sometimes resorting to actually reading the manual, I've been able to get even quite complex setups to work, with fairly simple YAML configuration files. So, I recommend Serverless. (Although AWS themselves are developing an eerily similar alternative, in SAM, which you may also want to check out).

AWS Lambda has Limits

Sometimes you need to do stuff outside the Serverless Framework, but you still want to use all the other cool stuff it does for you.

For example, AWS Lambda has certain limits. This includes a 50Mbyte deployment limit per Lambda. Now, Serverless does let you control what goes into the Lambda package via the "include" and "exclude" directives, within the "package" directive. But, sometimes, you're sailing very close to the 50Mb limit and the only way to stay underneath is to directly create your zip package yourself. Or, in my case, you have a zip file which has precisely what you need, but you also need to manipulate it to add in a pickled bit of code. (Which you do via the Python zipfile library).


It took me a while to figure out, but you can use the "artifact" directive as the way to deploy a zip you've packaged already.

So, there you have it: Lambda is great, but you should use Serverless (or something like it) to simplify your deployments.  And you can deploy pre-built zip files using the "artifact" directive.

Tuesday, August 29, 2017

Emoji, Fake News and 99% Invisible

This morning, I was listening to 99% Invisible, the podcast all about architecture and design.
thinking face
This episode "Person in Lotus Position" was about the process of adding a new emoji to the official set. At one point, they spoke to Jennifer 8. Lee who is on the Unicode Emoji Subcommittee. I know Jenny through Misinfocon. This is a new effort to fight the spread of disinformation on the web via a Knight-funded Credibility Schema Working Group. The goal is to create ways which signal whether a given piece of information on the web is credible.
newspaper
Most of the podcast episode describes the workings of the Unicode committee, which is official standards body for deciding which characters computers and phones will recognize and exchange. It gave a pretty good introduction to the importance and difficulty of this kind of standards work. (As well as being involved in the Credibility Schema Working Group, I'm also the Chairman of the IPTC, the news technology standards body. So, I like to think I have some insight into how these things work).
technologist
If you, like me, are interested in emoji and/or the workings of technical standards groups, then I recommend the episode. (Also, if you're interested in stopping the spread of fake news or in promoting technical standards within the global news industry, feel free to get in touch).