I have two EC2
instances .
One instance runs a React APP
.
Another instance runs a Fast API
.
Currently deployment process is (completely manual):
- Turn on the
Fast API
Ec2 Instance, - Get the public IP of that instance from AWS console
- Add the IP to
React App
config code (manually update URL in the code) - Run the
React APP
ec2 instance.
I am trying to automate this process using AWS Lambda
.
Idea is to :
- Run a manual lambda trigger which turns on the
Fast API
ec2 instance - Lambda gets the IP of the Fast API ec2
- Automatically updates the IP on React APP config URL code
- Turns on the React App ec2 instance.
Question is :
Is there a better approach? I mean to put Fast API and react in two separate docker containers in the same ec2 instance?
Is there any way to attach the back end IP to the react app instead of updating the url in the code ?
1