I’m working on a solution right now that requires two load balancers (see https://github.com/cfn-modules/alb-listener/pull/6 for status).
The public service would use the setup that we have in the book with one addition, add one parameter:
ClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName'
The private service that can only be reached from the public service would look like this:
ClientSg:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
TemplateURL: './node_modules/@cfn-modules/client-sg/module.yml'
AlbPriv:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
Scheme: internal
TemplateURL: './node_modules/@cfn-modules/alb/module.yml'
AlbPrivListener:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
AlbModule: !GetAtt 'AlbPriv.Outputs.StackName'
ClientSgModule: !GetAtt 'ClientSg.Outputs.StackName'
TemplateURL: './node_modules/@cfn-modules/alb-listener/module.yml'
AlbPrivTarget:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
AlbModule: !GetAtt 'AlbPriv.Outputs.StackName'
AlbListenerModule: !GetAtt 'AlbPrivListener.Outputs.StackName'
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
AlertingModule: !GetAtt 'Alerting.Outputs.StackName'
Priority: '2'
HealthCheckPath: '/health-check.php' # TODO change to your health check!
TemplateURL: './node_modules/@cfn-modules/ecs-alb-target/module.yml'
PrivService:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
TargetModule: !GetAtt 'AlbPrivTarget.Outputs.StackName'
# [...]
TemplateURL: './node_modules/@cfn-modules/fargate-service/module.yml'
We do not support AWS Cloud Map for service discovery at the moment.