Slide 1

Slide 1 text

Build infrastructure with CloudFormation & keep your sanity. SparkleFormation Sean Porter Heavy Water Operations

Slide 2

Slide 2 text

Who am I? Sean Porter - @PorterTech Author of Sensu, the monitoring framework. github.com/portertech Work at Heavy Water Operations.

Slide 3

Slide 3 text

What is CloudFormation? ● Amazon AWS service ● Provides an easy way to create AWS resources ● Provisions resources in an orderly and predictable fashion ● Uses JSON templates to describe AWS resources

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

528 lines of JSON

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

What are we working with? ● Data - HASHES! ● We can build HASHES programmatically! ● Just need enough DSL ○ compile & merge ○ functions

Slide 8

Slide 8 text

SparkleFormation ● Ruby DSL ● Provides AWS intrinsic functions ● Automatically compatible with future AWS resources ● Small implementation ○ Using AttributeStruct by Chris Roberts (@_spox) github.com/sparkleformation

Slide 9

Slide 9 text

Template Anatomy ● Parameters ○ RabbitMQ nodes: x (prompt) ● Resources ○ type: AWS::AutoScaling::LaunchConfiguration ● Mappings ○ key/value pairs referenced at runtime ● Outputs

Slide 10

Slide 10 text

Functions ● Ref ○ Reference parameter & resource values ○ eg. min_size ref!(:rabbitmq_nodes) ● Attr ○ Retrieve certain resources attributes directly ○ eg. attr!(:cfn_user, :secret_access_key) ● Join ○ eg. join!(ref!(:environment), '-', map!(:region_map, ref!('AWS::Region'), :ami))

Slide 11

Slide 11 text

Building Blocks ● Components ○ static, reusable configuration ● Dynamics ○ arguments -> create unique resources ○ eg. dynamic(:elb) do |_name, _config={}| ● Registries

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Documentation sparkleformation.github.io/sparkle_formation docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide **Resource Types Reference** LaunchConfigurationName -> launch_configuration_name

Slide 16

Slide 16 text

Tooling ● SparkleFormation is just a library ● knife-cloudformation ○ Chef knife plugin (but no reliance on Chef) ○ Builds CF templates from SparkleFormations ○ Provides deep inspection into stacks ○ github.com/heavywater/knife-cloudformation

Slide 17

Slide 17 text

$ knife cloudformation create sensu-42 --file \ templates/sensu_enterprise.rb --processing

Slide 18

Slide 18 text

What does it do? ● Prompts for auto-scaling group node counts ○ RabbitMQ, Redis, Sensu Enterprise, Uchiwa ● Creates and uploads a CloudFormation template ● Provisions auto-scaling groups, using Chef, in the defined order ○ Bootstrap orchestration anyone?

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Sean Porter Heavy Water Operations Thank you!