Tutorial EC2: Project Structure

They lono new command set up a lono project structure to help you know where things go. For a brand new project, most of the folders are still empty.

$ tree autoscaling
├── app
│   ├── definitions
│   │   └── base.rb
│   ├── helpers
│   ├── partials
│   ├── scripts
│   ├── templates
│   └── user_data
├── config
│   ├── params
│   ├── settings.yml
│   └── variables
└── output

Here’s an overview of the directory structure and the purpose of each folder:

Folders Overview

File / Directory Description
app/definitions Here’s where you define or declare your template definitions. It tells lono what templates to generate to the output folder. You can specify the template output name and the source template to use here. The templates are automatically layered together based on LONO_ENV. The template blocks are covered in more detail in templates configuration.
app/helpers Define your custom helpers here. The custom helpers are made available to app/definitions, app/templates, and config/parameters. Helpers are covered in detail in custom helpers.
app/partials Where templates partials go. You can split up the CloudFormation templates into erb partials. Include them with the partial helper, covered in built-in helpers
app/scripts Where your custom scripts go. Scripts in this folder get uploaded to s3 as a tarball during the lono cfn create or lono cfn update command. Details are in the App Scripts docs
app/user_data Where you place your scripts meant to be used for user-data. Include them in your templates with the user_data helper method.
config/params Where you specific your run-time parameters for the CloudFormation stacks. Params files have access to shared variables and helpers also. The params are automatically layered together based on LONO_ENV. The params are covered in more detail in params.
config/variables This is where your shared variables that made are available app/definitions, app/templates, and config/parameters are defined. The variables are automatically layered together based on LONO_ENV. The variables are covered in more detail in shared variables.
output This is where the generated files like CloudFormation templates and parameter files are written to. These files can be used with the raw aws cloudformation CLI commands. The templates are covered in more detail in template definitions.

That hopefully gives you a basic idea for the lono directory structure.

The Folders Overview above might be a little bit much if is your first time looking at the full lono project structure. A new project has most of the folders empty though. They are only needed if you use them. In the next section, we’ll start to fill out some of the folders by importing an EC2 template.

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!