Permalink
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (48 sloc) 1.71 KB
title
Params

Lono provides a way to specify your runtime CloudFormation launch parameters in a simple key=value format commonly found in env files. This format is less prone to human error than the AWS verbose parameter file format. When lono generate is ran it processes the files in params folders and outputs the AWS JSON format file in output/params folder. Here's an example:

params/base/example.txt:

KeyName=default
InstanceType=t2.micro

This results in:

[
  {
    "ParameterKey": "InstanceType",
    "ParameterValue": "t2.micro"
  },
  {
    "ParameterKey": "KeyName",
    "ParameterValue": "default"
  }
]

These files can be used to launch the CloudFormation stack with the aws cloudformation CLI tool manually if you like. Though the lono cfn lifecycle commands handle this automatically for you. For example, running lono cfn create [STACK_NAME] will automatically generate the param files and use it when launching the stack.

Shared Variables Substitution

Shared variables substitution is supported in params file. Here's an example:

config/variables/base.rb:

@ami = "ami-12345"

params/base/mystack.txt:

Ami=<%= @ami %>

Will produce:

output/params/mystack.json:

[
  {
    "ParameterKey": "Ami",
    "ParameterValue": "ami-12345"
  }
]

Layering Support

Lono param files also support layering which is covered in [Layering Support]({% link _docs/layering.md %}).

Back Next Step

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