Skip to content

Instantly share code, notes, and snippets.

@m4r10k
Created September 12, 2021 12:51
Show Gist options
  • Save m4r10k/33a840f1418020b15384af97d5783e81 to your computer and use it in GitHub Desktop.
Save m4r10k/33a840f1418020b15384af97d5783e81 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: 2010-09-09
Resources:
EventsToCentralMonitoringEventBus:
Type: 'AWS::Events::Rule'
Properties:
Description: Events-To-Central-Monitoring-EventBus
Name: Events-To-Central-Monitoring-EventBus
EventPattern:
source:
- aws.cloudwatch
- aws.health
State: ENABLED
Targets:
- Arn: 'arn:aws:events:eu-central-1:<destination>:event-bus/Central-Monitoring-EventBus'
Id: !Select [2, !Split ['/', !Ref AWS::StackId]]
RoleArn: !GetAtt AllowPutOnCentralEventBusRole.Arn
AllowPutOnCentralBusPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: AllowPutOnCentralEventBusPolicy
Roles:
- !Ref AllowPutOnCentralEventBusRole
PolicyDocument:
Statement:
-
Effect: Allow
Action:
- events:PutEvents
Resource:
- "arn:aws:events:eu-central-1:<destination>:event-bus/Central-Monitoring-EventBus"
AllowPutOnCentralEventBusRole:
Type: AWS::IAM::Role
Properties:
RoleName: AllowPutOnCentralEventBusRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: Allow
Principal:
Service: events.amazonaws.com
Action: sts:AssumeRole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment