I'm trying to setup a AWS event bridge rule that sends a message to an SNS topic in case of a deployment failure.
However, AWS event bridge does not seem to catch any events. This is the cloudformation template I use to setup the rules and SNS topic: It is based on the documentation given here
LabAPIEventRule:
Type: AWS::Events::Rule
Properties:
Description: "notification on application failure"
EventPattern:
Fn::ToJsonString:
detail-type: [ "AppRunner Service Operation Status Change" ]
source: [ "aws.apprunner" ]
account: [ !Ref AWS::AccountId ]
detail:
Status:
- "CreateServiceFailed"
- "DeleteServiceFailed"
- "UpdateServiceFailed"
- "DeploymentFailed"
- "PauseServiceFailed"
- "ResumeServiceFailed"
Name:
Fn::Sub: "event-${EnvironmentCode}-${ProductName}-apprunner-failure"
RoleArn: !GetAtt LabFailureSenderIAMRole.Arn
Targets:
- Arn: !Ref LabAPISNSTarget
Id: "1"
LabFailureSenderIAMRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName:
Fn::Sub: "iam-${AWS::Region}-${EnvironmentCode}-${ProductName}-lab-failure-role"
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- events.amazonaws.com
Action:
- 'sts:AssumeRole'
Policies:
- PolicyName: 'sns'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: "*"
Resource: !Ref LabAPISNSTarget
LabAPISNSTarget:
Type: AWS::SNS::Topic
Properties:
DisplayName:
Fn::Sub: "sns-${EnvironmentCode}-${ProductName}-apprunner-failure-sender"
Subscription:
- Endpoint: "my email"
Protocol: email
I expected to receive a notification of a deployment failure in my inbox.
I created a new app runner instance with faulty code that does not run, but received no notification.
I created an app runner instance that succesfully deployed, then updated to fail a deployment, but once again no notification.
I tested my SNS topic by sending a message to it, and that works fine.
Do you guys have any idea what I am missing?