Deploying PERN stack application with AWS - node.js

I developed a PERN (postgres, express, react, node) app that's running on my local machine and I want do deploy it using AWS. What is the "best" way to go about doing this if I want to be able to continuously deploy changes and handle the potential of scaling?

For Database you can use RDS https://aws.amazon.com/rds/
For Hosting you can use EC2 Instance of your own https://aws.amazon.com/ec2/
You should dockerize your app
And Optionally can set up a continuous deployment pipeline using aws-codepipeline and aws-codedeploy . You can also use github actions for this purpose.

Related

Can we implement frontend and backend separately on AWS Elastic beanstalk?

I have frontend and backend both are using nodejs. Frontend is exposed and every request for api goes through the proxy module in the frontend, and both frontend and backend communicate on different modes.
Is there a way to deploy the above module, using code pipeline onto the Elastic Beanstalk platform ?
Why not deploy the front end on Amplify AWS?
AWS Amplify is a set of tools and services that can be used together or on their own, to help front-end web and mobile developers build scalable full stack applications, powered by AWS.
You just need to link your Repo and select your branch and everything will be deployed and generate also a random free domain or you can set your domain from the domain management section

Which is the best approach to deploy MERN stack app on AMAZON EC2?

I am googling a lot to be sure the best approach to deploy MERN stack app on aws ec2 ... in some examples Nginx being used in server (expressjs) part and in some cases its being used for Recatjs part and the express js part is just hosted in node , React even can be hosted in s3 I guesss .. so what is the best approach however?
Without configuring the server yourself in EC2, you can simply use managed Node.js hosting provided by AWS Elastic Beanstalk.
If you want to directly configure EC2 instance and deploy, you can follow this tutorial to do the deployment https://jasonwatmore.com/post/2019/11/18/react-nodejs-on-aws-how-to-deploy-a-mern-stack-app-to-amazon-ec2

Need some guidance on deploying/hosting a web app

I recently developed a web app locally, with a React frontend that interacts via proxy with a Node.js backend that interacts with MongoDB Atlas. Everything works locally, and I am ready to actually deploy the web app for public use.
How does hosting work with a full stack web application? Do I host the entire web app in the same place (e.g. S3 bucket), or should the backend and frontend be deployed separately? I have never done this before, so I appreciate any help I can get.
Yes, you can have two different servers for frontend and backend.
You can use theHeroku platform to deploy your backend app, and Mlab to provision a Mongo database. These platforms has free tiers where you can experiment and learn about deployments and clouds.
Once you are comfortable with these then you can move to Elastic Bean Stalk on AWS to provision servers and also database.
Now mlab is not available as it is already been acquired by mongoDB only, so I would recommend you to create the database on Atlas cluster which also offers a free tier.
Rather than using the Heroku, I would suggest you to use MongoDB stitch which is also the backend as a service. If you will use stitch then you can also seek for support from mongoDB people but in case you will use heroku then you will not receive any support from them.
You can refer to the documentation of stitch for more information https://docs.mongodb.com/stitch/. This has complete guidance how you can deploy your app using stich and can use mongodb database.
However if you need more help, please ping me anytime.

How to host a nodejs app on ECS?

Iam looking to host a nodejs app on ECS. On local dev i use ngrok to expose port 3000 and it seems to work well. Now i would like to host it. Is dockerizing mandatory? What would be the steps to host it on amazon ecs if the app is dockerized?
I would also like to know if hosting on ecs is possible without dockerizing.
I would suggest you if you want to go this way to start an EB Instance.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.container.html
And you can deploy your application using CodeShip or use the traditional way in EB where you upload and deploy the code ( I suggest you use CodeShip ).
Another way to do it, and it might end it up being free is Heroku, it's an amazing and easy cloud service where you can deploy your application and build a continuous integration with GitHub, it takes care of everything to you.
This is the walkthrough for Node.Js apps:
https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
Dockerizing is not mandatory at all, you can do it if you like, the roadmap to deploy the app won't change.

Deploy MEAN application

I just learned the MEAN stack and I locally developed/tested an app. Now, I want to deploy this application to the internet so the world can use it. I don't know how to do this and am lost.
So far, this is what I think is needed. Please correct me if I'm wrong.
1) Purchase a domain (done using Google domains)
2) Find a host for that domain (using Hostgator)
3) Deploy mean app to a cloud service (like Azure, AWS, Heroku, Digital Ocean)
4) ???
5) Fiddle with some settings so the user can access my web app on mydomain.com
What is a recommended cloud service to use? This is my first time doing this so help appreciated!
There are a lot of articles on the web already(why not google first?)!
Here are some:
Deploy MEAN
Deploy Your MEAN Stack Apps to Heroku
Running Mean.js App on Azure App Services with Continuous Integration and Delivery
Bossable - MEAN Stack Deploy on Azure
John Papa - Deploying Angular on Azure
Deploying a MEAN App to Amazon EC2 (Part 1)
Deploying a MEAN App
Stackify - Why Azure Deployment Slots are Awesome and How to Use Them
[express, angular, mongo, mongoose, deploy, digitalocean, ssh, Heroku, node]
I would suggest you to use AWS for these kind of stacks and in AWS you can use beanstalk and you don't need to care about management.
https://aws.amazon.com

Resources