Blossom Logo Deploy your apps with Heroku-like simplicity using Blossom See Your Savings
BoltOps Logo
Continuously Generate CloudFormation Templates with Lono and Guard header image

Continuously Generate CloudFormation Templates with Lono and Guard

Tung Nguyen Tung Nguyen · May 12, 2017 · 2 min read

When using lono if you sometimes forgot to regenerate the templates after making changes you can use lono with guard to never have to remember again.

Setup lono and guard

If you have created a lono project with the lono new command then the Guardfile should have already been set up for you. Then all you have to do is run:

bundle exec guard

If you manually set up the lono project, then you can have to install the gem and setup the Guardfile. Add guard-lono to your Gemfile and run bundle. Then set up the Guardfile by running the following.

guard init lono
bundle exec guard

Watching lono and guard

Once guard is running you should see something like this:

$ bundle exec guard
[1] guard(main)>

As you edit and save any files in the templates or config folders, the lono generate command will automatically run 😊 Here’s what it looks like after I’ve saved some files twice:

$ bundle exec guard
[1] guard(main)>
Generating both CloudFormation template and parameter files.
Generating CloudFormation templates:
  output/single-instance.yml
  output/instance-and-route53.yml
  output/asg.yml
Generating params files
Params file generated for asg at output/params/stag/asg.json
Params file generated for instance-and-route53 at output/params/stag/instance-and-route53.json
Params file generated for single-instance at output/params/stag/single-instance.json
14:13:02 - INFO - Guard is now watching at '/Users/tung/src/tongueroo/cloudformation-examples-lono'
[1] guard(main)>

Hope this was helpful! If you enjoyed this post, you also might like these:

Blossom Logo
Deploy Your Apps with Ease

Blossom lets you deploy to your own servers with Heroku-like simplicity. Connect any cloud provider and we'll handle the rest. Save time and money with Blossom.

BoltOps Blog
Join a group of good-looking folks who get free email updates from BoltOps.