AWS CloudFormation and high availability with ArcGIS Server

You can use some features of Amazon Web Services (AWS) CloudFormation to achieve certain high availability benefits when working with ArcGIS Server on AWS.

Some background is necessary to understand the need for this approach. The typical way that people get started using ArcGIS Server on AWS is to use ArcGIS Server Cloud Builder. This is a simple wizard that helps you set up an ArcGIS Server site in the Amazon Elastic Compute Cloud (EC2). The output of the wizard is a site with potentially many machines that can distribute jobs among themselves and take full advantage of the peer-to-peer architecture found in ArcGIS Server 10.1 and 10.2. Cloud Builder also offers a framework for making site backups, in addition to templates that can be used to launch additional sites following an identical pattern.

The architecture created by Cloud Builder is pictured in the following diagram.

ArcGIS Server architecture launched by Cloud Builder

For all its benefits, the Cloud Builder-created site has a few drawbacks when it comes to high availability. If the GIS server instance running the configuration store is lost, the site will be unusable. Also, it can take 30 minutes or more to restore a backup, which could be an unacceptable amount of downtime for some organizations.

An alternative approach that avoids some of these issues is a siloed architecture, pictured below, wherein many identical but independent ArcGIS Server sites are connected under an elastic load balancer (ELB). This architecture was used exclusively with ArcGIS Server on AWS prior to version 10.1 and can still be used with 10.1 and 10.2 if you are willing to sacrifice ease of administration and the ability to distribute large jobs (such as cache tile building) across servers.

One of the main benefits of the siloed architecture is that it allows you to continue running ArcGIS Server even if you lose any GIS server instance.

Siloed ArcGIS Server architecture of the type that you can launch with CloudFormation

The siloed architecture cannot be built with Cloud Builder: you must create it manually using the AWS Management Console or APIs. However, some features of Amazon CloudFormation can help you launch and maintain the siloed architecture much more easily than could be accomplished in the past. CloudFormation ensures that you always maintain a minimum number of machines in your site, allowing for seamless recovery when one of your machines becomes unavailable.

The remainder of this topic explains how to set up a siloed architecture using CloudFormation.

Use CloudFormation to build the siloed architecture

Amazon CloudFormation is a service that helps you define architectures for the Amazon Web Services you use. It is an example of infrastructure as code; meaning you write code that can deploy a particular hardware infrastructure in a cloud environment. In the case of CloudFormation, you use a JavaScript object notation (JSON) template to define a stack of resources that work together in a predetermined way. In this case, the template defines your siloed ArcGIS Server sites and the Elastic Load Balancer that holds them together.

Copy and examine the templates

Steps:
  1. To get started, examine one of these example templates:
  2. Copy the template code to a text file and save it.
  3. Examine the JSON properties that are set and modify them as needed.

    There are a number of properties in the Parameters object that you can set when launching the stack, such as the number and types of instances participating in the site and the Amazon Machine Image (AMI) used. Other resources, such as the elastic load balancer (ELB) settings, are burned into the template and can only be changed by the template author.

    Note the auto scaling and CloudWatch alarm settings that define triggers for adding and removing machines from your site based on factors such as CPU usage. You can also define how many machines will be updated at once if you ever make changes to your AMI, allowing you to always maintain an available instance.

  4. In addition to the items found in this template, you can introduce an LBCookieStickinessPolicy on the ELB, which determines whether sticky sessions are enabled. These ensure that a user’s requests get directed to the same GIS server machine for the duration of his or her session. This can be helpful for working with long-running features like asynchronous geoprocessing jobs.
  5. You can also define the SSL certificate to be applied onto the stack. To do this, upload your certificate to AWS Identity and Access Management (IAM) and insert code into the template to specify the SSLCertificateId setting on the ELB.

Create the stack

Once you’ve selected a template, follow the steps below to launch a multiple machine ArcGIS Server site using the siloed architecture.

Steps:
  1. Use the AWS Management Console to launch an instance using one of the ArcGIS Server AMIs provided by Esri.
  2. License ArcGIS Server and create a site on the instance.
  3. Configure the instance with your services, data, and any third-party applications you want to install.
    CautionCaution:

    If you have any map services that will not use a cache, set the supportedImageReturnType property of the map service to MIME instead of URL (so the user is not routed back into the stack, and potentially the wrong instance, when trying to retrieve map images). You will need to edit the service properties in the ArcGIS Server Administrator Directory in order to adjust this setting; it is not available in Manager.

  4. Save an AMI from your instance. All instances created from this AMI will be the same. Each will be its own ArcGIS Server site with its own configuration store, server directories, and data.
  5. Once the AMI is created, take note of the AMI ID. This is needed to create the stack.
  6. In the AWS Management Console, click Services > CloudFormation to open the CloudFormation Stacks page.
  7. Click Create Stack.
  8. Provide a Stack Name.
  9. Choose Upload a Template File, browse to one of the template files you saved and modified above, and click Continue.
  10. Set the following properties for your stack:
    1. Change the AMI property to be the ID of your AMI that you created in step 3.
    2. Change the MaxSize to the maximum number of instances you want to have in your stack at one time.
    3. If you are using the VPC template, set the options for VPCId, Subnets, and AZs (Availability Zones) to correspond with your desired VPC environment settings.
    4. Adjust the InstanceType to reflect the size of instance you want.
    5. Modify the KeyName to be the name of one of your Amazon key pairs. Do not include the .pem extension.
    6. Change the MinSize to the minimum number of instances you want in your stack at one time. If you keep this value at 2 or more, you protect yourself against loss of your site if a machine becomes unavailable. CloudFormation will immediately create a second instance if only one is found.
  11. Click Continue.
  12. Add tags to easily identify your instance, such as Key = Name and Value = MyCloudFormation, and click Continue.
  13. Examine all your parameters and click Continue when you’re ready to create your stack.

Your stack will be launched. After a short period of time, ArcGIS Server will be accessible through the following URL format: http://<Elastic Load Balancer address>/arcgis/rest.

12/10/2013