Configure Configsets in the Blueprint

Blueprint can preconfigure configsets themselves. Blueprint specify configsets with configsets.rb. Example:

app/blueprints/ec2/configsets.rb:

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

This means the ec2 blueprint will be shipped to use the httpd configset to install and run the httpd server.

Configset Default Variables

Configsets specified within blueprints can also set default variables in their vars.rb file. Example:

app/blueprints/ec2/configsets/vars/httpd.rb:

@html = "default example html"

This can be overriden by the user at the project-level with config/blueprints/ec2/configsets/vars/httpd.rb. See: Project-Level Configset Variables.

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.

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

Note: On AmazonLinux2 cfn-init is already installed.