NOTE: CloudShell Colony currently supports Ingress with AWS only.
Advanced scenarios call for a more flexible configuration of your sandbox environment’s application load balancer. This may include cases where your sandbox environment includes has applications and you need to redirect the traffic to certain applications based on a URL path. You can do this by defining port accessibility in the blueprint and application YAMLs, where external ports are defined in the blueprint YAML and internal ports in the application YAML.
To redirect traffic:
- In your production environment blueprint YAML, add an Ingress element to the production environment blueprint.
The following is an example of a production environment blueprint that includes a listener responsible for redirecting incoming traffic from port 80 to two different environment applications (application-api and application-web):
ingress: listeners: - http: 80 rules: # Green environment Ingress rules: - path: /api/* host: green.sometest.com application: application-api port: 3001 color: green shortcut: green.sometest.com/api/index - host: green.sometest.com application: application-web port: 3000 color: green shortcut: green.sometest.com # Blue environment Ingress rules: - path: /api/* application: application-api port: 3001 color: blue shortcut: sometest.com/api/index - default: true application: application-web port: 3000 color: blue shortcut: sometest.com
In the above example, Ingress is defined to listen to port 80 of the application load balancer. For both the green and blue environments, the API and the web application each were assigned with a unique hostname and port.
The redirection of incoming traffic to the green environment's applications is defined as follows:
- Incoming traffic from green.sometest.com will be redirected to port 3000 to the Web application of the green environment.
- Incoming traffic from green.sometest.com/api/* will be redirected to port 3001 to the API application of the green environment.
The redirection of incoming traffic to the blue environment's applications is defined as follows:
- Incoming traffic from sometest.com will be redirected to port 3000 to the Web application of the blue environment.
- Incoming traffic from sometest.com/api/* will be redirected to port 3001 to the API application of the blue environment.
- In every production application YAML, add an Ingress health check. The load balancer runs the health check for each application instance to check whether the instance is ready to accept incoming traffic. The following is an example of a health check defined in the web application YAML:
infrastructure: connectivity: internal: - port_info: port: 3000 ingress-healthcheck: healthy-threshold: 5 interval: 30 path: / status-codes: 200-299 timeout: 5 unhealthy-threshold: 2
For a detailed explanation about each health check setting, see Amazon's Health Check for Your Target Groups help article.
Comments
0 comments
Please sign in to leave a comment.