I'm trying to set up my testing environment on AWS.
I don't want to use the public domain, but only the custom domain that is setup on VPN.
Basic case:
Backend node.js API service and static frontend app in react.
I created a service with a task for the backend and deployed a static page on S3 bucked.
Is any option to set up it together using ALB and targets group?
Or maybe another solution is how to handle a case like that.
The main condition is that I don't want to use the public domain and Route 53.
If is any other option then S3 is not a crucial solution.
I will be grateful for any suggestion or example for a similar stack.
Related
I wonder how to manage the routes of my architecture. To summarize, my architecture is composed of :
S3 static website exposed under CloudFront CDN
Elastic Beanstalk API (based on Docker container with Django Rest and Python)
I usually insert a new record to my hosted zone in my route 53 but my goal here is to have the equivalent of Nginx locations with proxy_pass. For example, I would have :
<my_dns_record>/api that target my Beanstalk API
<my_dns_record> that target my static website on my CloudFront
I thought about an API Gateway but I wonder if it's really the best way to structure the routing.
Does anyone have an idea how to achieve the desired behavior ?
Thank you in advance for your help.
If I understand correctly, you want to have multiple apps (your S3 static site, and your Elastic Beanstalk app) served under a single domain. Route53 doesn't have any special features to handle this, since it is just a DNS service, and what you are talking about is an HTTP path routing thing.
You also shouldn't use API Gateway for this, as you would be placing your entire website behind an API Gateway when it is really only appropriate to have your API behind an API Gateway.
I would just add the Elastic Beanstalk API under CloudFront as well, as a second origin, and configure CloudFront to send requests at the /api path to the Elastic Beanstalk origin.
Alternatively, forget about having everything under the same domain, and use a subdomain api.yourdomain.com for your API. Using subdomains for your different services instead of path routing is a lot more flexible.
I have a React app that is currently hosted in a regular AWS account. I used S3 static URL and cloud front to host the site and deliver it over SSL. I now need to deploy the same app from a gov-cloud instance. Gov-Cloud does NOT have cloudfront available and unfortunately you cant apply SSL to an s3 static URL.
I'm searching for another relatively easy way to deploy this (Amplify is also not available in gov cloud). Elastic Beanstalk is available but it seems like overkill for just hosting a React app (not to mention, I have to set this up in Terraform so configuring EB seems like a way way overkill as there are many options available in EB).
Has anybody done this kind of deployment before or have any suggestions for how to do this? If need be, I'll do it with elastic beanstalk, I just need to research all the options first (unless someone has a golden image type deal for react apps).
I'm not very familiar with deployment and networking as I'm primarily a frontend developer. I want to create a project with Laravel and React (separated, not integrated with blade), and deploy them to AWS. I want to use Laravel only as an API server, and I'm planning to deploy it on EC2. If I host my React app on S3, how will it be possible for me to share the same domain with the API sever running on the EC2 instance?
I know that I can have separate subdomains,like www.example.com for my React app and api.example.com for my API server. However, if I want to have www.example.com for my React app and www.example.com/api for my API server, what options do I have? And what resources can you recommend for me to get more up to speed on this topic? Thanks!
As you want to use S3 and EC2 you would need to use a service that can distribute to both endpoints based on a condition.
The best service for this would be CloudFront, which supports distribution to S3 and EC2 (as a custom origin).
To do this you would create your distribution with an origin for the S3 bucket, and an origin for the API. As your API is hosted on the /api/* path you would add this as the path pattern when adding the secondary origin via a behaviour.
CloudFront will then route any requests to /api/* paths to your EC2 origin.
I have found an article named How to route to multiple origins with CloudFront which I hope will explain the steps to accomplish this in greater detail.
I'm new to the GCP Services, and I'm trying to make an API Gateway to proxy two services, one is run on an App Engine and the other is actually a PaaS.
Can I configure Cloud Endpoints to redirect to that PaaS, and how? and if now what service in GCP suits this case?
Edit:
An example of what I'm trying to do is if my domain is test.com then i'd like app.test.com to be redirected to my App Engine and ip.test.com would be directed for example to https://httpbin.org/ip.
I wrote an article on this for securing the endpoint. Set the value that you want in the x-google-backend.
I also provide some tips about the URL rewriting if you want.
EDIT 1
If you want to perform this routing
app.test.com -> App Engine
ip.test.com -> External service
You need to use a HTTPS Load Balancer and not API Gateway.
Then,
create a serverless NEG and configure it with App Engine
create an Internet NEG and configure it to reach your internet accessible PaaS service
Create a URL MAP with the correct routing
That's all (wait 3 - 5 minutes, the delay to dispatch your configuration around the globe.)
Yes, you can run an Extensible Service Proxy in front of your non-GCP backend service so that Cloud Endpoints can proxy requests to it.
Docs: https://cloud.google.com/endpoints/docs/openapi/running-esp-localdev
I have an Django+Postgres app that has a multi-tenant structure and I don't have prior experience deploying this type of app to AWS. I have followed the general Elastic Beanstalk tutorial to deploy a simple app. (https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/) However, I am looking for a solution that allows me to more flexibly create different "sites". Currently, I have learned to create different sites via this tutorial (http://mycodesmells.com/post/django-tutorial-multi-tenant-setup).
So i have below questions :
how to deploy this app (I am leaning toward not using Elastic Beanstalk but just deploying it to EC2)
how I could create different sites after deploying this app.
The following should help:
Set up your .ebextensions so your Django project deploys with eb deploy.
Set up django-storages with AWS S3 for mediafiles if you need to.
Purchase a domain and set it up with AWS Route 53 (you can buy via Route 53, too).
Point your root domain alias to your Elastic Beanstalk app.
Point a wildcard domain to your app, too.
Set up AWS SES to save your domain emails to an AWS S3 bucket. You can use other providers as well, SES is just about the easiest.
Provision AWS ACM certificates for HTTPS support.
You now have your site working under .example.com and can use tenant.example.com to refer to a single client's setup - it refers to the same deployment but has a different Host header which lets Django tenant schemas to distinguish clients. You have wildcard forwards and do not need any setup other than in Django for adding new tenants.