-
Notifications
You must be signed in to change notification settings - Fork 12
/
s3_cloud_formation_notification.json
112 lines (108 loc) · 3.01 KB
/
s3_cloud_formation_notification.json
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "S3 Bucket Template ",
"Metadata": {
"Copyright": [
""
]
},
"Parameters": {
"S3BucketName": {
"Description": "Name of the S3 bucket",
"Type": "String",
"ConstraintDescription": "S3BucketName must be between 3 and 63 characters in length.",
"MinLength": 3,
"MaxLength": 63
},
"S3LifeCycleDelete": {
"Description": "Specify a number of days to keep files in the bucket, a value of 0 keeps the files stored in the bucket.",
"Type": "Number",
"MinValue": "0",
"MaxValue": "365",
"Default": "0"
},
"LambdaNotificationEvent": {
"Description": "The S3 bucket event for which to invoke the Lambda function.",
"Type": "String",
"Default": "s3:ObjectCreated:*",
"AllowedValues": [
"s3:ObjectCreated:*",
"s3:ObjectCreated:Put",
"s3:ObjectCreated:Post",
"s3:ObjectCreated:Copy",
"s3:ObjectCreated:CompleteMultipartUpload",
"s3:ObjectRemoved:*",
"s3:ObjectRemoved:Delete",
"s3:ObjectRemoved:DeleteMarkerCreated",
"s3:ReducedRedundancyLostObject"
]
},
"LambdaNotificationFilterName": {
"Description": "Whether the filter matches the prefix or suffix of object key names.",
"Type": "String",
"Default": "prefix",
"AllowedValues": [
"prefix",
"suffix"
]
},
"LambdaNotificationFilterValue": {
"Description": "The value that the filter searches for in object key names.",
"Type": "String",
"Default": ""
},
"LambdaNotificationFunctionArn": {
"Description": "The ARN of the Lambda function that S3 invokes when the specified event type occurs.",
"Type": "String",
"Default": ""
},
},
"Resources": {
"S3Bucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": { "Ref": "S3BucketName" },
"LifecycleConfiguration": {
"Rules": [
{
"ExpirationInDays": { "Ref": "S3LifeCycleDelete" },
"Status" : "Enabled"
}
]
},
"NotificationConfiguration": {
"LambdaConfigurations" : [
{
"Function": {
"Ref": "LambdaNotificationFunctionArn"
},
"Event": {
"Ref": "LambdaNotificationEvent"
},
"Filter" :{
"S3Key": {
"Rules": [
{
"Name": {
"Ref": "LambdaNotificationFilterName"
},
"Value": {
"Ref": "LambdaNotificationFilterValue"
}
}
]
}
}
}
]
}
}
}
},
"Outputs": {
"S3BucketName": {
"Description": "Name of the S3 Bucket",
"Value": { "Ref": "S3BucketName" }
}
}
}