Project Configsets

Project configsets are added by you to your lono project. There are different ways to create or add a configset.

  1. PROJECT/app/configsets - your custom configsets
  2. PROJECT/vendor/configsets - third party vendorized configsets
  3. PROJECT/Gemfile - third party configsets as gems

A quick way create a project configset is with the lono configset new command. It will generate a skeleton configset structure in app/configsets.

$ lono configset new httpd
=> Creating new configset called httpd.
      create  app/configsets/httpd
      create  app/configsets/httpd/httpd.gemspec
      create  app/configsets/httpd/.gitignore
      create  app/configsets/httpd/.rspec
      create  app/configsets/httpd/Gemfile
      create  app/configsets/httpd/README.md
      create  app/configsets/httpd/Rakefile
      create  app/configsets/httpd/lib/configset.yml
$

The vendor/configsets location provides a way to vendorize third party configsets.

Finally, the Gemfile allows you to use configsets as gems. Example:

gem "httpd", "git@github.com:boltopspro/httpd" # use httpd configset

After adding configset, it is available to be used in any template. You can list available configsets with the lono configsets command.

$ lono configsets
Available configsets:
+-------+----------------------+---------+
| Name  |         Path         |  Type   |
+-------+----------------------+---------+
| httpd | app/configsets/httpd | project |
+-------+----------------------+---------+
$

To use the configset in a template, add them to a configs file. Example:

configs/ec2/configsets/base.rb:

configset("httpd", resource: "Instance")

UserData cfn-init

You can make sure configsets are applied by calling the cfn-init script in the UserData script. The UserData script runs when EC2 instances are launched. Here’s an example UserData script.

#!/bin/bash
yum install -y aws-cfn-bootstrap # install cfn-init
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource Instance --region ${AWS::Region}

The ${AWS::StackName} and ${AWS::Region} will be substituted for their actual values at CloudFormation runtime. The --resource Instance specifies which resource to add the configsets to.

Note: On AmazonLinux2 cfn-init is already installed.

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!