Configure Configsets at the Project-Level

Project configsets can be added at the lono project-level.

Specifying Configsets

Here’s how you specify which configsets you want a blueprint to use. Example:


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

This configuration tells Lono to add the http configset code to the compiled template in output/ec2/template.yml. Notice, how you do not have to edit the app/blueprints/ec2/template.rb code. This is why the configset is reusable, you can selectively control which configset you want Lono to add to the blueprint’s template.

Configset Variables

If the configset has configurable variables, you can configure them like so:


@html = "some example html"

UserData cfn-init

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

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 logical id in the CloudFormation template that has the metadata with configset instructions to apply.

Note: On AmazonLinux2 cfn-init is already installed.