AWS vs Firebase [Content Delivery Network] - node.js

Let's say I have a single page application using React/Node, and I want to deploy that application using a content delivery network to improve load performance.
To do that in Amazon Web Services (AWS) I would need to incorporate different services to work together.
I would need to host my bundled static web page files on amazon's S3 bucket. Then I would need to host my Node API on Elastic Beanstalk. Lastly, I would then need to setup a CloudFront distribution and set my origin to my S3 bucket.
It would look something like this:
Now, if I wanted to do the same thing in Firebase, according to this video tutorial, I can simply setup Firebase Hosting which is backed by their own CDN which gives similar improved load times. Firebase hosting can encompass the entire React/Node application without the need for separation or various services like I did in AWS.
My questions are:
How does Firebase hosting encompass dynamic Node Apps with out the need to separate the front and backend or use various other services?
The point of a CDN is to cache files, so it wouldn't be possible to use a CDN on a Node API right or wrong? If right then how is Firebase using Node app in their CDN?
It seems much simpler to setup on Firebase to serve an entire dynamic app on their CDN compared to AWS, would their be any drawbacks to this or is it just a better service?

Firebase Hosting is only for your static frontend code. But there is a way to connect Firebase Hosting and Cloud Functions to serve dynamic content that is pretty easy to setup.
https://firebase.google.com/docs/hosting/functions
You can think of Firebase Hosting a zero-ish config equivalent to the AWS S3/CloudFront section of the diagram.

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

Map Google Cloud Functions with Custom DNS

I have Cloud Functions.. which i want to map with .custom DNS.
I have my DNS setup, but after doing that it is not resolving to my Cloudfunctions.
It is Reaching to google server though. not sure if i need to do any configuration within my google project to make it work
Thanks in advance!
If you want to attach a custom domain to Cloud Functions, the only supported way to do that is through Firebase Hosting. You can configure Firebase Hosting to proxy requests to Cloud Functions, and you can also connect a custom domain to Firebase Hosting. Between those two configurations, you can effectively use a custom domain to serve Cloud Functions endpoints.

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.

Execution flow of React + Node.js application deployed on AWS Cloudfront?

I am developing a web application in React with a Node.js back-end. I would like to host the images and static files built for the React application on Cloudfront. However, the React application relies on the Node.js server to obtain some changing data to populate the views.
I need to have a thorough understanding of the flow of the application in order to come up with a reasonable design. Here is what I think happens:
User enters URL in the browser
Client is directed to the closest Cloudfront edge location
Cloudfront serves the HTML and images to the browser
The React application bootstraps in the browser
An API call is made to the Node.js server, which returns the required data
The browser renders the React application.
Am I understanding this correctly? Is there a better way to architect my web application?
I am not able to find the information I require online and would appreciate any help!
Your architecture is correct.
Just to be clear, CloudFront is not hosting your files. CloudFront is a cache and will fetch your files from an Origin, typically an Amazon S3 bucket.
Using React && AWS Amplify, you can create a serverless architecture for this type of setup with minimal work. You can get started by following the instructions at https://aws-amplify.github.io/docs/
In a nutshel :
Install with:
npm install -g #aws-amplify/cli
$ amplify configure
Then in your project :
amplify init
amplify add api #this will create your API as AWS Lambda functions exposed through Amazon API Gateway)
amplify add hosting #this will create the Amazon S3 bucket for hosting and the cloudfront distribution)
amplify push #to create all this on your AWS account for you
If you search for 'aws amplify react' you will easily find a dozen blog posting showing you how to get started. There are so many I can not recommend one in particular.

Is Azure or Google Cloud natively support to serve content using custom domain over https

I'm trying to serve my cloud storage content using custom domain over https. Currently, I'm using Amazon S3 with CloudFront to deliver the content using custom domain over https. But S3 with CloudFront is costly, So I'm now searching for an alternative.
Is Azure or Google Cloud natively support to serve content using custom domain over https. Without using CDN?
At the moment, google cloud storage only support HTTP. As per documentation To serve your content through a custom domain over SSL, set up a load balancer, use a third-party Content Delivery Network with Cloud Storage, or serve your static website content from Firebase Hosting instead of Cloud Storage.
I was able to find this blog which might help you on the setup.
With that being said, if you are looking for functionality like this you may also try with App Engine, as by default, HTTPS connections on your custom domain will automatically be enabled using managed SSL certificates. You can visit this link for more details. Also, there is a there is a feature request submitted to support auto managed SSL with GCLB.
Is Azure or Google Cloud natively support to serve content using
custom domain over https. Without using CDN?
Azure allows you to map a custom domain to your blob storage endpoint. Using this, you can serve the content stored in blob storage using a custom domain. You can read more about it here: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-custom-domain-name
However please note that this will not work over https. For https, you will need to use Azure CDN.
The OP's needs will be met by using Firebase as mentioned in passing by #KarthickN.
Firebase is a Google product which deploys your own domain name site automatically through SSL (https). You can first push your site onto one of the remote git repositories and use CI/CD for Firebase to deploy. You don't need to worry about CDN as firebase will use Google's global edge servers. Small usage is free then move onto paid plans as your needs grow plans
I answered a similar question here.

Resources