DRY: Reusable Code

Lono is designed to allow you to reuse CloudFormation templates. A key is the separation of configs and template code in a structured and organized way.

Configs

Here’s an example configs structure:

configs
├── ec2
│   └── params
│       ├── development.txt
│       └── production.txt
└── vpc
    └── params
        ├── development.txt
        └── production.txt

Notice how there are different development and production config files. This structure allows you to use different values for different environments for the same CloudFormation template. Learn more: Configs docs.

Blueprints

The CloudFormation code itself lives in the blueprints folder.

app/blueprints
├── ec2
└── vpc

Additionally, blueprints can also be gems. Example:

gem "ec2", git: "git@github.com:boltopspro/ec2"
gem "vpc", git: "git@github.com:boltopspro/vpc"

Interestingly, this means the blueprints folder could be empty. You can just use pre-built blueprint gems. BoltOps Pro blueprints are actually gems. All you have to do is configure them.

Learn more: Blueprint docs.

Summary

With this structure, it DRYs up your code by allowing you to reuse the same CloudFormation templates. You simply:

  1. Configure
  2. Deploy
  3. Run

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!