cfn/greeter/service-consul-connect-greeter-fargate.yml [117:194]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          Essential: true
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: !Sub ${EnvironmentName}-service-${ServiceName}
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: !Ref 'ServiceName'

        # the agent which should join the mesh & register the service
        - Name: !Sub ${ServiceName}-agent
          Image: !Ref 'InitImageUrl'
          PortMappings:
            - ContainerPort: 8301
              Protocol: tcp
            - ContainerPort: 8301
              Protocol: udp
            - ContainerPort: 8400
              Protocol: tcp
            - ContainerPort: 8500
              Protocol: tcp
            - ContainerPort: 53
              Protocol: udp
          MountPoints:
              - ContainerPath: /consul/data
                SourceVolume: consul-data
                ReadOnly: false
              - ContainerPath: /consul/config
                SourceVolume: consul-config
                ReadOnly: false
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: !Sub ${EnvironmentName}-service-${ServiceName}
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: !Sub ${ServiceName}-agent
        
        # the Consul Connect sidecar proxy
        - Name: !Sub ${ServiceName}-proxy
          Image: 'public.ecr.aws/hashicorp/consul:1.9.1'
          DependsOn:
            - ContainerName: !Sub ${ServiceName}-agent
              Condition: START
          EntryPoint:
            - '/bin/sh'
            - '-c'
          Command:
            - !Sub >
              exec consul connect proxy -sidecar-for ${ServiceName}
          PortMappings:
            - ContainerPort: 8080
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: !Sub ${EnvironmentName}-service-${ServiceName}
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: !Sub ${ServiceName}-proxy

  # The ECS service to run the containers
  Service:
    Type: AWS::ECS::Service
    Properties:
      ServiceName: !Ref 'ServiceName'
      LaunchType: 'FARGATE'
      Cluster:
        Fn::ImportValue: !Sub ${EnvironmentName}:ClusterName
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 75
      DesiredCount: !Ref 'DesiredCount'
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: ENABLED
          SecurityGroups:
            - Fn::ImportValue: !Sub ${EnvironmentName}:ServiceSecurityGroup
          Subnets:
            - Fn::ImportValue: !Sub ${EnvironmentName}:PublicSubnetOne
            - Fn::ImportValue: !Sub ${EnvironmentName}:PublicSubnetTwo
      TaskDefinition: !Ref 'TaskDefinition'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



cfn/greeting/service-consul-connect-greeting-fargate.yml [109:186]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          Essential: true
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: !Sub ${EnvironmentName}-service-${ServiceName}
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: !Ref 'ServiceName'

        # the agent which should join the mesh & register the service
        - Name: !Sub ${ServiceName}-agent
          Image: !Ref 'InitImageUrl'
          PortMappings:
            - ContainerPort: 8301
              Protocol: tcp
            - ContainerPort: 8301
              Protocol: udp
            - ContainerPort: 8400
              Protocol: tcp
            - ContainerPort: 8500
              Protocol: tcp
            - ContainerPort: 53
              Protocol: udp
          MountPoints:
              - ContainerPath: /consul/data
                SourceVolume: consul-data
                ReadOnly: false
              - ContainerPath: /consul/config
                SourceVolume: consul-config
                ReadOnly: false
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: !Sub ${EnvironmentName}-service-${ServiceName}
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: !Sub ${ServiceName}-agent

        # the Consul Connect sidecar proxy
        - Name: !Sub ${ServiceName}-proxy
          Image: 'public.ecr.aws/hashicorp/consul:1.9.1'
          DependsOn:
            - ContainerName: !Sub ${ServiceName}-agent
              Condition: START
          EntryPoint:
            - '/bin/sh'
            - '-c'
          Command:
            - !Sub >
              exec consul connect proxy -sidecar-for ${ServiceName}
          PortMappings:
            - ContainerPort: 8080
          LogConfiguration:
            LogDriver: 'awslogs'
            Options:
              awslogs-group: !Sub ${EnvironmentName}-service-${ServiceName}
              awslogs-region: !Ref 'AWS::Region'
              awslogs-stream-prefix: !Sub ${ServiceName}-proxy

  # The ECS service to run the containers
  Service:
    Type: AWS::ECS::Service
    Properties:
      ServiceName: !Ref 'ServiceName'
      LaunchType: 'FARGATE'
      Cluster:
        Fn::ImportValue: !Sub ${EnvironmentName}:ClusterName
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 75
      DesiredCount: !Ref 'DesiredCount'
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: ENABLED
          SecurityGroups:
            - Fn::ImportValue: !Sub ${EnvironmentName}:ServiceSecurityGroup
          Subnets:
            - Fn::ImportValue: !Sub ${EnvironmentName}:PublicSubnetOne
            - Fn::ImportValue: !Sub ${EnvironmentName}:PublicSubnetTwo
      TaskDefinition: !Ref 'TaskDefinition'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



