How to deploy Amplify application with Express API route? - amazon-web-services

On my localhost I have frontend (Vue app on port 5000) and backend (Express app runs on port 3000) Node apps. The frontend is making requests to localhost:3000/api/v1/....
I'm trying to run the frontend and backend on the same DNS record (examle.com) - the backend will run on route example.com/api/v1/....
I managed to run the frontend on AWS amplify on the DNS (examle.com), but how do I add the backend to the same DNS record with /api/v1 route?
Is there a built in way in AWS Amplify? Maybe I need to create ALB, and allow the ALB/API GW to route the traffic?

Related

How to connect REACT frontend hosted on Heroku to AWS (Spring-Boot) backend?

I have a Spring-boot backend deployment on AWS EC2 (using EBS).My REACT frontend is on Heroku
and can't connect to the backend. I have manually added CORs on Spring APP, configured security group, but it still doesn't work. I can connect to bacend from localhost:3000 just fine.
The same problem doesn't happen if I deploy the backend on herku and connect frontend from Heroku/Firebase. This seems to happen only with AWS backend.
How do I connect Heroku frontend with AWS backend ?
Can we solve this by deploying REACt on AWS?
My security group config.
enter image description here

Connecting an AWS Amplify frontend with a EC2 instance?

So, I'm working on a hackathon project right now, and for the demo, I've spun up a NodeJS Express server on an EC2 via Elastic Beanstalk. When testing the server's API with our front-end locally, it worked perfectly fine.
Now we've deployed our front-end to AWS Amplify, setup a domain name in Route53, and hooked everything up. When we go to the domain, our front-end looks great, but when we try using the functionality that would connect to our server's API, we get a net::ERR_SSL_PROTOCOL_ERROR.
Doing some research, it looks like(?) that we have to setup a certificate on the Classic Load Balancer that's in front of the EC2. So I requested a certificate, and created a listener on the Load Balancer as follows:
Load Balancer Protocol
Load Balancer Port
Instance Protocol
Instance Port
HTTPS
443
HTTPS
3000
But now I realize that if setup this way, I still have no idea how to point the React Frontend's API calls to the Load Balancer instead of the EC2, or whether the listener is setup correctly. Would anyone have an idea of what steps we should take here?
For the details of the app, the backend is a pretty straightforward Express App with CORS enabled, and the frontend is a fairly standard React project, nothing special about either of them.
Instance Protocol should be HTTP. So your setup uses HTTPS only between client and CLB:
Client--- (HTTPS) ---> CLB --- (HTTP) ---> EC2
Also for properly setup HTTPS, you need to use your own domain. You can't use default domain provided by EB for your application.

Multiple simple routing in route 53 doesn't work for https

We created an application in nodejs for backend and react for front end uploaded in github and connected it to elastic beanstalk for backend and aws amplify for frontend. Purchased a domain in route 53 to make it https. We created separate record name for our front end and backend in route 53 but the record name for our backend is not yet secured. What might be the problem?

React app on Aws Amplify receives ERR_CONNECTION_REFUSED when trying to access to Elastic Beanstalk Springboot app

I have created a react app that connects to a Springboot API on an Elastic Beanstalk.
I'm successfully connecting to my Beanstalk API from my local machine, but my React app (deployed with Amplify) receives a ERR_CONNECTION_REFUSED.
What could be the reason?
The Url I'm using to connect from the React app is: http://ec2-18-133-11-111.eu-central-1.compute.amazonaws.com (I modified the ip for privacy reasons)
EDIT For some reason, The api call is being redirected to https. I think this is the reason. How do I prevent this?
Here is how the sg inbound is configured:
What else do I need to do?

AWS Loadbalancer routing request

I am using Amazon AWS EC2 to host my web application. My web application is hosted on 2 web servers and having Loadbalancer to manage traffic.
I am using CodeIgniter framework.
My problem is when I try to login to my application, Loadbalancer is routing my request to wrong server and even with correct Login Password I am not able to Login to my application and due to this my session is not started.
Thank you in advance:)
You should be enabling the sticky session feature.
If you are using AWS ELB (Classic Load Balancer), then check out how to configure sticky sessions.