SparklePack - Jackal CFN

This is a SparkleFormation SparklePack for jackal-cfn. It provides integrations for the custom resources provided by the jackal-cfn library as well as templates for worker setup and example usage.

Integrations

Dynamics

This SparklePack provides dynamics for custom resources provided by jackal-cfn:

  • :ami_manager
  • :ami_register
  • :hash_extractor
  • :jackal_stack
  • :orchestration_unit

It also provides a customized :jackal_image dynamic which will create the resource as well as an output of the newly created AMI ID.

Templates

This SparklePack includes 3 templates:

  1. jackal_cfn - Creates a working processor to handle requests
  2. jackal_bus - Creates only the required message bus resources
  3. jackal_usage_example - Example template to display usage of the OrchestrationUnit resource

NOTE: The jackal_cfn template only supports the follow regions:

  • ap-northeast-1
  • ap-southeast-1
  • ap-southeast-2
  • cn-north-1
  • eu-central-1
  • eu-west-1
  • sa-east-1
  • us-east-1
  • us-west-1
  • us-west-2
  • us-gov-west-1

Usage

NOTE: Assumes a working sfn setup. (see: Getting started guide)

Setup

First, include the SparklePack into the bundle by adding this line to the ./Gemfile:

gem 'sparkle-pack-jackal-cfn'

Next, update the local bundle:

$ bundle update

Now enable the SparklePack within the .sfn configuration file:

Configuration.new do
  ...
  sparkle_pack 'sparkle-pack-jackal-cfn'
  ...
end

Build a jackal-cfn processor

To use the jackal-cfn resources, a processor instance must be available. The SparklePack provides a template to build a processor stack. This stack will build a single EC2 instance which will be used as the base for an on demand autoscaling group. To create the stack:

$ bundle exec sfn create STACK_NAME_PROCESSOR --file jackal_cfn

Using the jackal-cfn processor

This SparklePack includes an example template that uses the OrchestrationUnit resource to read the contents of a file on the running processor instance. The contents of the file is a JSON serialized Hash that includes the ID of the current stack. The example stack will return the full result as well as the specific "OriginStack" value in the outputs:

$ bundle exec sfn create STACK_NAME_EXAMPLE --file jackal_usage_example --apply-stack STACK_NAME_PROCESSOR

All in one

The templates in this SparklePack support nesting. To create a single stack that includes the jackal_cfn template and the jackal_usage_example template, create a new local template:

# ./sparkleformation/full_jackal.rb

SparkleFormation.new(:full_jackal) do
  nest!(:jackal_cfn)
  nest!(:jackal_usage_example)
end

And create the nested stacks:

$ bundle exec sfn create STACK_NAME_ALL --file full_stack

Info