OMERO-cloudformation-templates/OMEROonECS_ALBwithTLS_RW.yaml [555:674]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - OmerowebHTTPListener
    Properties:
      Cluster: !Ref 'OMEROECSCluster'
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 100
      DeploymentController:
        Type: ECS
      DesiredCount: !Ref NumberofWebInstances
      LaunchType: 'FARGATE'
      EnableExecuteCommand: true
      LoadBalancers:
        - ContainerName: omeroweb
          ContainerPort: 4080
          TargetGroupArn: !Ref 'OmerowebTCP4080TargetGroup'
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: DISABLED
          SecurityGroups:
            - !Ref OmeroSecurityGroup
          Subnets:
            - !Ref 'PrivateSubnet1Id'
            - !Ref 'PrivateSubnet2Id'
      PropagateTags: SERVICE
      SchedulingStrategy: REPLICA
      ServiceRegistries:
        - RegistryArn: !GetAtt 'OmerowebServiceDiscoveryEntry.Arn'
      Tags:
        - Key: project
          Value: omero-on-aws
        - Key: service
          Value: omeroweb
      TaskDefinition: !Ref 'OmerowebTaskDefinition'
  
  HostedZoneRecord:
    DependsOn: 
      - LoadBalancerSSLCert
    Type: AWS::Route53::RecordSet
    Properties: 
      HostedZoneId: !Ref ExistingHostedZoneId
      Type: A
      Name: !Ref FullDomainName
      AliasTarget:
        DNSName: !GetAtt 'OMEROLoadBalancer.DNSName'
        HostedZoneId: !GetAtt 'OMEROLoadBalancer.CanonicalHostedZoneID'

  LoadBalancerSSLCert:
    Type: AWS::CertificateManager::Certificate
    Properties:
      DomainName: !Ref FullDomainName
      DomainValidationOptions:
            - DomainName: !Ref FullDomainName
              HostedZoneId: !Ref ExistingHostedZoneId
      ValidationMethod: DNS
      CertificateTransparencyLoggingPreference: ENABLED

  OmerowebHTTPSListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      Certificates:
        - CertificateArn: !Ref LoadBalancerSSLCert
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref 'OmerowebTCP4080TargetGroup'
      LoadBalancerArn: !Ref 'OMEROLoadBalancer'
      Port: 443
      Protocol: HTTPS
  OmerowebHTTPListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: redirect
        RedirectConfig:
          Protocol: HTTPS
          Port: '443'
          Host: '#{host}'
          Path: /#{path}
          Query: '#{query}'
          StatusCode: HTTP_301
      LoadBalancerArn: !Ref 'OMEROLoadBalancer'
      Port: 80
      Protocol: HTTP
  OmerowebTCP4080TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 4080
      Protocol: HTTP
      TargetType: ip
      VpcId: !Ref VPCID
      HealthCheckEnabled: true
      HealthCheckProtocol: HTTP
      HealthCheckPort: 4080
      HealthCheckPath: /index/
      Matcher:
        HttpCode: 200-302
      TargetGroupAttributes:
        - Key: stickiness.enabled
          Value: true
        - Key: stickiness.type
          Value: lb_cookie
        - Key: stickiness.lb_cookie.duration_seconds
          Value: 86500
      Tags:
        - Key: project
          Value: omero-on-aws
  OmerowebTaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Environment:
            - Name: OMEROHOST
              Value: !Sub omeroserver.${AWS::StackName}.ecscloudmap.org
            - Name: LOCALDOMAIN
              Value: !Join
                - ''
                - - !Ref 'AWS::Region'
                  - .compute.internal
                  - 'omero.local'
          Essential: true
          Image: !Ref OMEROWebContainerImage
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



OMERO-cloudformation-templates/OMEROonECS_RW_TLS_S3FG.yml [698:817]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - OmerowebHTTPListener
    Properties:
      Cluster: !Ref 'OMEROECSCluster'
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 100
      DeploymentController:
        Type: ECS
      DesiredCount: !Ref NumberofWebInstances
      LaunchType: 'FARGATE'
      EnableExecuteCommand: true
      LoadBalancers:
        - ContainerName: omeroweb
          ContainerPort: 4080
          TargetGroupArn: !Ref 'OmerowebTCP4080TargetGroup'
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: DISABLED
          SecurityGroups:
            - !Ref OmeroSecurityGroup
          Subnets:
            - !Ref 'PrivateSubnet1Id'
            - !Ref 'PrivateSubnet2Id'
      PropagateTags: SERVICE
      SchedulingStrategy: REPLICA
      ServiceRegistries:
        - RegistryArn: !GetAtt 'OmerowebServiceDiscoveryEntry.Arn'
      Tags:
        - Key: project
          Value: omero-on-aws
        - Key: service
          Value: omeroweb
      TaskDefinition: !Ref 'OmerowebTaskDefinition'
  
  HostedZoneRecord:
    DependsOn: 
      - LoadBalancerSSLCert
    Type: AWS::Route53::RecordSet
    Properties: 
      HostedZoneId: !Ref ExistingHostedZoneId
      Type: A
      Name: !Ref FullDomainName
      AliasTarget:
        DNSName: !GetAtt 'OMEROLoadBalancer.DNSName'
        HostedZoneId: !GetAtt 'OMEROLoadBalancer.CanonicalHostedZoneID'

  LoadBalancerSSLCert:
    Type: AWS::CertificateManager::Certificate
    Properties:
      DomainName: !Ref FullDomainName
      DomainValidationOptions:
            - DomainName: !Ref FullDomainName
              HostedZoneId: !Ref ExistingHostedZoneId
      ValidationMethod: DNS
      CertificateTransparencyLoggingPreference: ENABLED

  OmerowebHTTPSListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      Certificates:
        - CertificateArn: !Ref LoadBalancerSSLCert
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref 'OmerowebTCP4080TargetGroup'
      LoadBalancerArn: !Ref 'OMEROLoadBalancer'
      Port: 443
      Protocol: HTTPS
  OmerowebHTTPListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: redirect
        RedirectConfig:
          Protocol: HTTPS
          Port: '443'
          Host: '#{host}'
          Path: /#{path}
          Query: '#{query}'
          StatusCode: HTTP_301
      LoadBalancerArn: !Ref 'OMEROLoadBalancer'
      Port: 80
      Protocol: HTTP
  OmerowebTCP4080TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 4080
      Protocol: HTTP
      TargetType: ip
      VpcId: !Ref VPCID
      HealthCheckEnabled: true
      HealthCheckProtocol: HTTP
      HealthCheckPort: 4080
      HealthCheckPath: /index/
      Matcher:
        HttpCode: 200-302
      TargetGroupAttributes:
        - Key: stickiness.enabled
          Value: true
        - Key: stickiness.type
          Value: lb_cookie
        - Key: stickiness.lb_cookie.duration_seconds
          Value: 86500
      Tags:
        - Key: project
          Value: omero-on-aws
  OmerowebTaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Environment:
            - Name: OMEROHOST
              Value: !Sub omeroserver.${AWS::StackName}.ecscloudmap.org
            - Name: LOCALDOMAIN
              Value: !Join
                - ''
                - - !Ref 'AWS::Region'
                  - .compute.internal
                  - 'omero.local'
          Essential: true
          Image: !Ref OMEROWebContainerImage
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



