AWS via Haskell Part 1 (DynamoDB)


Since I am now an Amazonian, I thought it would be a good time to start learning how to use our technologies. So, here it is: the first instalment in my new, occasional series, which I am tentatively calling “AWS via Haskell”. In these posts we’ll do AWS stuff using our programming language of choice, i.e. Haskell. I will build these examples on top of the awesome and comprehensive amazonka family of packages by Brendan Hay.

Today, I’ll talk about how to do some basic tasks with DynamoDB.

Part 1: Prerequisites

You’ll need access to a DynamoDB instance. The two most common ways of doing this are as follows:

Part 2: dynamodb-demo.cabal: the dependencies

This examples use the following standard Haskell packages which do not require additional explanation:

In addition, we depend on the following amazonka packages:

Part 3: Main.hs: the code

This simple program demonstrates the core tasks you’ll most likely find yourself doing with DynamoDB:

The things of most note are as follows:

Part 4: The full working demo project

I’ve gathered this all together into this buildable project. As always, I like to build using Stack.

Tags: Haskell, AWS, DynamoDB

All content © 2018 Richard Cook. All rights reserved.