AWS cfn-hup 配置中的 post.add vs post.update vs post.delete [英] post.add vs post.update vs post.delete in AWS cfn-hup Configuration

查看:23
本文介绍了AWS cfn-hup 配置中的 post.add vs post.update vs post.delete的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 针对 CloudFormation cfn-hup 帮助程序脚本的 AWS 文档,cfn-hup 挂钩可以具有要检测的逗号分隔条件列表".这些条件/触发器可以是 post.addpost.update 和/或 post.delete.但是,没有描述这些触发器的实际含义.AWS 文档中的每个示例都只使用 post.update,到目前为止,这个触发器对我来说已经足够好了,但我想了解这些其他触发器的实际用途.有人可以对此有所了解吗?

According to the AWS Documentation for the CloudFormation cfn-hup helper script, a cfn-hup hook can have "A comma-delimited list of conditions to detect." These conditions/triggers can be post.add, post.update, and/or post.delete. However, there is no description of what these triggers actually mean. Every example throughout the AWS docs just uses post.update, and so far this trigger has been good enough for me, but I'd like to understand what these other triggers are actually used for. Could someone please shed some light on this?

推荐答案

post.add、post.update 和/或 post.delete 是 cfn-hup 中使用的触发器

post.add, post.update, and/or post.delete are trigger used in cfn-hup

简单的词:这些是在 cfn 堆栈模板中寻找变化的触发点,并基于触发器执行一些操作.

Simple words : These are the trigger point looking for changes in the cfn stack template and based on the trigger some action to be performed.

更多详情:

cfn-hup 助手是一个守护进程,它检测资源元数据的变化并在检测到变化时运行用户指定的操作

The cfn-hup helper is a daemon that detects changes in resource metadata and runs user-specified actions when a change is detected

此助手支持 2 个文件:

This helper is supported with 2 files :

/etc/cfn/cfn-hup.conf
/etc/cfn/hooks.d/cfn-auto-reloader.conf

/etc/cfn/cfn-hup.conf
/etc/cfn/hooks.d/cfn-auto-reloader.conf

/etc/cfn/cfn-hup.conf

这包含与 cfn-hup 相关的配置,包括要监控的堆栈名称和监控频率等详细信息.

This contains the configurtaion related to cfn-hup with details including stack name to monitor and how frequent it should monitor.

例如:

    [main]
    stack=Test-Cfn-Stack-Name
    region=${AWS::Region}
    interval=1   ### every one minute it will monitor the stack for changes 
    verbose=true

在这个例子中,cfn-hup 守护进程将每 1 分钟从 ec2 实例监控 cfn 堆栈.此活动的日志位于/var/log/cfn-hup.log.如果检测到任何更改/etc/cfn/hooks.d/cfn-auto-reloader.conf"将在这里控制下一步行动.

In this example, cfn-hup daemon will monitor the cfn stack from the ec2 instance every 1 min. The logs of this activity are located in /var/log/cfn-hup.log. If any changes are detected "/etc/cfn/hooks.d/cfn-auto-reloader.conf" will take control here for next actions.

/etc/cfn/hooks.d/cfn-auto-reloader.conf

在此文件中,它包含有关应在上述 cfn 堆栈中监控哪个资源的信息,如果在资源元数据中检测到任何更改(如添加、删除或更新),则执行操作字段中提到的操作.

In this file it has information about which resource should be monitored in the above mentioned cfn stack and if any changes are detected in the resource metadata like addition, deletion or update then perform the action mentioned in the actions filed.

例如:

[cfn-auto-reloader-hook]
triggers=post.add,post.update
ath=Resources.LaunchConfig.Metadata.AWS::CloudFormation::Init
action=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfig --configsets wordpress_install --region ${AWS::Region}
runas=root

在这个例子中,cfn-hup 守护进程会向这个文件发送触发器,说 cfn 堆栈已经更新了模板,该模板修改了 LaunchConfig 资源的元数据,所以请运行 action 字段中提到的命令.

In this example, cfn-hup daemon will send the trigger to this file saying that cfn stack was updated with the template which modifications in the LaunchConfig resource`s metadata, so please run the command mentioned in the action field.

action feild 中的这个命令将在 ec2 实例上运行 LaunchConfig 中提到的配置集.

This command in the action feild will run the configsets mentioned in the LaunchConfig on the ec2 instance.

这篇关于AWS cfn-hup 配置中的 post.add vs post.update vs post.delete的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆