-
Notifications
You must be signed in to change notification settings - Fork 12
/
s3_cloud_formation_Logging.json
105 lines (105 loc) · 2.71 KB
/
s3_cloud_formation_Logging.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
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Simple S3 bucket",
"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"
},
"VersioningStatus": {
"Description": "Enabled, Suspend or Ignore Versioning",
"Type": "String",
"AllowedValues": [
"Enabled",
"Suspended"
],
"Default": "Suspended"
},
"LambdaFunctionarn": {
"Description": "A lambda Function arn for notification",
"Type": "String",
"Default": ""
},
"S3AccessControlStatus": {
"Description": "Enabled, Suspend or Ignore Versioning",
"Type": "String",
"AllowedValues": [
"AuthenticatedRead",
"AwsExecRead",
"BucketOwnerRead",
"BucketOwnerFullControl",
"LogDeliveryWrite",
"Private",
"PublicRead",
"PublicReadWrite"
],
"Default": "Private"
}
},
"Resources": {
"s3LoggingBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"AccessControl": "LogDeliveryWrite",
"BucketName": "s3bucketname-for-logging-sample-test"
}
},
"S3Bucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"AccessControl": {
"Ref": "S3AccessControlStatus"
},
"BucketName": {
"Ref": "S3BucketName"
},
"VersioningConfiguration": {
"Status": {
"Ref": "VersioningStatus"
}
},
"LoggingConfiguration": {
"DestinationBucketName": {
"Ref": "s3LoggingBucket"
},
"LogFilePrefix": ".logs"
},
"NotificationConfiguration" : {
"LambdaConfigurations" : [{
"Function" : { "ref": "LambdaFunctionarn"},
"Event" : "s3:ObjectCreated:*",
"Filter" : {
"S3Key" : {
"Rules" : [{
"Name" : "suffix",
"Value" : "zip"
}]
}
}
}]
},
"LifecycleConfiguration": {
"Rules": [
{
"Id": "deleterule",
"Status": "Enabled",
"ExpirationInDays": {
"Ref": "S3LifeCycleDelete"
}
}
]
}
}
}
}
}