@@ -166,6 +166,85 @@ Resources:
166166 Properties :
167167 LogGroupName : " /aws/eks/{{.Cluster.Name}}/cluster"
168168 RetentionInDays : 545
169+ {{- if eq .Cluster.ConfigItems.eks_siem_logging "true" }}
170+ EKSControlPlaneSubscriptionFilter :
171+ Type : AWS::Logs::SubscriptionFilter
172+ Properties :
173+ LogGroupName : !Ref ControlPlaneLogGroup
174+ RoleArn : !GetAtt EKSControlPlaneCWtoFirehoseRole.Arn
175+ FilterName : " EKSCtrlPlaneLogs-{{.Cluster.Name}}"
176+ FilterPattern : " "
177+ DestinationArn : !GetAtt EKSControlPlaneLogsDataFirehose.Arn
178+ EKSControlPlaneLogsDataFirehose :
179+ Type : AWS::KinesisFirehose::DeliveryStream
180+ Properties :
181+ DeliveryStreamName : " EKSCtrlPlaneDeliveryStream-{{.Cluster.Name}}"
182+ DeliveryStreamType : DirectPut
183+ HttpEndpointDestinationConfiguration :
184+ EndpointConfiguration :
185+ AccessKey : " {{.Cluster.ConfigItems.eks_siem_key}}"
186+ Url : " {{.Cluster.ConfigItems.eks_siem_endpoint}}"
187+ RetryOptions :
188+ DurationInSeconds : 300
189+ S3Configuration :
190+ BucketARN : " {{.Cluster.ConfigItems.eks_siem_bucket}}"
191+ S3BackupMode : " FailedDataOnly"
192+ RoleARN : !GetAtt EKSControlPlaneFirehoseS3Role.Arn
193+ EKSControlPlaneFirehoseS3Role :
194+ Type : AWS::IAM::Role
195+ Properties :
196+ AssumeRolePolicyDocument :
197+ Version : " 2012-10-17"
198+ Statement :
199+ - Effect : Allow
200+ Principal :
201+ Service :
202+ - firehose.amazonaws.com
203+ Action :
204+ - ' sts:AssumeRole'
205+ Path : /
206+ Policies :
207+ - PolicyName : root
208+ PolicyDocument :
209+ Version : " 2012-10-17"
210+ Statement :
211+ - Effect : Allow
212+ Action :
213+ - ' s3:PutObject'
214+ - ' s3:GetObject'
215+ - ' s3:ListBucketMultipartUploads'
216+ - ' s3:AbortMultipartUpload'
217+ - ' s3:ListBucket'
218+ - ' s3:GetBucketLocation'
219+ Resource :
220+ - " {{.Cluster.ConfigItems.eks_siem_bucket}}"
221+ RoleName : " EKSCtrlPlaneFirehosetoS3-{{.Cluster.Name}}"
222+ EKSControlPlaneCWtoFirehoseRole :
223+ Type : AWS::IAM::Role
224+ Properties :
225+ AssumeRolePolicyDocument :
226+ Version : " 2012-10-17"
227+ Statement :
228+ - Effect : Allow
229+ Principal :
230+ Service :
231+ - " logs.amazonaws.com"
232+ Action :
233+ - " sts:AssumeRole"
234+ Path : /
235+ Policies :
236+ - PolicyName : root
237+ PolicyDocument :
238+ Version : " 2012-10-17"
239+ Statement :
240+ - Effect : Allow
241+ Action :
242+ - " firehose:PutRecord"
243+ - " firehose:PutRecordBatch"
244+ Resource :
245+ - " arn:aws:firehose:*:{{.Cluster.InfrastructureAccountID}}:deliverystream/EKSCtrlPlaneDeliveryStream-{{.Cluster.Name}}"
246+ RoleName : " EKSCtrlPlaneCWtoFirehose-{{.Cluster.Name}}"
247+ {{- end }}
169248{{- end }}
170249 EKSCluster :
171250 Type : AWS::EKS::Cluster
0 commit comments