-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudformation.yml
More file actions
98 lines (85 loc) · 2.13 KB
/
Copy pathcloudformation.yml
File metadata and controls
98 lines (85 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
AWSTemplateFormatVersion: 2010-09-09
Description: >-
This is a sample template for lambda-backed custom resource. Runtime for
Lambda function
Parameters:
pBucketName:
Description: The bucket that contains the lambda code
Type: String
MinLength: 1
MaxLength: 100
AllowedPattern: ^[a-zA-Z0-9]*$
Default: mandiclambdas
pFileName:
Description: The name of Zip file with lambda code
Type: String
MinLength: 1
MaxLength: 100
Default: oraclenotify.zip
pLogGroupName:
Description: Path to log group
Type: String
MinLength: 1
MaxLength: 300
Default: "/aws/rds/instance/bdoracle/audit"
pFilters:
Description: Filters for triggering lambda
Type: String
MinLength: 1
MaxLength: 200
Default: "?ALTER USER ?alter user ?AlTeR UsEr"
Resources:
rLambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Path: "/"
Policies:
- PolicyName: root
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- logs:*
- ses:*
Resource: '*'
rLambdaOraclenotify:
Type: AWS::Lambda::Function
Properties:
Role:
Fn::GetAtt: rLambdaRole.Arn
Runtime: python3.7
Timeout: 30
Handler: lambda_function.lambda_handler
Code:
S3Bucket:
Ref: pBucketName
S3Key:
Ref: pFileName
ExecutePermission:
Type: "AWS::Lambda::Permission"
Properties:
Action: 'lambda:InvokeFunction'
FunctionName:
Fn::GetAtt: rLambdaOraclenotify.Arn
Principal: 'logs.amazonaws.com'
rLambdaCWLogs:
Type: AWS::Logs::SubscriptionFilter
Properties:
#RoleArn:
# Fn::GetAtt:rLambdaRole.Arn
FilterPattern:
Ref: pFilters
LogGroupName:
Ref: pLogGroupName
DestinationArn:
Fn::GetAtt: rLambdaOraclenotify.Arn