In this instalment of “AWS via Haskell”, we’ll look at how to perform basic tasks with S3. This follows on from my previous post in which I talked about DynamoDB.
Part 1: Prerequisites
Firstly, you’ll need access to S3. There are several options:
- Create an AWS account and use the real S3 service in the cloud: you can start with the free tier and go from there
- Install localstack or similar: note, however, that you may occasionally encounter compatibility issues with these mock services
aws-via-haskell.cabal: the dependencies
You’ll see that our
s3-app target depends on the following
AWSInfo.hs: helper functions
AWSInfo module provided here extracts some of the helper functions from my previous post and generalizes them to all AWS services.
Main.hs: the code
This program demonstrates how to:
- Create a bucket
- List buckets
- Put objects
- Get objects
- List objects
Part 5: The full working demo project
I’ve gathered this all together into this buildable project. As always, I like to build using Stack.
Part 6: Related posts