[英]How can I create an "aws.cloudformation" CloudWatch event type for a specific CloudFormation stack?
I need to create an aws.cloudformation
event type for a specific CloudFormation stack.我需要为特定的
aws.cloudformation
堆栈创建一个aws.cloudformation
事件类型。 For example when StackA
receives the UpdateStack
event, I need to be able to catch that event.例如,当
StackA
收到UpdateStack
事件时,我需要能够捕获该事件。
Through the console I was able to create the following event rule (which is an AWS API Call via CloudTrail
type event):通过控制台,我能够创建以下事件规则(这是
AWS API Call via CloudTrail
类型事件的AWS API Call via CloudTrail
):
{
"source": [
"aws.cloudformation"
],
"detail-type": [
"AWS API Call via CloudTrail"
],
"detail": {
"eventSource": [
"cloudformation.amazonaws.com"
],
"eventName": [
"UpdateStack",
"CreateStack"
]
}
}
However, this event isn't for any specific CloudFormation stack, and I don't see any option for adding anything specific (such as whenever StackA
gets an UpdateStack
call.但是,此事件不适用于任何特定的 CloudFormation 堆栈,而且我看不到任何用于添加任何特定内容的选项(例如,每当
StackA
收到UpdateStack
调用时。
The documentation for event types give examples of other event types and how we can add a specific resource that triggers the event. 事件类型的文档提供了其他事件类型的示例以及我们如何添加触发事件的特定资源。 For example, with the
aws.codepipeline
event, you can specify a pipeline
equal value to PipelineA
, and then the event would get triggered whenever PipelineA
gets to the state you specified in the State
parameter.例如,对于
aws.codepipeline
事件,您可以指定一个与PipelineA
相等的pipeline
值,然后只要PipelineA
达到您在State
参数中指定的状态,就会触发该事件。
How can I do something similar with an aws.cloudformation
event type?如何使用
aws.cloudformation
事件类型执行类似操作?
Unfortunately the only way (as far as I have found) to get a stack-specific events is the notification configuration inside the stack, which can be only provided on creation/update.不幸的是,获取特定于堆栈的事件的唯一方法(据我所知)是堆栈内的通知配置,它只能在创建/更新时提供。
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-add-tags.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-add-tags.html
I'm looking similar solution and found that should work: https://aws.amazon.com/ru/blogs/mt/tracking-aws-service-catalog-products-provisioned-by-individual-saml-users/我正在寻找类似的解决方案,发现应该有效: https : //aws.amazon.com/ru/blogs/mt/tracking-aws-service-catalog-products-provisioned-by-individual-saml-users/
Step5 aws events put-rule --name "sc-add-user" --event-pattern "{"source":["aws.cloudformation"],"detail-type":["AWS API Call via CloudTrail"],"detail":{"eventSource":["cloudformation.amazonaws.com"],"eventName":["CreateStack"]}}" Step5 aws events put-rule --name "sc-add-user" --event-pattern "{"source":["aws.cloudformation"],"detail-type":["AWS API Call via CloudTrail"] ,"detail":{"eventSource":["cloudformation.amazonaws.com"],"eventName":["CreateStack"]}}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.