AWSTemplateFormatVersion: '2010-09-09' Description: (SO8006) - Deploy Apache RocketMQ Cluster in a new VPC in AWS. (qs-1rhfjtiki) Metadata: QuickStartDocumentation: EntrypointName: Launch into an new VPC Order: "1" QSLint: Exclusions: [ W9002, W9003, W9004, W9006 ] AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Network configuration Parameters: - AvailabilityZones - NumberOfAZs - VPCCIDR - PrivateSubnet1CIDR - PrivateSubnet2CIDR - PrivateSubnet3CIDR - PublicSubnet1CIDR - PublicSubnet2CIDR - PublicSubnet3CIDR - RemoteAccessCIDR - Label: default: Security configuration Parameters: - KeyPairName - Label: default: Amazon EC2 Linux bastion host configuration Parameters: - BastionAMIOS - BastionInstanceType - NumBastionHosts - Label: default: Apache RocketMQ cluster configuration Parameters: - NameServerClusterCount - BrokerClusterCount - Iops - RocketMQVersion - NameServerInstanceType - BrokerNodeInstanceType - FlushDiskType - VolumeSize - VolumeType - Label: default: AWS Quick Start Configuration Parameters: - QSS3BucketName - QSS3KeyPrefix - QSS3BucketRegion ParameterLabels: AvailabilityZones: default: Availability Zones BastionAMIOS: default: Bastion host AMI operating system BastionInstanceType: default: Bastion host instance type NameServerClusterCount: default: Number of Apache RocketMQ NameServer cluster nodes BrokerClusterCount: default: Number of Apache RocketMQ Broker cluster nodes Iops: default: IOPS KeyPairName: default: Key pair name NumBastionHosts: default: Number of bastion hosts RocketMQVersion: default: RocketMQ version NameServerInstanceType: default: NameServer node instance type BrokerNodeInstanceType: default: Broker node instance type FlushDiskType: default: Apache RocketMQ flush disk type NumberOfAZs: default: Number of Availability Zones PrivateSubnet1CIDR: default: Private subnet 1 CIDR PrivateSubnet2CIDR: default: Private subnet 2 CIDR PrivateSubnet3CIDR: default: Private subnet 3 CIDR PublicSubnet1CIDR: default: Public subnet 1 CIDR PublicSubnet2CIDR: default: Public subnet 2 CIDR PublicSubnet3CIDR: default: Public subnet 3 CIDR QSS3BucketName: default: Quick Start S3 bucket name QSS3KeyPrefix: default: Quick Start S3 key prefix QSS3BucketRegion: default: Quick Start S3 bucket Region RemoteAccessCIDR: default: Allowed bastion external access CIDR VolumeSize: default: Volume size VolumeType: default: Volume type VPCCIDR: default: VPC CIDR Parameters: PrivateSubnet2CIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.32.0/19 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR block for private subnet 2, located in Availability Zone 2. PrivateSubnet3CIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.64.0/19 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR block for private subnet 3, located in Availability Zone 2. QSS3BucketName: AllowedPattern: '^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$' ConstraintDescription: The Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-). Default: aws-quickstart Description: Name of the S3 bucket for your copy of the Quick Start assets. Keep the default name unless you are customizing the template. Changing the name updates code references to point to a new Quick Start location. This name can include numbers, lowercase letters, uppercase letters, and hyphens, but do not start or end with a hyphen (-). See https://aws-quickstart.github.io/option1.html. Type: String PublicSubnet2CIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.144.0/20 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR block for public subnet 2, located in Availability Zone 2. PublicSubnet3CIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.160.0/20 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR Block for public subnet 3, located in Availability Zone 3. KeyPairName: Type: AWS::EC2::KeyPair::KeyName Description: Public/private key pairs to connect to your instance after deployment. PublicSubnet1CIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.128.0/20 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR Block for public subnet 1, located in Availability Zone 1. BastionAMIOS: AllowedValues: - Amazon-Linux2-HVM - CentOS-7-HVM - Ubuntu-Server-20.04-LTS-HVM - SUSE-SLES-15-HVM Default: Amazon-Linux2-HVM Description: The Linux distribution for the AMI to be used for the bastion host instances. Type: String RemoteAccessCIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$ Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/x Description: Allowed CIDR block for external SSH access to the bastion hosts. PrivateSubnet1CIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.0.0/19 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR block for private subnet 1, located in Availability Zone 1. BastionInstanceType: Default: t2.micro Type: String Description: Amazon EC2 instance type for the second bastion host instance. AllowedValues: - t2.nano - t2.micro - t2.small - t2.medium - t2.large - m4.large - m4.xlarge - m4.2xlarge - m4.4xlarge NumBastionHosts: AllowedValues: - '1' - '2' - '3' - '4' Default: '1' Description: Enter the number of bastion hosts to create. Type: String VPCCIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ Default: 10.0.0.0/16 Type: String ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR Block for the VPC QSS3KeyPrefix: AllowedPattern: '^[0-9a-zA-Z-/]*$' ConstraintDescription: The Quick Start S3 key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slashes (/). The prefix should end with a forward slash (/). Default: quickstart-apache-rocketmq/ Description: S3 key prefix that is used to simulate a directory for your copy of the Quick Start assets. Keep the default prefix unless you are customizing the template. Changing this prefix updates code references to point to a new Quick Start location. This prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slashes (/). End with a forward slash. See https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html and https://aws-quickstart.github.io/option1.html. Type: String QSS3BucketRegion: Default: 'us-east-1' Description: 'AWS Region where the Quick Start S3 bucket (QSS3BucketName) is hosted. Keep the default Region unless you are customizing the template. Changing this Region updates code references to point to a new Quick Start location. When using your own bucket, specify the Region. See https://aws-quickstart.github.io/option1.html.' Type: String AvailabilityZones: Type: List Description: Choose two or three Availability Zones to use for the VPC subnets. NumberOfAZs: AllowedValues: - '2' - '3' Description: Choose the number of Availability Zones to use in the VPC. This must match the number of AZs selected in the *Availability Zones* parameter. Type: String NameServerInstanceType: Default: m5.large Type: String Description: Amazon EC2 instance type for Apache RocketMQ NameServer nodes. AllowedValues: - m5.large - m5.xlarge - m5.2xlarge - m5.4xlarge - m5.12xlarge - m5.24xlarge - r5.large - r5.xlarge - r5.2xlarge - r5.4xlarge - r5.8xlarge - r5.12xlarge - r5.16xlarge - r5.24xlarge - c5.large - c5.xlarge - c5.2xlarge - c5.4xlarge - c5.9xlarge - c5.18xlarge - r4.large - r4.xlarge - r4.2xlarge - r4.4xlarge - r4.8xlarge - r4.16xlarge - i3.large - i3.xlarge - i3.2xlarge - i3.4xlarge - i3.8xlarge - i3.16xlarge - m4.large - m4.xlarge - m4.2xlarge - m4.4xlarge - m4.10xlarge BrokerNodeInstanceType: Default: m5.xlarge Type: String Description: Amazon EC2 instance type for Apache RocketMQ Broker nodes. AllowedValues: - m5.large - m5.xlarge - m5.2xlarge - m5.4xlarge - m5.12xlarge - m5.24xlarge - r5.large - r5.xlarge - r5.2xlarge - r5.4xlarge - r5.8xlarge - r5.12xlarge - r5.16xlarge - r5.24xlarge - c5.large - c5.xlarge - c5.2xlarge - c5.4xlarge - c5.9xlarge - c5.18xlarge - r4.large - r4.xlarge - r4.2xlarge - r4.4xlarge - r4.8xlarge - r4.16xlarge - i3.large - i3.xlarge - i3.2xlarge - i3.4xlarge - i3.8xlarge - i3.16xlarge - m4.large - m4.xlarge - m4.2xlarge - m4.4xlarge - m4.10xlarge VolumeSize: Default: '400' Type: String Description: Size of attached EBS volume, in GBs. VolumeType: Default: gp3 Type: String Description: Type of attached EBS volume (io1, gp2, or gp3). AllowedValues: - gp2 - gp3 - io1 RocketMQVersion: Default: 4.7.1 Type: String Description: Apache RocketMQ version. AllowedValues: - 4.7.1 - 4.8.0 - 4.9.2 NameServerClusterCount: Default: '2' Type: String Description: Number of Apache RocketMQ NameServer nodes (1–3). AllowedValues: - '1' - '2' - '3' BrokerClusterCount: Default: '3' Type: String Description: Number of replica set members (1 or 3). AllowedValues: - '1' - '3' FlushDiskType: Default: ASYNC_FLUSH Type: String Description: Apache RocketMQ flush disk type (ASYNC_FLUSH or SYNC_FLUSH). AllowedValues: - ASYNC_FLUSH - SYNC_FLUSH Iops: Default: '100' Type: String Description: IOPS of io1 EBS volume. Not applicable for EBS volume types gp2 and gp3. Conditions: CreateThreeReplicaSet: !Equals [!Ref 'BrokerClusterCount', '3'] RepeatSubnet: !Equals [!Ref 'NumberOfAZs', '2'] UsingDefaultBucket: !Equals [!Ref QSS3BucketName, 'aws-quickstart'] Resources: VPCStack: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - 'https://${S3Bucket}.s3.${S3Region}.${AWS::URLSuffix}/${QSS3KeyPrefix}submodules/quickstart-aws-vpc/templates/aws-vpc.template.yaml' - S3Region: !If [ UsingDefaultBucket, !Ref 'AWS::Region', !Ref QSS3BucketRegion ] S3Bucket: !If [ UsingDefaultBucket, !Sub '${QSS3BucketName}-${AWS::Region}', !Ref QSS3BucketName ] Parameters: AvailabilityZones: !Join - ',' - !Ref 'AvailabilityZones' KeyPairName: !Ref 'KeyPairName' NumberOfAZs: !Ref 'NumberOfAZs' PrivateSubnet1ACIDR: !Ref 'PrivateSubnet1CIDR' PrivateSubnet2ACIDR: !Ref 'PrivateSubnet2CIDR' PrivateSubnet3ACIDR: !Ref 'PrivateSubnet3CIDR' PublicSubnet1CIDR: !Ref 'PublicSubnet1CIDR' PublicSubnet2CIDR: !Ref 'PublicSubnet2CIDR' PublicSubnet3CIDR: !Ref 'PublicSubnet3CIDR' VPCCIDR: !Ref 'VPCCIDR' BastionStack: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - 'https://${S3Bucket}.s3.${S3Region}.${AWS::URLSuffix}/${QSS3KeyPrefix}submodules/quickstart-linux-bastion/templates/linux-bastion.template' - S3Region: !If [ UsingDefaultBucket, !Ref 'AWS::Region', !Ref QSS3BucketRegion ] S3Bucket: !If [ UsingDefaultBucket, !Sub '${QSS3BucketName}-${AWS::Region}', !Ref QSS3BucketName ] Parameters: BastionInstanceType: !Ref 'BastionInstanceType' NumBastionHosts: !Ref 'NumBastionHosts' BastionAMIOS: !Ref 'BastionAMIOS' EnableTCPForwarding: 'true' KeyPairName: !Ref 'KeyPairName' PublicSubnet1ID: !GetAtt 'VPCStack.Outputs.PublicSubnet1ID' PublicSubnet2ID: !GetAtt 'VPCStack.Outputs.PublicSubnet2ID' QSS3BucketName: !Ref 'QSS3BucketName' QSS3KeyPrefix: !Sub '${QSS3KeyPrefix}submodules/quickstart-linux-bastion/' QSS3BucketRegion: !Ref 'QSS3BucketRegion' RemoteAccessCIDR: !Ref 'RemoteAccessCIDR' VPCID: !GetAtt 'VPCStack.Outputs.VPCID' RocketMQStack: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - 'https://${S3Bucket}.s3.${S3Region}.${AWS::URLSuffix}/${QSS3KeyPrefix}templates/rocketmq.template.yaml' - S3Region: !If [ UsingDefaultBucket, !Ref 'AWS::Region', !Ref QSS3BucketRegion ] S3Bucket: !If [ UsingDefaultBucket, !Sub '${QSS3BucketName}-${AWS::Region}', !Ref QSS3BucketName ] Parameters: QSS3BucketName: !Ref 'QSS3BucketName' QSS3KeyPrefix: !Ref 'QSS3KeyPrefix' QSS3BucketRegion: !Ref 'QSS3BucketRegion' BastionSecurityGroupID: !GetAtt 'BastionStack.Outputs.BastionSecurityGroupID' NameServerClusterCount: !Ref 'NameServerClusterCount' BrokerClusterCount: !Ref 'BrokerClusterCount' FlushDiskType: !Ref 'FlushDiskType' Iops: !Ref 'Iops' KeyPairName: !Ref 'KeyPairName' NameServerInstanceType: !Ref 'NameServerInstanceType' RocketMQVersion: !Ref 'RocketMQVersion' BrokerNodeInstanceType: !Ref 'BrokerNodeInstanceType' PrimaryNodeSubnet: !GetAtt 'VPCStack.Outputs.PrivateSubnet1AID' Secondary0NodeSubnet: !GetAtt 'VPCStack.Outputs.PrivateSubnet2AID' Secondary1NodeSubnet: !If - RepeatSubnet - !GetAtt 'VPCStack.Outputs.PrivateSubnet2AID' - !GetAtt 'VPCStack.Outputs.PrivateSubnet3AID' VPC: !GetAtt 'VPCStack.Outputs.VPCID' VolumeSize: !Ref 'VolumeSize' VolumeType: !Ref 'VolumeType' Outputs: PrimaryReplicaNodeIp: Value: !GetAtt 'RocketMQStack.Outputs.PrimaryReplicaNodeIp' Description: Private IP address of primary replica node. SecondaryRocketMQBrokerNode0Ip: Value: !GetAtt 'RocketMQStack.Outputs.SecondaryRocketMQBrokerNode0Ip' Description: Private IP address of secondary replica node 0. Condition: CreateThreeReplicaSet SecondaryRocketMQBrokerNode1Ip: Value: !GetAtt 'RocketMQStack.Outputs.SecondaryRocketMQBrokerNode1Ip' Description: Private IP address of secondary replica node 1. Condition: CreateThreeReplicaSet RocketMQServerAccessSecurityGroup: Value: !GetAtt 'RocketMQStack.Outputs.RocketMQServerAccessSecurityGroup' Description: Apache RocketMQ access security group. Postdeployment: Description: See the deployment guide for post-deployment steps. Value: https://aws.amazon.com/quickstart/?quickstart-all.sort-by=item.additionalFields.sortDate&quickstart-all.sort-order=desc&awsm.page-quickstart-all=5