I have a UI application written in Angular, which has a backend running in NodeJS. I also have two other services which will be invoked from the NodeJS backend. These applications are running in docker containers and are deployed to a Kubernetes cluster in AWS.
The flow is like this:
AngularUI -> NodeJS -> Service1/Service2
AngularUI & NodeJS are in the same docker container, while the other two services are in 2 separate containers.
I have been able to get the services running in Kubernetes on AWS. Service to Service calls (Service 1-> Service2) work fine, as I'm invoking them using k8s labels.
Now Im not able to figure out how to make calls from the Angular front end to the NodeJS backend, since the requests execute on the client side. I cannot give the IP of the ELB of the service, as the IP changes with every deployment.
I tried creating an AWS API Gateway which points to the ELB IP of the Angular UI, but that does not serve up the page.
What is the right way to do this? Any help is much appreciated.
The ELB has a static DNS hostname, like foobar.eu-west-4.elb.amazonaws.com
. When you have a domain at hand, create an A record (alias) that points to this DNS hostname. E.g.
webservice.mydomain.com -> mywebservicelb.eu-west-4.elb.amazonaws.com
You can also use static ip address, which seems to be a fairly new feature:
Each Network Load Balancer provides a single IP address for each Availability Zone in its purview. If you have targets in us-west-2a and other targets in us-west-2c, NLB will create and manage two IP addresses (one per AZ); connections to that IP address will spread traffic across the instances in all the VPC subnets in the AZ. You can also specify an existing Elastic IP for each AZ for even greater control. With full control over your IP addresses, Network Load Balancer can be used in situations where IP addresses need to be hard-coded into DNS records, customer firewall rules, and so forth.