> For the complete documentation index, see [llms.txt](https://den.gitbook.io/developerplaybook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://den.gitbook.io/developerplaybook/persistance-dbaas.md).

# Persistance - DBaaS

## Perstistance

Every microservice should use it's own persitance layer. Optimally this will be a SasS solution. The current list of database can be discovered [hear](https://db-engines.com/de/ranking) and the [zalando technology radar](/developerplaybook/persistance-dbaas.md).

#### Architectural Decisions

### When to use NoSQL and when RDBS?

### NoSQL Best Practices

{% embed url="<https://www.youtube.com/watch?v=-o_VGpJP-Q0>" %}

* critical points:
  * embedding vs referencing data
  * reads vs writes
  * normalized vs denormalized vs mixed&#x20;

{% embed url="<https://de.slideshare.net/AmazonWebServices/advanced-design-patterns-for-amazon-dynamodb-dat403-reinvent-2017>" %}

{% embed url="<https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html>" %}

{% embed url="<https://brewing.codes/2017/11/13/dynamo-data-modeling/>" %}

Why DynamoDB?

pynamodb (ORM) - my experience (ask in stack overflow with a link to my describe esperience and the code) why cann't I serialize it back?

boto3 - prefered way by amazon.

<https://www.youtube.com/watch?v=ONLKIUFXLcg&t=2s>

<https://www.uplift.agency/blog/posts/2016/03/clearcare-dynamodb>

1. Go to the [AWS Console](https://console.aws.amazon.com/console/home) and Search for "DynamoDB"

   ![](/files/-LBum4sUOCrdEIFWT7Ss)
2. Create a table e.g. "apis"\
   ![](/files/-LBum4ta0yVSD-xC7BSG)

   ![](/files/-LBum4trMH5ljepTvPRn)

Important: Partition Key Fieldname can not be changed and it must always be included when you insert data to the database. Like:

![](/files/-LBum4uXMZUZ0M8SMEhq)

Further you validate in your that a valid value was send to your service.

1. Create DynamoDB *table name* `notes` and *Primary key* with Partition key `userId` and sort key `noteId` and the default created new *IAM Role* `DynamoDBAutoscaleRole`.
