Quarkus Application Using AWS DynamoDB and Localstack

Gabriel Martins
2 min readApr 25, 2022

--

This tutorial is an example of a Quarkus application using AWS DynamoDB and Localstack.

We can develop and test applications locally using Localstack, so it’s possible to save costs and reduce the development time easily because the local machine will provide the same functionality and APIs as the real AWS cloud environment.

https://localstack.cloud/images/diagram.png

Setup the Environment

In order to setup the environment correctly we need to clone the localstack project from GitHub:

git clone https://github.com/localstack/localstack.git

Now we need to run the Localstack image

docker-compose up -d

And we can check the status services in the browser

http://localhost:4566/health

Before starting the application development we need to create the tables

aws --endpoint http://localhost:4566 dynamodb \
create-table --table-name Movies \
--attribute-definition AttributeName=Id,AttributeType=S \
--key-schema AttributeName=Id,KeyType=HASH \
--billing-mode PAY_PER_REQUEST

Setup the Application

First of all it’s necessary to define the following dependencies in the application

After that, lets configure the DynamoDB beans and the application.yml file

Now we have to define the entities:

Finally we have to define our repository and its implementation

You can see the full code application on GitHub

--

--

Gabriel Martins
Gabriel Martins

Written by Gabriel Martins

Just a brazilian guy who loves technology and wants to share the experiences he has learned