AWSTemplateFormatVersion: '2010-09-09' Description: (SO8006) - Deploy Apache RocketMQ Cluster on a existing VPC in AWS. (qs-1rj78pfc2) Metadata: QuickStartDocumentation: EntrypointName: Launch into an existing VPC Order: "5" QSLint: Exclusions: [ W9002, W9003, W9004, W9006 ] cfn-lint: config: ignore_checks: - E9101 AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Network Configuration Parameters: - NumberOfAZs - VPCID - PrivateSubnet1ID - PrivateSubnet2ID - PrivateSubnet3ID - PublicSubnet1ID - PublicSubnet2ID - PublicSubnet3ID - RemoteAccessCIDR - Label: default: Security Configuration Parameters: - KeyPairName - Label: default: Linux Bastion Amazon EC2 Configuration Parameters: - BastionAMIOS - BastionInstanceType - NumBastionHosts - Label: default: RocketMQ Cluster Configuration Parameters: - NameServerClusterCount - BrokerClusterCount - Iops - RocketMQVersion - NameServerInstanceType - BrokerNodeInstanceType - FlushDiskType - VolumeSize - VolumeType - Label: default: AWS Quick Start Configuration Parameters: - QSS3BucketName - QSS3KeyPrefix - QSS3BucketRegion ParameterLabels: 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: Apache RocketMQ Version NameServerInstanceType: default: NameServer instance type BrokerNodeInstanceType: default: Broker node instance type FlushDiskType: default: Apache RocketMQ flush disk type NumberOfAZs: default: Number of Availability Zones PublicSubnet1ID: default: Public subnet 1 ID PublicSubnet2ID: default: Public subnet 2 ID PublicSubnet3ID: default: Public subnet 3 ID PrivateSubnet1ID: default: Private subnet 1 ID PrivateSubnet2ID: default: Private subnet 2 ID PrivateSubnet3ID: default: Private subnet 3 ID 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 VPCID: default: VPC ID Parameters: PublicSubnet1ID: Type: String Description: ID of the public subnet in Availability Zone 1 of your existing VPC (e.g., subnet-a0246dcd). Default: "" PublicSubnet2ID: Type: String Description: ID of the public subnet in Availability Zone 2 of your existing VPC (e.g., subnet-b1236eea). Default: "" PublicSubnet3ID: Type: String Description: ID of the public subnet in Availability Zone 3 of your existing VPC (e.g., subnet-c3456aba). Default: "" PrivateSubnet1ID: Type: "AWS::EC2::Subnet::Id" Description: ID of the private subnet in Availability Zone 1 of your existing VPC (e.g., subnet-fe9a8b32). PrivateSubnet2ID: Type: String Description: ID of the private subnet in Availability Zone 2 of your existing VPC (e.g., subnet-be8b01ea). Default: "" PrivateSubnet3ID: Type: String Description: ID of the private subnet in Availability Zone 3 of your existing VPC (e.g., subnet-abd39039). Default: "" 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 KeyPairName: Type: AWS::EC2::KeyPair::KeyName Description: Public/private key pairs to connect to your instance after deployment. 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 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 bastions 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 VPCID: Type: "AWS::EC2::VPC::Id" Description: ID of your existing VPC (e.g., vpc-0343606e). QSS3KeyPrefix: AllowedPattern: '^[0-9a-zA-Z-/]*$' Type: String 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. 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 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: 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: !Ref PublicSubnet1ID PublicSubnet2ID: !Ref PublicSubnet2ID QSS3BucketName: !Ref 'QSS3BucketName' QSS3KeyPrefix: !Sub '${QSS3KeyPrefix}submodules/quickstart-linux-bastion/' QSS3BucketRegion: !Ref 'QSS3BucketRegion' RemoteAccessCIDR: !Ref 'RemoteAccessCIDR' VPCID: !Ref 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: !Ref PrivateSubnet1ID Secondary0NodeSubnet: !Ref PrivateSubnet2ID Secondary1NodeSubnet: !If - RepeatSubnet - !Ref PrivateSubnet2ID - !Ref PrivateSubnet3ID VPC: !Ref 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