Last active
April 12, 2022 12:41
-
-
Save cp-sumi-k/63aecf6354ebb9a864ea30135e2c8c04 to your computer and use it in GitHub Desktop.
https://blog.canopas.com/complete-guide-to-deploying-ssr-vite-apps-on-aws-with-automation-27676113d6ac - Load balancer listeners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
# http (port:80) listener redirects to https | |
HTTPListener: | |
Type: "AWS::ElasticLoadBalancingV2::Listener" | |
Properties: | |
DefaultActions: | |
- | |
Order: 1 | |
RedirectConfig: | |
Protocol: "HTTPS" | |
Port: "443" | |
StatusCode: "HTTP_301" #redirect from http to https | |
Type: "redirect" | |
LoadBalancerArn: !Ref ApplicationLoadBalancer #load balancer reference | |
Port: 80 | |
Protocol: HTTP | |
# https (port:443) listener with ssl certificate | |
HTTPSListener: | |
Type: "AWS::ElasticLoadBalancingV2::Listener" | |
Properties: | |
LoadBalancerArn: !Ref ApplicationLoadBalancer #load balancer reference | |
Port: 443 | |
Protocol: "HTTPS" | |
SslPolicy: "ELBSecurityPolicy-TLS-1-2-Ext-2018-06" | |
Certificates: | |
- CertificateArn: < CERTIFICATE-ARN > #created using AWS cerificate manager | |
DefaultActions: | |
- | |
Order: 1 | |
TargetGroupArn: !Ref TargetGroup #target group reference | |
Type: "forward" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment