Managed Services

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

Purpose:

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

Perquisites:

  • AEM Jar files
  • Dispatcher configuration file

Process:

  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.

                   SelectAvailabilityZones:

                    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.

                     Disp2:

                             Type: “AWS::EC2::Instance”

                             Condition: Disp2

                            Properties:

                                 ImageId: ami-e689729e

                                  InstanceType:

                                        Ref: InstanceType

                                 AvailabilityZone:

                                    Fn::Select:

                                        – ‘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.

                            Author:

                                  Type: AWS::EC2::Instance

                                   Metadata:

                                        AWS::CloudFormation::Init:

                                             configSets:

                                                 InstallAndRun:

                                                 -InstallAuthor

                                                 InstallAem:

                                                   packages:

                                                      yum: {}

                                                  sources:

                                                       “<AEM Install Location>”:

                                                             Ref: AEMDownloadUrl

                                                      commands:

                                                         001_mkdir_author:

                                                             command: mkdir author

                                                             cwd: “<AEMInstallLocation>”

                                                          002_copy_author:

                                                              command: cp AEM_6.3_Quickstart.jar license.properties author

                                                              cwd: “<AEMInstallLocation>”

                                                          003_author_unpack:

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

                                                              cwd: “<AEMInstallLocation>”

                                            Run:

                                                commands:

                                                      001_start_author:

                                                           command: “./start”

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

Observations:

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

About The Author

Leave a Reply

*