Continuously Generate CloudFormation Templates with Lono and Guard
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:
Thanks for reading this far. If you found this article useful, I'd really appreciate it if you share this article so others can find it too! Thanks 😁 Also follow me on Twitter.
Got questions? Check out BoltOps.
You might also like
More tools:
-
Kubes
Kubes: Kubernetes Deployment Tool
Kubes is a Kubernetes Deployment Tool. It builds the docker image, creates the Kubernetes YAML, and runs kubectl apply. It automates the deployment process and saves you precious finger-typing energy.
-
Jets
Jets: The Ruby Serverless Framework
Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.
-
Lono
Lono: The CloudFormation Framework
Building infrastructure-as-code is challenging. Lono makes it much easier and fun. It includes everything you need to manage and deploy infrastructure-as-code.