Blueprints

A blueprint is one of the core components of a Lono project. Blueprints are essentially CloudFormation templates packaged up in a convenient and reusable way. The CloudFormation code itself lives in the app/blueprints folder. This allows you to keep the code DRY. Example:

app/blueprints
├── demo
└── ec2

Additionally, blueprints can also be gems. Example:

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

Here’s an example demo blueprint structure:

app/blueprints/demo
├── app
│   ├── helpers
│   ├── templates
│   │   └── demo.rb
│   └── user_data
│       └── bootstrap.sh
├── demo.gemspec
└── seed
    └── configs.rb

Within the blueprint folder, lono uses the files under the app folder and your projects configs files to generate CloudFormation templates and launch stacks. The template is the component you’ll usually work mostly with, IE: app/templates/demo.rb.

Files and Folders Within Blueprint

File / Folders Description
app/helpers Define your custom helpers here. The custom helpers are made available to templates, variables, and params. Helpers are covered in detail in custom helpers.
app/templates Where CloudFromation templates are defined. Refer to the DSL docs for the syntax.
app/user_data Where user_data scripts live. You can include the user data script into your code with the user_data builtin helper
demo.gemspec Where the gem specs and dependencies are defined. Blueprints make use of gemspecs to handle dependencies.
seed/configs.rb Where a setup script can be defined to work with lono seed.

Hopefully, that gives you a basic idea of a lono blueprint structure.

Multiple Templates?

Templates belong to a blueprint. Another way of putting is that each blueprint can have many templates.

While it is possible to create multiple templates for a blueprint, it is generally recommended to create only one template for each blueprint. This allows you to take advantage of the Lono CLI naming conventions and keep your commands short and simple. You may find that it results in more focused blueprint code.

Blueprint Commands

To create a new blueprint you can use:

lono blueprint new myblueprint

This creates a app/blueprints/myblueprint folder in your lono project with a starter structure.

To list the project’s blueprints:

lono blueprints

Pro Blueprints

You can use the lono pro blueprints to also list the available Pro Blueprints.

lono pro blueprints

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!