For each blueprint and CloudFormation template, you will usually need to set up some configs. To help with this, Lono has a
lono seed command that generates starter configs values.
- The starter values for params are determined by the template definition itself.
- The starter values for variables are determined by the blueprint’s
seed/configs.rb, usually written by the author.
The general form is:
lono seed BLUEPRINT
Here’s an example using
$ lono seed ecs-asg Creating starter config files for ecs-asg Starter params created: configs/ecs-asg/params/development.txt $ cat configs/ecs-asg/params/development.txt # Required parameters: VpcId=vpc-111 Subnets=subnet-111,subnet-222,subnet-333 EcsCluster=development # Optional parameters: # InstanceType=m5.large # KeyName=... # SshLocation=... # TagName=ecs-asg $
configs/ecs-asg/params/development.txt file is conveniently generated for you. Depending on the blueprint, a
configs/ecs-asg/variables/development.rb will also be generated.
LONO_ENV will generate corresponding configs. For example,
LONO_ENV=production will generate
As mentioned, the parameter starter values are inferred from the template definition itself. Not only is the parameter list derived from the template, example values are also parsed from the Description attribute. Anything after the
Example: text will be used as the starter parameter value. Here’s an example:
parameter("Subnets", Description: "Subnets in the VPC. Example: subnet-111,subnet-222 # at least 2 subnets required")
The lono seed command will generate this:
Subnets=subnet-111,subnet-222 # at least 2 subnets required
The code self-documents the starter parameters!
The variables starter file is generated based on the
seed/configs.rb file in the blueprint. The general structure looks like this:
class Lono::Seed::Configs < Lono::Seed::Base # Template for variables def variables <<~EOL @variable1 = value1 @variable2 = value2 EOL end end
Remember to document how to use
lono seed in the README.md of your blueprint.
Pro tip: Use the <- and -> arrow keys to move back and forward.