{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Parameters": {
        "OwnerName": {
            "Type": "String"
        },
        "OwnerEmail": {
            "Type": "String"
        }
    },
    "Mappings": {
        "UserDataMap": {
            "eu-central-1": {
                "common": "#!/bin/bash\nmkdir ~ec2-user/stage/\ncd ~ec2-user/stage/\nwget https://pingcap-edu-frankfurt.s3.eu-central-1.amazonaws.com/tidb-admin-dataset.zip\ngit clone https://github.com/pingcap/tidb-course-201-lab.git\nREGION_CODE=`curl http://169.254.169.254/latest/meta-data/placement/region`\necho export REGION_CODE=${REGION_CODE} > ~ec2-user/cloud-env.sh\nalias cp='cp'\ncp -R tidb-course-201-lab/setup/tidb-lab-aws-10-nodes-amz2/* ~ec2-user/\ncp -R tidb-course-201-lab/setup/tidb-lab-mysql-init-amz2/show-mysql-password.sh ~ec2-user/\ncd ~\nchown -R ec2-user:ec2-user ~ec2-user/*\nchmod +x ~ec2-user/*.sh\necho \"if [ -f /home/ec2-user/hosts-env.sh ]; then\" >> ~ec2-user/.bashrc\necho \"    source /home/ec2-user/hosts-env.sh\" >> ~ec2-user/.bashrc\necho \"fi;\" >> ~ec2-user/.bashrc\nchown ec2-user:ec2-user ~ec2-user/.bashrc\nservice mysqld start\nX=`grep 'temporary password' /var/log/mysqld.log | sed 's/.*: //'`\nmysql -h localhost -P 3306 -uroot -p$X --connect-expired-password << 'EOF'\nALTER USER root@'localhost' identified by 'q1w2e3R4_';\nEOF\nservice mysqld stop\n"
            }
        }
    },
    "Resources": {
        "DemoIGW": {
            "Type": "AWS::EC2::InternetGateway",
            "Properties": {
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    }
                ]
            },
            "DependsOn": [
                "DemoVPC"
            ]
        },
        "DemoVPC": {
            "Type": "AWS::EC2::VPC",
            "Properties": {
                "CidrBlock": "10.90.0.0/16",
                "EnableDnsSupport": "true",
                "EnableDnsHostnames": "true",
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Ref": "OwnerName"
                        }
                    }
                ]
            }
        },
        "IGWA": {
            "Type": "AWS::EC2::VPCGatewayAttachment",
            "Properties": {
                "InternetGatewayId": {
                    "Ref": "DemoIGW"
                },
                "VpcId": {
                    "Ref": "DemoVPC"
                }
            }
        },
        "PublicRouteTable": {
            "Type": "AWS::EC2::RouteTable",
            "Properties": {
                "VpcId": {
                    "Ref": "DemoVPC"
                },
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": "PE Quick Demo Public Route"
                    }
                ]
            }
        },
        "PublicRoute": {
            "Type": "AWS::EC2::Route",
            "Properties": {
                "DestinationCidrBlock": "0.0.0.0/0",
                "GatewayId": {
                    "Ref": "DemoIGW"
                },
                "RouteTableId": {
                    "Ref": "PublicRouteTable"
                }
            },
            "DependsOn": [
                "IGWA"
            ]
        },
        "SN1": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "VpcId": {
                    "Ref": "DemoVPC"
                },
                "CidrBlock": "10.90.1.0/24",
                "AvailabilityZone": "eu-central-1a",
                "PrivateDnsNameOptionsOnLaunch": {
                    "EnableResourceNameDnsAAAARecord": false,
                    "EnableResourceNameDnsARecord": true,
                    "HostnameType": "ip-name"
                },
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "-",
                                [
                                    {
                                        "Ref": "OwnerName"
                                    },
                                    "subnet",
                                    "1"
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "SN2": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "VpcId": {
                    "Ref": "DemoVPC"
                },
                "CidrBlock": "10.90.2.0/24",
                "AvailabilityZone": "eu-central-1a",
                "PrivateDnsNameOptionsOnLaunch": {
                    "EnableResourceNameDnsAAAARecord": false,
                    "EnableResourceNameDnsARecord": true,
                    "HostnameType": "ip-name"
                },
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "-",
                                [
                                    {
                                        "Ref": "OwnerName"
                                    },
                                    "subnet",
                                    "2"
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "SN3": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "VpcId": {
                    "Ref": "DemoVPC"
                },
                "CidrBlock": "10.90.3.0/24",
                "AvailabilityZone": "eu-central-1a",
                "PrivateDnsNameOptionsOnLaunch": {
                    "EnableResourceNameDnsAAAARecord": false,
                    "EnableResourceNameDnsARecord": true,
                    "HostnameType": "ip-name"
                },
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "-",
                                [
                                    {
                                        "Ref": "OwnerName"
                                    },
                                    "subnet",
                                    "3"
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "SN4": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "VpcId": {
                    "Ref": "DemoVPC"
                },
                "CidrBlock": "10.90.4.0/24",
                "AvailabilityZone": "eu-central-1a",
                "PrivateDnsNameOptionsOnLaunch": {
                    "EnableResourceNameDnsAAAARecord": false,
                    "EnableResourceNameDnsARecord": true,
                    "HostnameType": "ip-name"
                },
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "-",
                                [
                                    {
                                        "Ref": "OwnerName"
                                    },
                                    "subnet",
                                    "4"
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "SRTA1": {
            "Type": "AWS::EC2::SubnetRouteTableAssociation",
            "Properties": {
                "SubnetId": {
                    "Ref": "SN1"
                },
                "RouteTableId": {
                    "Ref": "PublicRouteTable"
                }
            }
        },
        "SRTA2": {
            "Type": "AWS::EC2::SubnetRouteTableAssociation",
            "Properties": {
                "SubnetId": {
                    "Ref": "SN2"
                },
                "RouteTableId": {
                    "Ref": "PublicRouteTable"
                }
            }
        },
        "SRTA3": {
            "Type": "AWS::EC2::SubnetRouteTableAssociation",
            "Properties": {
                "SubnetId": {
                    "Ref": "SN3"
                },
                "RouteTableId": {
                    "Ref": "PublicRouteTable"
                }
            }
        },
        "SRTA4": {
            "Type": "AWS::EC2::SubnetRouteTableAssociation",
            "Properties": {
                "SubnetId": {
                    "Ref": "SN4"
                },
                "RouteTableId": {
                    "Ref": "PublicRouteTable"
                }
            }
        },
        "DemoSG": {
            "Type": "AWS::EC2::SecurityGroup",
            "Properties": {
                "GroupDescription": "Allow nodes communication.",
                "VpcId": {
                    "Ref": "DemoVPC"
                },
                "SecurityGroupIngress": [
                    {
                        "IpProtocol": "tcp",
                        "FromPort": 22,
                        "ToPort": 22,
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "IpProtocol": "tcp",
                        "FromPort": 2379,
                        "ToPort": 2379,
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "IpProtocol": "tcp",
                        "FromPort": 4000,
                        "ToPort": 4002,
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "IpProtocol": "tcp",
                        "FromPort": 3000,
                        "ToPort": 3000,
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "IpProtocol": "icmp",
                        "FromPort": -1,
                        "ToPort": -1,
                        "CidrIp": "0.0.0.0/0"
                    }
                ],
                "SecurityGroupEgress": [
                    {
                        "IpProtocol": "-1",
                        "CidrIp": "0.0.0.0/0"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        }
                    },
                    {
                        "Key": "Name",
                        "Value": {
                            "Fn::Join": [
                                "-",
                                [
                                    {
                                        "Ref": "OwnerName"
                                    },
                                    "-sg"
                                ]
                            ]
                        }
                    }
                ]
            }
        },
        "IRule": {
            "Type": "AWS::EC2::SecurityGroupIngress",
            "Properties": {
                "IpProtocol": "-1",
                "SourceSecurityGroupId": {
                    "Fn::GetAtt": [
                        "DemoSG",
                        "GroupId"
                    ]
                },
                "GroupId": {
                    "Fn::GetAtt": [
                        "DemoSG",
                        "GroupId"
                    ]
                }
            }
        },
        "KVT": {
            "Type": "AWS::EC2::LaunchTemplate",
            "Properties": {
                "VersionDescription": "v1",
                "LaunchTemplateName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "tikv",
                            "lt"
                        ]
                    ]
                },
                "LaunchTemplateData": {
                    "Monitoring": {
                        "Enabled": false
                    },
                    "IamInstanceProfile": {
                        "Name": "course-303-node-role"
                    },
                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/dev/xvda",
                            "Ebs": {
                                "DeleteOnTermination": true,
                                "Encrypted": false,
                                "VolumeSize": 100,
                                "VolumeType": "gp2"
                            }
                        }
                    ],
                    "NetworkInterfaces": [
                        {
                            "DeviceIndex": 0,
                            "AssociatePublicIpAddress": true,
                            "Groups": [
                                {
                                    "Ref": "DemoSG"
                                }
                            ],
                            "DeleteOnTermination": true
                        }
                    ],
                    "ImageId": "ami-0dcf9d41d50ff7b40",
                    "InstanceType": "c5.large",
                    "KeyName": "pe-class-key-frankfurt",
                    "TagSpecifications": [
                        {
                            "ResourceType": "instance",
                            "Tags": [
                                {
                                    "Key": "Owner",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "Name",
                                    "Value": "kv"
                                },
                                {
                                    "Key": "environment",
                                    "Value": "education"
                                },
                                {
                                    "Key": "servicetype",
                                    "Value": "education"
                                },
                                {
                                    "Key": "usedby",
                                    "Value": "education"
                                },
                                {
                                    "Key": "component",
                                    "Value": "education"
                                },
                                {
                                    "Key": "tenant",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "project",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "cluster",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                }
                            ]
                        }
                    ],
                    "UserData": {
                        "Fn::Base64": {
                            "Fn::FindInMap": [
                                "UserDataMap",
                                {
                                    "Ref": "AWS::Region"
                                },
                                "common"
                            ]
                        }
                    }
                }
            }
        },
        "PDT": {
            "Type": "AWS::EC2::LaunchTemplate",
            "Properties": {
                "VersionDescription": "v1",
                "LaunchTemplateName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "pd",
                            "lt"
                        ]
                    ]
                },
                "LaunchTemplateData": {
                    "Monitoring": {
                        "Enabled": false
                    },
                    "IamInstanceProfile": {
                        "Name": "course-303-node-role"
                    },
                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/dev/xvda",
                            "Ebs": {
                                "DeleteOnTermination": true,
                                "Encrypted": false,
                                "VolumeSize": 30,
                                "VolumeType": "gp2"
                            }
                        }
                    ],
                    "NetworkInterfaces": [
                        {
                            "DeviceIndex": 0,
                            "AssociatePublicIpAddress": true,
                            "Groups": [
                                {
                                    "Ref": "DemoSG"
                                }
                            ],
                            "DeleteOnTermination": true
                        }
                    ],
                    "ImageId": "ami-0dcf9d41d50ff7b40",
                    "InstanceType": "c5.large",
                    "KeyName": "pe-class-key-frankfurt",
                    "TagSpecifications": [
                        {
                            "ResourceType": "instance",
                            "Tags": [
                                {
                                    "Key": "Owner",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "Name",
                                    "Value": "pd"
                                },
                                {
                                    "Key": "environment",
                                    "Value": "education"
                                },
                                {
                                    "Key": "servicetype",
                                    "Value": "education"
                                },
                                {
                                    "Key": "usedby",
                                    "Value": "education"
                                },
                                {
                                    "Key": "component",
                                    "Value": "education"
                                },
                                {
                                    "Key": "tenant",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "project",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "cluster",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                }
                            ]
                        }
                    ],
                    "UserData": {
                        "Fn::Base64": {
                            "Fn::FindInMap": [
                                "UserDataMap",
                                {
                                    "Ref": "AWS::Region"
                                },
                                "common"
                            ]
                        }
                    }
                }
            }
        },
        "DBT": {
            "Type": "AWS::EC2::LaunchTemplate",
            "Properties": {
                "VersionDescription": "v1",
                "LaunchTemplateName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "tidb",
                            "lt"
                        ]
                    ]
                },
                "LaunchTemplateData": {
                    "Monitoring": {
                        "Enabled": false
                    },
                    "IamInstanceProfile": {
                        "Name": "course-303-node-role"
                    },
                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/dev/xvda",
                            "Ebs": {
                                "DeleteOnTermination": true,
                                "Encrypted": false,
                                "VolumeSize": 30,
                                "VolumeType": "gp2"
                            }
                        }
                    ],
                    "NetworkInterfaces": [
                        {
                            "DeviceIndex": 0,
                            "AssociatePublicIpAddress": true,
                            "Groups": [
                                {
                                    "Ref": "DemoSG"
                                }
                            ],
                            "DeleteOnTermination": true
                        }
                    ],
                    "ImageId": "ami-0dcf9d41d50ff7b40",
                    "InstanceType": "c5.large",
                    "KeyName": "pe-class-key-frankfurt",
                    "TagSpecifications": [
                        {
                            "ResourceType": "instance",
                            "Tags": [
                                {
                                    "Key": "Owner",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "Name",
                                    "Value": "db"
                                },
                                {
                                    "Key": "environment",
                                    "Value": "education"
                                },
                                {
                                    "Key": "servicetype",
                                    "Value": "education"
                                },
                                {
                                    "Key": "usedby",
                                    "Value": "education"
                                },
                                {
                                    "Key": "component",
                                    "Value": "education"
                                },
                                {
                                    "Key": "tenant",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "project",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "cluster",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                }
                            ]
                        }
                    ],
                    "UserData": {
                        "Fn::Base64": {
                            "Fn::FindInMap": [
                                "UserDataMap",
                                {
                                    "Ref": "AWS::Region"
                                },
                                "common"
                            ]
                        }
                    }
                }
            }
        },
        "TFLT": {
            "Type": "AWS::EC2::LaunchTemplate",
            "Properties": {
                "VersionDescription": "v1",
                "LaunchTemplateName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "tiflash",
                            "lt"
                        ]
                    ]
                },
                "LaunchTemplateData": {
                    "IamInstanceProfile": {
                        "Name": "course-303-node-role"
                    },
                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/dev/xvda",
                            "Ebs": {
                                "DeleteOnTermination": true,
                                "Encrypted": false,
                                "VolumeSize": 100,
                                "VolumeType": "gp2"
                            }
                        }
                    ],
                    "NetworkInterfaces": [
                        {
                            "DeviceIndex": 0,
                            "AssociatePublicIpAddress": true,
                            "Groups": [
                                {
                                    "Ref": "DemoSG"
                                }
                            ],
                            "DeleteOnTermination": true
                        }
                    ],
                    "ImageId": "ami-0dcf9d41d50ff7b40",
                    "InstanceType": "c5.large",
                    "KeyName": "pe-class-key-frankfurt",
                    "TagSpecifications": [
                        {
                            "ResourceType": "instance",
                            "Tags": [
                                {
                                    "Key": "Owner",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "Name",
                                    "Value": "tiflash"
                                },
                                {
                                    "Key": "environment",
                                    "Value": "education"
                                },
                                {
                                    "Key": "servicetype",
                                    "Value": "education"
                                },
                                {
                                    "Key": "usedby",
                                    "Value": "education"
                                },
                                {
                                    "Key": "component",
                                    "Value": "education"
                                },
                                {
                                    "Key": "tenant",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "project",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "cluster",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                }
                            ]
                        }
                    ],
                    "UserData": {
                        "Fn::Base64": {
                            "Fn::FindInMap": [
                                "UserDataMap",
                                {
                                    "Ref": "AWS::Region"
                                },
                                "common"
                            ]
                        }
                    }
                }
            }
        },
        "MLT": {
            "Type": "AWS::EC2::LaunchTemplate",
            "Properties": {
                "VersionDescription": "v1",
                "LaunchTemplateName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "monitor",
                            "lt"
                        ]
                    ]
                },
                "LaunchTemplateData": {
                    "IamInstanceProfile": {
                        "Name": "course-303-node-role"
                    },
                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/dev/xvda",
                            "Ebs": {
                                "DeleteOnTermination": true,
                                "Encrypted": false,
                                "VolumeSize": 100,
                                "VolumeType": "gp2"
                            }
                        }
                    ],
                    "NetworkInterfaces": [
                        {
                            "DeviceIndex": 0,
                            "AssociatePublicIpAddress": true,
                            "Groups": [
                                {
                                    "Ref": "DemoSG"
                                }
                            ],
                            "DeleteOnTermination": true
                        }
                    ],
                    "ImageId": "ami-0dcf9d41d50ff7b40",
                    "InstanceType": "c5.large",
                    "KeyName": "pe-class-key-frankfurt",
                    "TagSpecifications": [
                        {
                            "ResourceType": "instance",
                            "Tags": [
                                {
                                    "Key": "Owner",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "Name",
                                    "Value": "monitor"
                                },
                                {
                                    "Key": "environment",
                                    "Value": "education"
                                },
                                {
                                    "Key": "servicetype",
                                    "Value": "education"
                                },
                                {
                                    "Key": "usedby",
                                    "Value": "education"
                                },
                                {
                                    "Key": "component",
                                    "Value": "education"
                                },
                                {
                                    "Key": "tenant",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "project",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                },
                                {
                                    "Key": "cluster",
                                    "Value": {
                                        "Ref": "OwnerEmail"
                                    }
                                }
                            ]
                        }
                    ],
                    "UserData": {
                        "Fn::Base64": {
                            "Fn::FindInMap": [
                                "UserDataMap",
                                {
                                    "Ref": "AWS::Region"
                                },
                                "common"
                            ]
                        }
                    }
                }
            }
        },
        "KVG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "AutoScalingGroupName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "TiKV",
                            "asg"
                        ]
                    ]
                },
                "LaunchTemplate": {
                    "LaunchTemplateId": {
                        "Ref": "KVT"
                    },
                    "Version": {
                        "Fn::GetAtt": [
                            "KVT",
                            "LatestVersionNumber"
                        ]
                    }
                },
                "MaxSize": "3",
                "MinSize": "3",
                "DesiredCapacity": "3",
                "VPCZoneIdentifier": [
                    {
                        "Ref": "SN1"
                    },
                    {
                        "Ref": "SN2"
                    },
                    {
                        "Ref": "SN3"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        },
                        "PropagateAtLaunch": "true"
                    },
                    {
                        "Key": "trainer",
                        "Value": {
                            "Ref": "OwnerName"
                        },
                        "PropagateAtLaunch": "true"
                    }
                ]
            },
            "DependsOn": [
                "IGWA"
            ]
        },
        "PDG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "AutoScalingGroupName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "PD",
                            "asg"
                        ]
                    ]
                },
                "LaunchTemplate": {
                    "LaunchTemplateId": {
                        "Ref": "PDT"
                    },
                    "Version": {
                        "Fn::GetAtt": [
                            "PDT",
                            "LatestVersionNumber"
                        ]
                    }
                },
                "MaxSize": "3",
                "MinSize": "3",
                "DesiredCapacity": "3",
                "VPCZoneIdentifier": [
                    {
                        "Ref": "SN1"
                    },
                    {
                        "Ref": "SN2"
                    },
                    {
                        "Ref": "SN3"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        },
                        "PropagateAtLaunch": "true"
                    },
                    {
                        "Key": "trainer",
                        "Value": {
                            "Ref": "OwnerName"
                        },
                        "PropagateAtLaunch": "true"
                    }
                ]
            },
            "DependsOn": [
                "IGWA"
            ]
        },
        "DBG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "AutoScalingGroupName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "TiDB",
                            "asg"
                        ]
                    ]
                },
                "LaunchTemplate": {
                    "LaunchTemplateId": {
                        "Ref": "DBT"
                    },
                    "Version": {
                        "Fn::GetAtt": [
                            "DBT",
                            "LatestVersionNumber"
                        ]
                    }
                },
                "MaxSize": "2",
                "MinSize": "2",
                "DesiredCapacity": "2",
                "VPCZoneIdentifier": [
                    {
                        "Ref": "SN1"
                    },
                    {
                        "Ref": "SN2"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        },
                        "PropagateAtLaunch": "true"
                    },
                    {
                        "Key": "trainer",
                        "Value": {
                            "Ref": "OwnerName"
                        },
                        "PropagateAtLaunch": "true"
                    }
                ]
            },
            "DependsOn": [
                "IGWA"
            ]
        },
        "TFG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "AutoScalingGroupName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "TiFlash",
                            "asg"
                        ]
                    ]
                },
                "LaunchTemplate": {
                    "LaunchTemplateId": {
                        "Ref": "TFLT"
                    },
                    "Version": {
                        "Fn::GetAtt": [
                            "TFLT",
                            "LatestVersionNumber"
                        ]
                    }
                },
                "MaxSize": "1",
                "MinSize": "1",
                "DesiredCapacity": "1",
                "VPCZoneIdentifier": [
                    {
                        "Ref": "SN4"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        },
                        "PropagateAtLaunch": "true"
                    },
                    {
                        "Key": "trainer",
                        "Value": {
                            "Ref": "OwnerName"
                        },
                        "PropagateAtLaunch": "true"
                    }
                ]
            },
            "DependsOn": [
                "IGWA"
            ]
        },
        "MG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "AutoScalingGroupName": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Ref": "OwnerName"
                            },
                            "Monitor",
                            "asg"
                        ]
                    ]
                },
                "LaunchTemplate": {
                    "LaunchTemplateId": {
                        "Ref": "MLT"
                    },
                    "Version": {
                        "Fn::GetAtt": [
                            "MLT",
                            "LatestVersionNumber"
                        ]
                    }
                },
                "MaxSize": "1",
                "MinSize": "1",
                "DesiredCapacity": "1",
                "VPCZoneIdentifier": [
                    {
                        "Ref": "SN4"
                    }
                ],
                "Tags": [
                    {
                        "Key": "Owner",
                        "Value": {
                            "Ref": "OwnerEmail"
                        },
                        "PropagateAtLaunch": "true"
                    },
                    {
                        "Key": "trainer",
                        "Value": {
                            "Ref": "OwnerName"
                        },
                        "PropagateAtLaunch": "true"
                    }
                ]
            },
            "DependsOn": [
                "IGWA"
            ]
        }
    }
}