0
votes

I have installed CakePHP 3 using directions from this tutorial:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-cakephp-tutorial.html

It is working perfectly and actually installation was quite easy. There is PHP, CakePHP, MySQL working and also I noticed that the newest AWS SDK as whole is installed in vendor directory. So I am fully set to use also DynamoDB as my data source. You might ask why I should use DynamoDb since I am already using MySQL/MarianDB, this is because we have an application that is already in production and it is using DynamoDB. But we should be able to write admin application using CakePHP in top of DynamoDB. This is not technical decision but coming from business side.

I found good tutorial written by StarTutorial how to use DynamoDB as session handler in CakePHP 3:

https://www.startutorial.com/articles/view/using-amazon-dynamodb-as-session-handler-in-cakephp-3

Well, there is not long way to using DynamoDB for putting data, getting data and doing scans, isn't there? Do you have any simple example how to do it, how to write data to DynamoDB or do scan?

I have also read the article:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.PHP.html

and this is working fine, no problem. But I would like to all the advantages of the CakePHP 3, templating, security and so on, thousands of hours time saved with well written code and very fast to start coding for example admin console :)

Thank you,

3

3 Answers

0
votes

You could create a Lambda function (in case you want to go serverless) or any other microservice to abstract communication with your DynamoDB. This will definitely simplify your PHP code. You may call Lambda functions directly (via API Gateway), or post messages to SQS for better decoupling. I would recommend the use of SQS -- you'll need some kind of microservice anyway to consume messages and deal with your DynamoDB in a CQRS fashion. Hope it helps!

0
votes

Thank you for your answer, I was looking for a example how to use the AWS SDK for DynamoDB without creating more complexity to this environment as it is. This way I would have to create yet another layer without using the SDK that already exists. Can you please give wokring example how AWS SDK is used from CakePHP 3 so that it can use DynamoDB as a data source for its applications without losing it´s own resources an capabilities (MVC, security etc).

Thank you,

0
votes

After a hard debug and found bugs I was able to get it working with only using AWS SDK in CakePHP 3.