Kumogata2
CloudFormationWrite and deploy CloudFormation templates in a Ruby DSL
- Manages
- AWS CloudFormation
- Language
- Ruby
- Package
- kumogata2
- CLI
- kumogata2
- Config file
- template.rb
AWSTemplateFormatVersion "2010-09-09"
Parameters do
InstanceType do
Default "t1.micro"
Description "Instance Type"
Type "String"
end
end
Resources do
myEC2Instance do
Type "AWS::EC2::Instance"
Properties do
ImageId "ami-XXXXXXXX"
InstanceType { Ref "InstanceType" }
KeyName "your_key_name"
end
end
end
Kumogata2 is a command-line tool that writes AWS CloudFormation templates in a Ruby DSL instead of JSON or YAML. It converts between formats, diffs templates logically, and previews updates as CloudFormation change sets before deploying stacks.
What is Kumogata2?
Kumogata2 is a tool for AWS CloudFormation. It lets you write templates in a short Ruby DSL instead of raw JSON or YAML. It is the successor to the original Kumogata, rebuilt on aws-sdk v2 with a plugin system for template formats.
The pain it removes is verbosity. Hand-written CloudFormation JSON is long and easy to get wrong. Kumogata2 keeps the same structure, Parameters, Resources, and Outputs, but with far less noise. You also get real loops and variables when you need them. Unlike most of the codenization family, it drives everything through CloudFormation itself, not the service APIs.
Two commands make it stand out:
- convert translates between Ruby, JSON, and YAML
- diff compares templates logically, even against a running stack via
stack://URLs
It fits Ruby-minded teams committed to CloudFormation who want cleaner templates and safer deploys through change sets. It pairs well with API-level tools like Roadworker for DNS.
- Writes AWS CloudFormation templates in a compact Ruby DSL.
- The template file is usually named template.rb.
- convert moves templates between Ruby, JSON, and YAML.
- Dry-run builds a real change set, the most trustworthy preview for stacks.
- diff can compare your file against a live stack over stack:// URLs.
- Archived since 2018; weigh CDK or Terraform for new work.
Install and run Kumogata2
Install
Install the kumogata2 gem (Ruby required).
$ gem install kumogata2Export current state
Pull the live CloudFormation configuration into a template.rb.
$ kumogata2 export my-stackDry-run, then apply
Preview the diff, then apply the change for real.
$ kumogata2 dry-run template.rb my-stackKumogata2 adapts the export, review, apply loop to CloudFormation's stack model. For an existing stack, run kumogata2 export to pull down its template. Convert it to the Ruby DSL with kumogata2 convert, then commit the result, for example as template.rb, to Git.
Changes are edits to the template in a branch. Check syntax with kumogata2 validate, then run kumogata2 dry-run. That creates a CloudFormation change set and prints it without executing, so you see which resources would be added, changed, or replaced. You can also run kumogata2 diff against a stack:// URL to compare with the live template. Once reviewed, kumogata2 update applies it, or deploy runs a full change set end to end.
Always run kumogata2 dry-run before an update. It builds a real change set, so you can spot a property change that would replace a database while there is still time to stop.
What Kumogata2 can do
Ruby DSL for CloudFormation
Templates keep CloudFormation's exact structure: Parameters, Resources, Outputs, and Ref. They just read as Ruby blocks, with the full language available for loops and reuse.
Change-set dry-run
kumogata2 dry-run creates a change set and shows it without executing. You see which resources would be added, changed, or replaced before an update.
Logical template diff
kumogata2 diff compares templates by meaning, not text. It accepts files, http:// URLs, or stack:// references, so you can diff your file against the live stack.
Format conversion
kumogata2 convert translates between the Ruby DSL, JSON, and YAML. Adopting the DSL for an existing stack, or leaving it later, is one command.
Full stack lifecycle
Subcommands cover create, update, deploy, delete, validate, export, and list. show-events, show-outputs, and show-resources handle inspection.
Plugin architecture
Template format handling is pluggable. New input formats can be added through gems, without changing the core tool.
| Command | What it does |
|---|---|
convert | Translate a template between Ruby, JSON, and YAML |
diff | Compare two templates logically, including stack:// |
validate | Check template syntax before a change set |
deploy | Create and execute a change set in one step |
show-events | Watch stack events as an update runs |
When teams reach for Kumogata2
Taming verbose CloudFormation JSON
Teams with thousands of lines of JSON convert them once and maintain the Ruby DSL instead. The structure stays identical, so CloudFormation knowledge carries over, but reviews get much shorter.
Safer stack updates with change sets
Resource replacement is CloudFormation's sharpest edge. An innocent property change can recreate a database. Running dry-run before every update surfaces replacements while there is still time to reconsider.
Auditing drift between template and stack
With diff's stack:// support, you compare the template in Git against what a stack is really running. That answers 'did someone update this outside the repo?' in one command.
Generating repetitive resources
Because templates are Ruby, a fleet of similar resources can be built with a loop instead of copy-paste. The output is still plain CloudFormation underneath.