Import Templates

Lono provides a handy lono import command. The command:

  1. Downloads existing CloudFormation templates
  2. Imports it into the lono with the right structure
  3. Summarize the template’s required parameters and resources

It gives you quick sense of how to use the downloaded template. Let’s use a simple sample template from the AWS Samples documentation. The template creates an EC2 instance.

$ lono new infra
$ cd infra
# Import a starter template
$ lono import --name ec2
=> Imported CloudFormation template and lono-fied it.
Template definition added to app/definitions/base.rb
Params file created to config/params/base/ec2.txt
Template downloaded to app/templates/ec2.yml
=> CloudFormation Template Summary:
  KeyName (AWS::EC2::KeyPair::KeyName)
  InstanceType (String) Default: t2.small
  SSHLocation (String) Default:
  1 AWS::EC2::Instance
  1 AWS::EC2::SecurityGroup
  2 Total
Here are contents of the params config/params/base/ec2.txt file:
#InstanceType=        # optional
#SSHLocation=         # optional

We can see that this template has 1 required parameter called KeyName. Let’s set the parameter to a KeyName (assuming that the default KeyPair exists on your AWS account):

sed "s/KeyName=/KeyName=default/" config/params/base/ec2.txt > config/params/base/ec2.txt.1
mv config/params/base/ec2.txt{.1,}

Now we can launch the stack.

lono cfn create ec2 # launches stack

The lono import command gets you up and running with existing CloudFormation templates quickly.

Next, we’ll cover how to some different ways to lono.

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!