4.2. Changing Event Store (original) (raw)

AWS DynamoDB

To use AWS DynamoDB event store we need to add localstack container. This way we can use a fully functional local AWS cloud stack.

helm/requirements.yaml

dependencies: +# AWS localstack (for local development)

helm/values.yaml

ingress: paths:

user: env:

configMap: data:

Finally we can switch memory event store to DynamoDB one as follow:

cmd/user/main.go

package main

import ( + "github.com/aws/aws-sdk-go/aws" - "github.com/vardius/go-api-boilerplate/pkg/eventstore/memory" + "github.com/vardius/go-api-boilerplate/pkg/eventstore/dynamodb" )

type config struct { + AwsRegion string env:"AWS_REGION" envDefault:"us-east-1" + AwsEndpoint string env:"AWS_ENDPOINT" envDefault:"http://localhost:4569" }

func main() { ctx := context.Background()

cfg := config{}
env.Parse(&cfg)