Slight refactoring to allow customizing DynamoDB server startup
diff --git a/localstack/services/dynamodb/server.py b/localstack/services/dynamodb/server.py
index 2752e309d1a08..59aff5c8dc57a 100644
--- a/localstack/services/dynamodb/server.py
+++ b/localstack/services/dynamodb/server.py
@@ -100,11 +100,13 @@ def create_dynamodb_server(port=None) -> DynamodbServer:
     Creates a dynamodb server from the LocalStack configuration.
     """
     port = port or get_free_tcp_port()
+    ddb_data_dir = f"{config.dirs.data}/dynamodb" if config.dirs.data else None
+    return do_create_dynamodb_server(port, ddb_data_dir)
 
-    server = DynamodbServer(port)
 
-    if config.dirs.data:
-        ddb_data_dir = "%s/dynamodb" % config.dirs.data
+def do_create_dynamodb_server(port: int, ddb_data_dir: Optional[str]) -> DynamodbServer:
+    server = DynamodbServer(port)
+    if ddb_data_dir:
         mkdir(ddb_data_dir)
         absolute_path = os.path.abspath(ddb_data_dir)
         server.db_path = absolute_path

DynamoDBLocal can start in [two different modes](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html). If a `dbPath` is set, DynamoDB writes its database files in that directory.
If not, it runs in `inMemory`mode with a transient state (which is what we currently do if persistence is not enabled).

Before, we were interested in having files on disk only when `DATA_DIR` was set. However, now that Pods are independent from persistence, we have a similar need. Therefore, we would just set a temporary directory to dump the database files.
As a future optimization we can investigate whether is possible to run start DynamoDBLocal `inMemory` and only ask for its content on the fly.

@whummer this is basically what we briefly discussed before. Could there be any implications that I do not see?