patterns/cross-region-cross-account-pattern/applications/account_2/template.yaml [7:49]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Parameters:
  EventBusName:
    Description: Name of the custom event bus
    Type: String
    
  SecurityAccountNo:
    Description: The account number where the security event bus is deployed
    Type: String

Resources:

  CustomEventBus: 
    Type: AWS::Events::EventBus
    Properties: 
        Name: !Ref EventBusName

  SecurityServiceRuleCreationStatement:
    Type: AWS::Events::EventBusPolicy
    Properties:
      EventBusName: !Ref CustomEventBus # If you omit this, the default event bus is used.
      StatementId: "AllowCrossRegionRulesForSecurityTeam"
      Statement:
        Effect: "Allow"
        Principal:
          AWS: !Sub "arn:aws:iam::${SecurityAccountNo}:root"
        Action:
          - "events:PutRule"
          - "events:DeleteRule"
          - "events:DescribeRule"
          - "events:DisableRule"
          - "events:EnableRule"
          - "events:PutTargets"
          - "events:RemoveTargets"
        Resource:
          -  !Sub 'arn:aws:events:${AWS::Region}:${AWS::AccountId}:rule/${CustomEventBus.Name}/*'
        Condition:
          StringEqualsIfExists:
            "events:creatorAccount": "${aws:PrincipalAccount}"

Outputs:
  EventBus:
    Description: EventBus
    Value: !GetAtt CustomEventBus.Arn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



patterns/cross-region-cross-account-pattern/applications/account_3/template.yaml [7:50]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Parameters:
  EventBusName:
    Description: Name of the custom event bus
    Type: String
    
  SecurityAccountNo:
    Description: The account number where the security event bus is deployed
    Type: String


Resources:

  CustomEventBus: 
    Type: AWS::Events::EventBus
    Properties: 
        Name: !Ref EventBusName

  SecurityServiceRuleCreationStatement:
    Type: AWS::Events::EventBusPolicy
    Properties:
      EventBusName: !Ref CustomEventBus # If you omit this, the default event bus is used.
      StatementId: "AllowCrossRegionRulesForSecurityTeam"
      Statement:
        Effect: "Allow"
        Principal:
          AWS: !Sub "arn:aws:iam::${SecurityAccountNo}:root"
        Action:
          - "events:PutRule"
          - "events:DeleteRule"
          - "events:DescribeRule"
          - "events:DisableRule"
          - "events:EnableRule"
          - "events:PutTargets"
          - "events:RemoveTargets"
        Resource:
          -  !Sub 'arn:aws:events:${AWS::Region}:${AWS::AccountId}:rule/${CustomEventBus.Name}/*'
        Condition:
          StringEqualsIfExists:
            "events:creatorAccount": "${aws:PrincipalAccount}"

Outputs:
  EventBus:
    Description: EventBus
    Value: !GetAtt CustomEventBus.Arn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



