AWS Elastic Load Balancing V2 Deployment with CloudFormation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 89: Line 89:


===Application Load Balancer Listener===
===Application Load Balancer Listener===
<font color=darkgray>TODO</font>
 
  Resources:
  Resources:
  LoadBalancerListener:
  LoadBalancerListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Type: AWS::ElasticLoadBalancingV2::Listener
    DependsOn:
    Properties:
      - TargetGroup
      LoadBalancerArn: !Ref ApplicationkLoadBalancerArn
    Properties:
      Port: !Ref LoadBalancerPort
      DefaultActions:
      Protocol: HTTP
        - TargetGroupArn: !Ref 'TargetGroup'
      DefaultActions:
          Type: 'forward'
        - TargetGroupArn: !Ref TargetGroup
      LoadBalancerArn:
          Type: 'forward'
        Fn::ImportValue: !Join [':', [!Ref 'DeploymentStackName', 'ServiceALB']]
      Port: 10002
      Protocol: HTTP

Revision as of 02:42, 3 April 2019

External

Internal

Resource Types

AWS::ElasticLoadBalancingV2::LoadBalancer

Resources:
  ALoadBalancer:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      Name: blue
      Scheme: 'internet-facing'|'internal'
      Type: 'application'|'network'
      IpAddressType: 'ipv4'
      LoadBalancerAttributes:
        - Key: 'access_logs.s3.enabled'
          Value: true|false
        - Key: 'access_logs.s3.bucket'
          Value: ...
        - Key: 'access_logs.s3.prefix'
          Value: ...
      Subnets:
        - blue-subnet-id
        - red-subnet-id
      SubnetMappings:
        - ...
      SecurityGroups:
        - some-security-group-for-application-load-balancer

AWS::ElasticLoadBalancingV2::TargetGroup

Network Load Balancer TargetGroup

Resources:
  TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name: !Ref ProjectID
      VpcId: !Ref VPCId
      Protocol: TCP
      Port: !Ref Port
      TargetType: ip
      HealthCheckProtocol: TCP
      HealthCheckIntervalSeconds: 10
      HealthCheckTimeoutSeconds: 10
      HealthyThresholdCount: 3
      UnhealthyThresholdCount: 3

Application Load Balancer TargetGroup

Resources:
 TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name: !Ref ProjectID
      VpcId: !Ref VPCId
      Protocol: HTTP
      Port: !Ref Port
      TargetType: ip
      HealthCheckProtocol: HTTP
      HealthCheckIntervalSeconds: 60
      HealthCheckTimeoutSeconds: 5
      HealthyThresholdCount: 2
      UnhealthyThresholdCount: 10
      HealthCheckPath: '/actuator/health'

AWS::ElasticLoadBalancingV2::Listener

Network Load Balancer Listener

Resources:
  LoadBalancerListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      LoadBalancerArn: !Ref LoadBalancerArn
      Port: !Ref NetworkLoadBalancerPort
      Protocol: TCP
      DefaultActions:
        - TargetGroupArn: !Ref TargetGroup
          Type: 'forward'

Application Load Balancer Listener

Resources:
 LoadBalancerListener:
   Type: AWS::ElasticLoadBalancingV2::Listener
   Properties:
     LoadBalancerArn: !Ref ApplicationkLoadBalancerArn
     Port: !Ref LoadBalancerPort
     Protocol: HTTP
     DefaultActions:
       - TargetGroupArn: !Ref TargetGroup
         Type: 'forward'