All Projects → wolfeidau → dynalock

wolfeidau / dynalock

Licence: Apache-2.0 license
This is a small lock library written Go, which uses AWS DynamoDB as the data store.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to dynalock

jarvis-workshop
Amazon re:Invent workshop - "Alexa, Ask Jarvis to Create a Serverless App for Me" -
Stars: ✭ 14 (-6.67%)
Mutual labels:  dynamodb
sam-python-crud-sample
This project is an example about lambda, SAM, dynamodb. This repository contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes the following files and folders.
Stars: ✭ 71 (+373.33%)
Mutual labels:  dynamodb
photo-sharing-website
Static pre-rendered photo-sharing website
Stars: ✭ 33 (+120%)
Mutual labels:  dynamodb
serverless-websockets-chat
Realtime chat app based on AWS Lambda, API Gateway, DynamoDB, Websockets, React in TS
Stars: ✭ 19 (+26.67%)
Mutual labels:  dynamodb
parser
arc.app, .arc, arc.json, arc.yaml, and arc.toml support
Stars: ✭ 20 (+33.33%)
Mutual labels:  dynamodb
lockbot
🔒 Coordinate use of your team's shared resources, in Slack 🤝
Stars: ✭ 47 (+213.33%)
Mutual labels:  dynamodb
akka-persistence-dynamodb
DynamoDBJournal for Akka Persistence
Stars: ✭ 85 (+466.67%)
Mutual labels:  dynamodb
aiohttp-client-cache
An async persistent cache for aiohttp requests
Stars: ✭ 63 (+320%)
Mutual labels:  dynamodb
dynamolock
DynamoDB Lock Client for Go
Stars: ✭ 100 (+566.67%)
Mutual labels:  dynamodb
aws-certified-developer-associate-udemy-notes
AWS Certified Developer Associate Udemy Notes
Stars: ✭ 20 (+33.33%)
Mutual labels:  dynamodb
terraform-aws-dynamodb-autoscaler
Terraform module to provision DynamoDB autoscaler
Stars: ✭ 21 (+40%)
Mutual labels:  dynamodb
dynocsv
Exports DynamoDB table into CSV
Stars: ✭ 34 (+126.67%)
Mutual labels:  dynamodb
data
[deprecated] Generate a DynamoDB data access layer from an .arc file. Automatically disambiguates testing (in memory) from deployment staging and production tables
Stars: ✭ 20 (+33.33%)
Mutual labels:  dynamodb
amazon-ivs-ugc-web-demo
This repository shows how you can build a compelling user-generated content (UGC) live streaming webapp with Amazon IVS.
Stars: ✭ 14 (-6.67%)
Mutual labels:  dynamodb
laravel-dynamodb-session-driver
DynamoDB Session Driver for Laravel 5
Stars: ✭ 15 (+0%)
Mutual labels:  dynamodb
aiodynamo
Asynchronous, fast, pythonic DynamoDB Client
Stars: ✭ 51 (+240%)
Mutual labels:  dynamodb
dynamodb-onetable
DynamoDB access and management for one table designs with NodeJS
Stars: ✭ 508 (+3286.67%)
Mutual labels:  dynamodb
minidyn
A go library for testing Amazon DynamoDB.
Stars: ✭ 22 (+46.67%)
Mutual labels:  dynamodb
dynamo-node
DynamoDB mapper
Stars: ✭ 12 (-20%)
Mutual labels:  dynamodb
aws-serverless-prototype
Serverless Frameworkを使ったAWS Lambdaプロジェクトの試作品
Stars: ✭ 16 (+6.67%)
Mutual labels:  dynamodb

dynalock

This is a small K/V library written Go, which uses AWS DynamoDB as the data store.

It supports create, read, update and delete (CRUD) for key/value pairs, and provides locks based on the sync.Lock API.

GitHub Actions status Go Report Card Documentation

What is the problem?

The main problems I am trying to solve in with this package are:

  1. Enable users of the API to store and coordinate work across resources, using multiple lambdas, and containers running in a range of services.
  2. Do this locking and coordination without needing to spin up a cluster using etcd, or consul
  3. Provide a solid and simple locking / storage API which can be used no matter how small your project is.
  4. Try and make this API simple, while also reduce the operations for this service using AWS services.

What sorts of things can this help with?

Some examples of uses for a library like this are:

  1. Locking a logical resource in your system while you make some updates, especially if this involves a few AWS resources, such as DynamoDB, S3 and SSM in one change.
  2. When using scheduled lambda functions this library will enable you to lock resources before performing actions with it, this could be a payment api or a ECS cluster, either way it is important to ensure only ONE service is performing that task at one time.
  3. When you start using step functions, how can you ensure only one workflow is active and performing some task, like provisioning, without having to worry about parallel executions.

So the key here is storing state, and coordinating changes across workers, or resources.

Why DynamoDB?

DynamoDB is used for locking in a range of Amazon provided APIs and libraries, so I am not the first to do this. see references. This service also satisfy the requirement to be easy to start with as it is just a service.

Cost?

I am currently working on some testing around this, but with a bit of tuning you can keep the read/write load very low. But this is specifically designed as a starting point, while ensuring there is a clear abstraction between the underlying services and your code.

To manage this I would recommend you set alarms for read / write metrics, start with on demand but you will probably want to switch to specific read/write limits for production.

I will be posting some graphs, and analysis of my work as I go to help flesh this out better.

Usage

The main interfaces are as follows, for something more complete see the competing consumers example.

go get -u -v github.com/wolfeidau/dynalock

v1.x Go Documentation

Looking for AWS SDK v2?

I have added a new v2 module which supports https://github.com/aws/aws-sdk-go-v2.

go get -u -v github.com/wolfeidau/dynalock/v2

v2.x Go Documentation

References

Prior work in this space:

This borrows a lot of ideas, tests and a subset of the API from https://github.com/abronan/valkeyrie.

Updates to the original API are based on a great blog post by @davecheney https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis

License

This code is released under the Apache 2.0 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].