How can we configure the rest api url based on the environment (local/dev/qa/prod)?
Hard to answer without more detail. This is more about configuring any variable based on the environment; your API endpoint is just example.
The rest API url might change every-time we deploy the application to AWS (Link gets generated in AWS API Gateway), Have we have to manually update the url list in the react app? Do we have a way to sync these urls among consumers?
- You should implement the build/deploy process such that the API is not destroyed and recreated. Cloudwatch metrics and logs are tied to the API by its ID so your monitoring would also break. Of course, having a stable endpoint is important too.
- I recommend looking at custom domains as well. You could even integrate your environment into the custom domain URL in a structured way i.e.
prod.myendpoint.company.com or myendpoint.company.com/prod.