Skip to content

Instantly share code, notes, and snippets.

@Halama
Created February 14, 2022 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Halama/e5db7ab0cc7b2762ff7f9a28fa1eac84 to your computer and use it in GitHub Desktop.
Save Halama/e5db7ab0cc7b2762ff7f9a28fa1eac84 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: '2010-09-09'
Description: Console-Sign-In-via-CloudTrail
Parameters:
AuditNotificationsEventBusArn:
Type: String
Description: "Arn of notificatiaons Event Bus in Audit notifications account"
Resources:
EventsRule:
Type: AWS::Events::Rule
Properties:
Description: Events rule for monitoring AWS Console Sign In activity
EventPattern:
detail-type:
- AWS Console Sign In via CloudTrail
State: ENABLED
Targets:
- Arn:
Ref: AuditNotificationsEventBusArn
Id: AuditNotificationsEventBus
RoleArn: !GetAtt AuditNotificationsPutEventRole.Arn
AuditNotificationsPutEventRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
Service: "events.amazonaws.com"
Action: "sts:AssumeRole"
Policies:
-
PolicyName: "AllowPutEvent"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action: "events:PutEvents"
Resource:
Ref: AuditNotificationsEventBusArn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment