I need to create an aws.cloudformation
event type for a specific CloudFormation stack. For example when StackA
receives the UpdateStack
event, I need to be able to catch that event.
Through the console I was able to create the following event rule (which is an AWS API Call via CloudTrail
type event):
{
"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.
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.
How can I do something similar with an aws.cloudformation
event type?
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
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/
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"]}}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.