Managed Services

Multiple Author,Publish and Dispatcher In Multi Availability Zones in Single region in AWS


Create Multiple publish and dispatcher Instances in Multi Availability Zones in Single region using Amazon Cloud Formation Template.


  • AEM Jar files
  • Dispatcher configuration file


  1. Zip the AEM installation Jar and license properties files in S3 bucket for AEM installation. And keep dispatcher module and installation files in S3 location and give required permissions.
  2. Following is the form created using AWS Cloud formation template. Where user need to select the options of No of AZ’s, Select AZ’s and No of Publish instances and No of Dispatcher instances per availability zones.

3. We can achieve the following solutions based selecting following options in above form.

  • Availability Zones : Select the How many AZ’s you want.
  • Select AZ: Select the Availability Zones where you want create Instances.
  • Secondary Author: Select Yes for Secondary author.
  • No Of Publish Instances per Availability Zone: Select how many publish instances you need for per AZ.
  • No Of Dispatcher Instances per Availability Zone: Select how many Dispatcher instances you need for per AZ.
Availability Zones No Of Authors No Of Publishers Per AZ No Of Dispatchers Per AZ Total Servers
1 1 1 1 3
1 2 4
1 3 5
2 2 5
2 3 6
2 1 1 1 5
1 2 7
1 3 9
2 2 9
2 3 11
2 2 1 1 6
1 2 8
1 3 10
2 2 10
2 3 12

4. We can select availability zone by using following parameter in CFT.


                    Description: Select Availability AvailabilityZones

                     Type: List<AWS::EC2::AvailabilityZone::Name>

5. AWS CFT doesn’t support any dynamic scripting or any loops, to achieve above solution we need to use Functions and Condition. We have created following functions and conditions to create instances.

                       AZ: !Or

                              – !Equals [!Ref NoOfAvailabilityZones, 1]

                              – !Equals [!Ref NoOfAvailabilityZones, 2]

                       Publish2: !And

                               – !Condition AZ

                                – !Equals [!Ref NoOfPublishInstances, 2]

                      Disp2: !And

                                – !Condition AZ

                                – !Not [!Equals [!Ref NoOfDispatchers, 1]]

6. Created instances based on the above conditions.


                             Type: “AWS::EC2::Instance”

                             Condition: Disp2


                                 ImageId: ami-e689729e


                                        Ref: InstanceType



                                        – ‘0’

                                        – Ref: SelectAvailabilityZones

7. And to install AEM we are using AWS::CloudFormation::Init AWS resource type. Following is the snippet shows how                 we can install AEM in ec2 instance.


                                  Type: AWS::EC2::Instance








                                                      yum: {}


                                                       “<AEM Install Location>”:

                                                             Ref: AEMDownloadUrl



                                                             command: mkdir author

                                                             cwd: “<AEMInstallLocation>”


                                                              command: cp AEM_6.3_Quickstart.jar author

                                                              cwd: “<AEMInstallLocation>”


                                                              command: java -jar AEM_6.3_Quickstart.jar -unpack

                                                              cwd: “<AEMInstallLocation>”




                                                           command: “./start”

                                                          cwd: “<AEMInstallLocation>/crx-quickstart/bin/”


Best practice is to create VPC, Subnets and Security Groups and Network ACL’s for Better security.

About The Author

Leave a Reply