I have reactjs
application at frontend and at backend, I use node/express
apis app.
After local development of node/express app, I deploy entire app in AWS lambda function. I user other AWS services eg. HTTP API gateway, S3, Cognito, RDS-mysql, dynamodb
.
Tech stack
Local solution
Reactjs --- Node/express --- AWS services [ Cognito, S3, RDS-MYSQL, dynamodb ]
Cloud Solution
Reactjs ---- AWS services [ Cognito, HTTP API gateway, Lambda, S3, RDS-MYSQL, dynamodb]
How to dockerize entire solution entire solution ??
I have dockerized reactjs app
and node/express app
.
The part which I don’t understand is how to deal with Cognito service, S3, RDS-mysql, dynamodb
data ?
For instance in my cloud solution login(reactjs app)
page talks to HTTP API Gateway + Lambda
and Lambda
talks to AWS congnito user pool
and fetches different tokens.
In local my solution login(Reacjs app)
page talks to node/express api
and it talks to Cognito service
and fetches different tokens.
Question is how to consider cognito service (other aws services)
when it comes to dockerzing my entire cloud solution tech stack ?
Basically I want to provide on-premise solution.
How should I proceed ? I really have no idea.
2
Answers
For services like RDS-MYSQL and dynamodb, you have to pick another database software you’ll be using, that you can install inside docker, and migrate the data there (if needed). You might consider MongoDB or Redis.
For cognito, you’ll have to find a replacement that works locally – a quick google search and a couple of options present themselves:
Use Cognito locally [offline]
https://github.com/jagregory/cognito-local
https://www.npmjs.com/package/cognito-local
https://docs.localstack.cloud/user-guide/aws/cognito/
And for the S3 service, I believe you won’t have any problems simply using on-premise storage instead.
There is no on-premise solution when you use AWS services, it’s more like a hybrid solution.
Of course, you may deploy your react app and your API, but you have to set up those components (front and back) to properly work with AWS services.
To set up your components properly, you’ll need to configure your AWS services for each instance or client you’re working with (or if you have many development stages).
I could suggest that you could set the URLs of your services through Docker environment variables. For sure, you have to set up the proper credentials for your API and Front. Then it can reach and use those AWS services.
The following are tasks you may think about:
That will allow you to deploy your react app and your API with multiple cognito pools, lambdas, SNS, etc…