Skip to main content
Goal: after users successfully authenticate with the login microservice, redirect them to the product microservice running behind its own load balancer. This preserves service boundaries so each microservice can be developed, built, and deployed independently. Overview
  • Copy the product microservice load balancer DNS name from the AWS console.
  • Update the login microservice code to redirect authenticated users to the product service endpoint.
  • Push the change to trigger your CI/CD pipeline (build → image → deploy).
  • Verify the integration by logging in and confirming the redirect.
Step 1 — Get the product load balancer DNS Copy the product service’s load balancer DNS (ELB/ALB) from the AWS Console and append the appropriate path (for example /welcome or /welcome-page) to use as the redirect target.
The image shows an AWS EC2 console with a focus on a "Load Balancers" section for an application named "crypto-app," displaying navigation and instance management options.
Step 2 — Update the login microservice code (Flask example) In your login microservice repository (for example, in Cloud9), open app.py and update the login POST handler so that on successful authentication it redirects to the product microservice load balancer URL. Below is an improved example that:
  • uses an environment variable for the product URL (so you avoid hard-coding in source),
  • shows the login route and redirect handler,
  • keeps the login flow simple for clarity.
Do not hard-code external service URLs or secrets in production code. Use environment variables, a configuration system, or service discovery (e.g., AWS Cloud Map or Route 53). Never store plaintext passwords — use a secure password hashing mechanism such as bcrypt and validate credentials by comparing hashes.
Step 3 — Commit and push your change (trigger CI/CD) Commit the change and push to the repository branch monitored by your pipeline (for example master or main). This will trigger your CI/CD pipeline (e.g., AWS CodePipeline) to build a new Docker image and deploy the updated login service.
Watch the pipeline build/deploy in the AWS Console to confirm the new image is built and a new task is started.
The image shows an AWS CodePipeline console for a project named "login-page-microservice" with the source stage succeeded and the build stage in progress. It includes navigation options on the left for CodePipeline features.
Step 4 — Test the integration Follow these steps to validate the login → product redirect: Expected result: after a successful login, the browser should redirect to the product microservice endpoint (e.g. http://.../welcome), demonstrating that the two services are connected but still independently deployable. Step 5 — Confirm services are running in ECS Verify both microservices are running in your cluster (for example, an Amazon ECS cluster). You should see the product service (crypto-app) and the login service (login-app-microservice) as separate services with running tasks.
The image shows an AWS Elastic Container Service (ECS) dashboard displaying details of a cluster named "ProductionCluster," with active services including "crypto-app" and "login-app-microservice." The status for both services is marked as active with tasks running.
Links and references
By redirecting authenticated users to the product microservice load balancer, the login service remains decoupled from the product implementation. This enables independent development, testing, and deployment. For production, prefer configuration via environment variables, DNS-based routing (Route 53), or a service discovery mechanism rather than embedding ELB URLs in source code.
This completes the connection between the login and product microservices. Teams can now iterate independently while users are routed between services after authentication.

Watch Video