| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The cfn-hup helper is a daemon that detects changes in resource metadata and runs user-specified actions when a change is detected. This allows you to make configuration updates on your running Amazon EC2 instances through the UpdateStack API action.
cfn-hup --config|-c config.dir \
--no-daemon \
--verbose|-v
| Name | Description | Required |
|---|---|---|
|
|
If Type: Boolean Default: |
Yes |
|
|
If Type: Boolean Default: |
No |
The cfn-hup.conf file stores the name of the stack and the AWS credentials that the cfn-hup daemon targets. The cfn-hup.conf file uses the following format:
[main]
stack=<stack-name-or-id> | Name | Description | Required |
|---|---|---|
|
|
A stack name or ID. Type: String. |
Yes |
|
|
An owner-only credential file, in the same format used for the command line tools. Example: Note cfn-hup does not require credentials, so you do not need to use the
|
Yes |
|
|
The name of the AWS region containing the stack. Example: |
No |
|
|
interval used to check for changes to the resource metadata in minutes Type: Number Default: |
No |
The user actions that the cfn-hup daemon calls periodically are defined in the hooks.conf configuration file. The hooks.conf file uses the following format:
[hookname] triggers=post.add|post.update|post.remove path=Resources.<logicalResourceId>(.Metadata|PhysicalResourceId)(.optionalMetadatapath) action=<arbitrary shell command>runas=<runas user>
When the action is run, it is run in a copy of the current environment (that cfn-hup is in), with CFN_OLD_METADATA set to the previous value of path, and CFN_NEW_METADATA set to the current value.
The hooks configuration file is loaded at cfn-hup daemon startup only, so new hooks will require the daemon to be restarted. A cache of previous metadata values is stored at /var/lib/cfn-hup/data/metadata_db (not human readable)—you can delete this cache to force cfn-hup to run all post.add actions again.
| Name | Description | Required |
|---|---|---|
|
|
A unique name for this hook Type: String. |
Yes |
|
|
A comma-delimited list of conditions to detect. Valid values: Example: |
Yes |
|
|
The path to the metadata object. Supports an arbitrarily deep path within the Metadata block. Path format options
|
Yes |
|
|
An arbitrary shell command that is run as given. |
Yes |
|
|
A user to run the commands as. Cfn-hup uses the su command to switch to the user. |
Yes |
To support composition of several applications deploying change notification hooks, cfn-hup supports a directory named hooks.d that is located in the hooks configuration directory. You can place one or more additional hooks configuration files in the hooks.d directory. The additional hooks files must use the same layout as the hooks.conf file.
The cfn-hup daemon parses and loads each file in this directory. If any hooks in the hooks.d directory have the same name as a hook in hooks.conf, the hooks will be merged (meaning hooks.d will overwrite hooks.conf for any values that both files specify).