Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 2.78 KB

README.md

File metadata and controls

47 lines (27 loc) · 2.78 KB

cfn-hup configset

CodeBuild

BoltOps Badge

Why?

Configsets are essentially configuration management. Use configsets to configure and update your EC2 instances automatically. Lono allows you to use configsets in a reusable way.

Configsets work with AWS::CloudFormation::Init and cfn-init. Configsets do not magically get applied after being added to the CloudFormation template though. The cfn-init script must be called to apply the configset.

Usually the cfn-init script is called in the UserData script. This ensures configsets are applied when instances are launched.

Additionally, the cfn-hup script can be set up to apply configsets continuously.

This configset configures and runs the cfn-hup daemon. The cfn-auto-reloader.conf is configured to detect changes every 1 minute. When the stack Metatdata AWS::CloudFormation::Init changes, cfn-hup detects this and updates the EC2 instance. This ensures that the EC2 instance will always be up-to-date.

The cfn-hup configset should usually be one of the first things to be setup.

What are lono configsets?

Lono configsets allow CloudFormation cfn-init configsets that are typically embedded in the template to be reusable. More info: Lono Configsets docs.

Usage

Use configset to enable the configset for the blueprint. Example:

configs/demo/configsets/base.rb:

configset("cfn-hup", resource: "Instance")

This adds the configset to the resource with the logical id Instance in your CloudFormation template. The configset is added to the Resources[].Metadata.AWS::CloudFormation::Init attribute of the Instance resource.

Here's an example adding to a LaunchConfig resource:

configset("cfn-hup", resource: "LaunchConfig")

Here's an example adding to a LaunchTemplate resource:

configset("cfn-hup", resource: "LaunchTemplate")