Clojure in AWS Serverless: New Direction

This is the last part of a series on Clojure in AWS.

Since last we met, AWS Lambda has matured as a product. It’s tough keeping up with new technologies these days! Luckily at Clojure/West this year, John Chapin has given a great talk about Lambdas. You should give it a watch!

New Direction

It’s this band I’m lis… Oh wait! Wrong topic!

AWS Lambdas are great for many things, especially for AWS services themselves. However it still is as server. A massive spot instance to be sure, but many of the same pitfalls persist. I’ve found I still needed many of the same components of a typical microsrvice architecture. Was I really serverless, or was I building AWS Nodejs-as-a-service?

The dawn of true serverless

There comes a time in every programmer’s life when their world is flipped by a technology. Beyond the hype and bubble, buried in the endless Pop Econ thought pieces, is a technology I would rank with HTTP and BitTorrent as world-changing. But you must ignore the cryptocurrency bit. I know it’s hard. It’s a Black Hole for Silicon Valley minds, devouring all attention.

My interest spans from a problem I found in the BitTorrent ecosystem, and the greater Internet, is storage is hard. The moment you need secure persistent storage the decentralization works against you. PGP suffered this same problem when it wanted to distribute users public keys. They resorted to out-of-band communication.

Enter Ethereum

If BitTorrent inverted the economics of data distribution then Ethereum inverts the economics of data persistence.

  • Programmable Transaction Database — In a nutshell, I can precisely describe how the database transacts. Imagine Clojure’s programmable transactions applied to a world-wide distributed database? This database is shared between thousands of other nodes that verify the integrity of the transaction.
  • Secure — Through cryptographic verification and the computationally expensive PoW, we have reasonable assurance that a third party can’t maliciously change an entry against our will.
  • No More Passwords — Your wallet is your ID. It’s shared across the network. No more writing authentication code! You can secure your authorization through your blockchain transaction code.
  • Full nodes are de-facto offline — If you have the blockchain data and the local HTML files, you have a completely offline application! Granted you still need to sync with the network, but this makes it far more antifragile against network hiccups.
  • Users shoulder some of the cost — This is a big one. Some ideas can’t get enough traffic to pay for the servers. Another problem is users can’t reasonably pay for interacting with the network or service at any granular level. Advertising filled in this micropayment gap for a while before economic incentives made them more intrusive. This opens up whole avenues that are unprofitable or unfeasible with today’s architecture.
  • Ability to run a private network — This is also big! You can run a private Ethereum network in your internal enterprise network or Cloud deployment. Combine with a lightweight Ethereum node for discovery in your ecosystem and you have a decentralized Event Source storage engine that can scale with your architecture!

(= Clojure Ethereum ❤)

I’m sure you’re itching to check this stuff out! I am too! Feast your eyes on this tutorial using Clojurescript and Re-Frame that talks with the Ethereum blockchain.

Even if you don’t use the full capabilities of Ethereum, there are still intriguing use cases. Identity management and authentication come readily to mind. Plugins like Metamask allow your browser to talk with public Ethereum nodes so you don’t need to download the full blockchain locally to interact with the network.

I’m incredibly excited about Ethereum’s technology. I hope I pushed aside the hype and highlighted the fun technology. The ecosystem is very new and awkward, like me in The Dot-Com Bubble era. We don’t know yet what this is capable of. I’m excited to find out!