简体   繁体   English

如何使用CloudFormation将SNS主题指定为CodeDeploy部署组的触发器?

[英]How can a SNS topic be specified as a trigger for a CodeDeploy deployment group using CloudFormation?

I have a SNS topic set up to which I can send messages when a CodeDeploy deployment takes place. 我设置了一个SNS主题,在进行CodeDeploy部署时可以向其发送消息。 In the AWS console, the SNS topic is specified in the CodeDeploy deployment group configuration. 在AWS控制台中,在CodeDeploy部署组配置中指定了SNS主题。 I can successfully send notifications for deployments if I configure the desired SNS topic manually through the console UI. 如果通过控制台UI手动配置所需的SNS主题,则可以成功发送部署通知。

I would like to be able to create this association inside of a CloudFormation template at deployment group creation time. 我希望能够在部署组创建时在CloudFormation模板中创建此关联。 The CloudFormation documentation, however, lists no trigger/SNS/target property for the AWS::CodeDeploy::DeploymentGroup resource type. 但是,CloudFormation文档未列出AWS :: CodeDeploy :: DeploymentGroup资源类型的触发器/ SNS / target属性。

Is this a limitation of the current CloudFormation implementation or am I simply going about this wrong? 这是当前CloudFormation实施的限制吗?还是我只是想解决这个错误?

There's no mistake, it does seem that the AWS::CodeDeploy::DeploymentGroup resource doesn't currently contain a Property corresponding to the triggerConfigurations Request Parameter in the CreateDeploymentGroup API. AWS::CodeDeploy::DeploymentGroup ,似乎AWS::CodeDeploy::DeploymentGroup资源当前不包含与CreateDeploymentGroup API中的triggerConfigurations请求参数相对应的属性。

This is presumably due to the fact that according to the CodeDeploy Document History , the CloudFormation implementation was initially published on Oct 1, 2015, while SNS Event Notification support was added later on Feb 27, 2016, so the CloudFormation implementation has not been updated to reflect the new API features. 据推测,这是由于以下事实:根据CodeDeploy 文档历史记录 ,CloudFormation实施最初于2015年10月1日发布,而SNS Event Notification支持于2016年2月27日稍后添加,因此CloudFormation实施未更新为反映新的API功能。

As a workaround, you could use an AWS::Events::Rule with an SNS Target. 解决方法是,可以将AWS::Events::Rule与SNS目标一起使用。 See Monitoring Deployments with Amazon CloudWatch Events for instructions on setting up the CloudWatch event rule for this event type. 有关为该事件类型设置CloudWatch事件规则的说明,请参阅使用Amazon CloudWatch Events监视部署

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM