AWSTemplateFormatVersion: 2010-09-09 Description: > This AWS CloudFormation template to create Service Resources like Rocket Chat, Jitsi and JVB in the VPC to work with Fargate in Create Service Wizard (evaluation version) (qs-1shsu3b63) Metadata: cfn-lint: config: ignore_checks: - W9006 # temporary to get rid of warnings - W9002 # temporary to get rid of warnings - W9003 # temporary to get rid of warnings - W9901 # Not passing all the default parameters to reduce verbosity AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Network configuration Parameters: - NumberOfAvalZones - PrivateSubnet1A - PrivateSubnet2A - PrivateSubnet3A - ECSCluster - ContainerSecurityGroup - JVBDiscoveryService - JVBEVALTLSTG - JVBEVALUDPTG - RCHATEVALTLSTG - RCHATEVALNLBURL - JVBEVALNLBURL - CloudmeetDomain - CloudcallDomain - Label: default: Container Task Definition Parameters: - ECSTDJVB - ECSTDJITSI - ECSTDRCHAT ParameterLabels: PrivateSubnet1A: default: Private subnet 1A PrivateSubnet2A: default: Private subnet 2A PrivateSubnet3A: default: Private subnet 3A NumberOfAvalZones: default: Number Of Availability Zones ECSCluster: default: ECSCluster Name ContainerSecurityGroup: default: Container Security Group ID JVBDiscoveryService: default: JVB Discovery Service Name JVBEVALTLSTG: default: JVB TLS Target Group JVBEVALUDPTG: default: JVB UDP Target Group RCHATEVALTLSTG: default: RCHAT TLS Target Group CloudmeetDomain: default: Cloudmeet Domain Name CloudcallDomain: default: Cloudcall Domain Name RCHATEVALNLBURL: default: The URL of the Rocket Chat Network Load Balancer JVBEVALNLBURL: default: The URL of the Cloudmeet Call Network Load Balancer ECSTDJVB: default: JVB Task Definition ECSTDJITSI: default: JITSI Task Definition ECSTDRCHAT: default: RCHAT Task Definition Parameters: ECSCluster: Description: ECS Cluster Name Type: String Default: '' PrivateSubnet1A: Description: VPC Private Subnet 1A Type: String Default: '' PrivateSubnet2A: Description: VPC Private Subnet 2A Type: String Default: '' PrivateSubnet3A: Description: VPC Private Subnet 3A Type: String Default: '' NumberOfAvalZones: Description: Number Of Availability Zones Type: String Default: '' ContainerSecurityGroup: Description: Container Security Group Name Type: String Default: '' JVBDiscoveryService: Description: JVB DiscoveryService Arn Type: String Default: '' JVBEVALTLSTG: Description: JVB TLS Target Group ID Type: String Default: '' JVBEVALUDPTG: Description: JVB UDP Target Group ID Type: String Default: '' RCHATEVALTLSTG: Description: Rchat TLS Target Group ID Type: String Default: '' RCHATEVALNLBURL: Description: Cloudmeet NLB DNS Type: String Default: '' JVBEVALNLBURL: Description: Cloudmeet Call NLB DNS Type: String Default: '' CloudmeetDomain: Description: The Cloudmeet Domain Name Type: String Default: '' CloudcallDomain: Description: The Cloudmeet Domain Name Type: String Default: '' ECSTDJVB: Description: JVB Task Definition Type: String Default: '' ECSTDJITSI: Description: JITSI Task Definition Type: String Default: '' ECSTDRCHAT: Description: RCHAT Task Definition Type: String Default: '' Conditions: 3AZCondition: !Equals [!Ref 'NumberOfAvalZones', '3'] Resources: JVBScalableTarget: Type: AWS::ApplicationAutoScaling::ScalableTarget Properties: MaxCapacity: 5 MinCapacity: 1 RoleARN: Fn::Sub: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService' ServiceNamespace: ecs ScalableDimension: 'ecs:service:DesiredCount' ResourceId: !Join - / - - service - !Ref ECSCluster - !GetAtt JVB2Service.Name JVBServiceScalingPolicyCPU: Type: AWS::ApplicationAutoScaling::ScalingPolicy Properties: PolicyName: !Sub ${AWS::StackName}-target-tracking-cpu50 PolicyType: TargetTrackingScaling ScalingTargetId: !Ref JVBScalableTarget TargetTrackingScalingPolicyConfiguration: TargetValue: 50.0 ScaleInCooldown: 60 ScaleOutCooldown: 10 PredefinedMetricSpecification: PredefinedMetricType: ECSServiceAverageCPUUtilization JVBService: Type: AWS::ECS::Service Properties: Cluster: Ref: "ECSCluster" LaunchType: FARGATE DesiredCount: 1 DeploymentConfiguration: MaximumPercent: 200 MinimumHealthyPercent: 100 HealthCheckGracePeriodSeconds: 600 NetworkConfiguration: AwsvpcConfiguration: Subnets: - !Ref PrivateSubnet1A - !Ref PrivateSubnet2A - !If [3AZCondition, !Ref 'PrivateSubnet3A', !Ref 'AWS::NoValue'] SecurityGroups: - !Ref ContainerSecurityGroup LoadBalancers: - ContainerName: jitsi-web ContainerPort: 443 TargetGroupArn: !Ref JVBEVALTLSTG - ContainerName: jitsi-jvb ContainerPort: 10000 TargetGroupArn: !Ref JVBEVALUDPTG TaskDefinition: Ref: "ECSTDJITSI" ServiceRegistries: - RegistryArn: !Ref JVBDiscoveryService PlatformVersion: "1.4.0" JVB2Service: Type: AWS::ECS::Service Properties: Cluster: Ref: "ECSCluster" LaunchType: FARGATE DesiredCount: 1 DeploymentConfiguration: MaximumPercent: 200 MinimumHealthyPercent: 100 NetworkConfiguration: AwsvpcConfiguration: Subnets: - !Ref PrivateSubnet1A - !Ref PrivateSubnet2A - !If [3AZCondition, !Ref 'PrivateSubnet3A', !Ref 'AWS::NoValue'] SecurityGroups: - !Ref ContainerSecurityGroup TaskDefinition: Ref: "ECSTDJVB" PlatformVersion: "1.4.0" RCHATService: Type: AWS::ECS::Service Properties: Cluster: Ref: "ECSCluster" LaunchType: FARGATE DesiredCount: 1 DeploymentConfiguration: MaximumPercent: 200 MinimumHealthyPercent: 100 HealthCheckGracePeriodSeconds: 600 NetworkConfiguration: AwsvpcConfiguration: Subnets: - !Ref PrivateSubnet1A - !Ref PrivateSubnet2A - !If [3AZCondition, !Ref 'PrivateSubnet3A', !Ref 'AWS::NoValue'] SecurityGroups: - !Ref ContainerSecurityGroup LoadBalancers: - ContainerName: cm-web ContainerPort: 443 TargetGroupArn: !Ref RCHATEVALTLSTG TaskDefinition: Ref: "ECSTDRCHAT" PlatformVersion: "1.4.0" Outputs: UsedByECSCreateCluster: Description: Flag used by Elastic Container Service Create Cluster Wizard Value: 'true' TemplateVersion: Description: The version of the template used by Create Cluster Wizard Value: 1.1.0 MeetLoadBalancersDns: Description: The DNS of Rocket Chat Network Load Balancer Value: !Ref 'RCHATEVALNLBURL' Export: Name: !Join [ ':', [ !Ref 'AWS::StackName', 'MeetLoadBalancersDns' ] ] CallLoadBalancersDns: Description: The DNS of the JVB Call Network Load Balancer Value: !Ref 'JVBEVALNLBURL' Export: Name: !Join [ ':', [ !Ref 'AWS::StackName', 'CallLoadBalancersDns' ] ] CloudmeetDomain: Description: The Cloudmeet Domain Name Value: !Ref 'CloudmeetDomain' Export: Name: !Join [ ':', [ !Ref 'AWS::StackName', 'CloudmeetDomain' ] ] CloudcallDomain: Description: The Cloudcall Domain Name Value: !Ref 'CloudcallDomain' Export: Name: !Join [ ':', [ !Ref 'AWS::StackName', 'CloudcallDomain' ] ]