-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtemplate.yaml
More file actions
716 lines (666 loc) · 23 KB
/
template.yaml
File metadata and controls
716 lines (666 loc) · 23 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
aws-batch-job
Sample SAM Template for aws-batch-job
Resources:
BatchJobData:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: jobId
AttributeType: S
BillingMode: PAY_PER_REQUEST
ContributorInsightsSpecification:
Enabled: false
KeySchema:
- AttributeName: jobId
KeyType: HASH
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
SSESpecification:
SSEEnabled: true
StreamSpecification:
StreamViewType: NEW_IMAGE
TableClass: STANDARD
Tags:
- Key: "Application"
Value: "BatchOperationalDashboard"
TimeToLiveSpecification:
AttributeName: ExpirationTime
Enabled: true
BatchJobStateChangeLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 7
BatchJobStateChange:
Type: AWS::Serverless::StateMachine
Properties:
DefinitionSubstitutions:
BatchJobData: !Ref BatchJobData
ECSRegistrationTable: !Ref ECSInstanceRegistrationTable
DefinitionUri: src/batch-job-states.json
Events:
CloudTrail:
Type: CloudWatchEvent
Description: "Capture AWS Batch jobs states transitions"
Properties:
Pattern:
detail-type:
- 'Batch Job State Change'
source:
- 'aws.batch'
Logging:
Destinations:
- CloudWatchLogsLogGroup:
LogGroupArn: !GetAtt BatchJobStateChangeLogGroup.Arn
Level: 'ALL'
Policies:
- CloudWatchLogsFullAccess
- DynamoDBWritePolicy:
TableName: !Ref BatchJobData
- DynamoDBReadPolicy:
TableName: !Ref ECSInstanceRegistrationTable
Tags:
"Application": "BatchOperationalDashboard"
Tracing:
Enabled: true
Type: EXPRESS
### ECS Instance Registration
ECSInstanceRegistrationTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: containerInstanceArn
AttributeType: S
BillingMode: PAY_PER_REQUEST
ContributorInsightsSpecification:
Enabled: false
KeySchema:
- AttributeName: containerInstanceArn
KeyType: HASH
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
SSESpecification:
SSEEnabled: true
StreamSpecification:
StreamViewType: NEW_IMAGE
TableClass: STANDARD
Tags:
- Key: "Application"
Value: "BatchOperationalDashboard"
TimeToLiveSpecification:
AttributeName: ExpirationTime
Enabled: true
ECSInstanceRegistrationLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 7
ECSInstanceRegistrationStateMachine:
Type: AWS::Serverless::StateMachine
Properties:
DefinitionSubstitutions:
ECSRegistrationTable: !Ref ECSInstanceRegistrationTable
DefinitionUri: src/ecs-instance-registration.json
Events:
CloudTrail:
Type: CloudWatchEvent
Description: "Capture ECS instances registration and deregistration"
Properties:
Pattern:
detail-type:
- 'AWS API Call via CloudTrail'
source:
- 'aws.ecs'
detail:
eventName:
- 'RegisterContainerInstance'
- 'DeregisterContainerInstance'
eventSource:
- 'ecs.amazonaws.com'
Logging:
Destinations:
- CloudWatchLogsLogGroup:
LogGroupArn: !GetAtt ECSInstanceRegistrationLogGroup.Arn
Level: 'ALL'
Policies:
- CloudWatchLogsFullAccess
- DynamoDBWritePolicy:
TableName: !Ref ECSInstanceRegistrationTable
- EC2DescribePolicy: {}
Tags:
"Application": "BatchOperationalDashboard"
Tracing:
Enabled: true
Type: EXPRESS
AthenaSpillS3Bucket:
Type: AWS::S3::Bucket
DeletionPolicy: Retain
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: 'AES256'
PublicAccessBlockConfiguration:
BlockPublicAcls: True
BlockPublicPolicy: True
IgnorePublicAcls: True
RestrictPublicBuckets: True
Tags:
- Key: "Application"
Value: "BatchOperationalDashboard"
AthenaSpillS3BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref AthenaSpillS3Bucket
PolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 's3:*'
Effect: Deny
Resource:
- !Join
- ''
- - 'arn:aws:s3:::'
- !Ref AthenaSpillS3Bucket
- /*
- !Join
- ''
- - 'arn:aws:s3:::'
- !Ref AthenaSpillS3Bucket
Principal: '*'
Condition:
Bool:
'aws:SecureTransport': False
AthenaDynamoDBConnector:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:292517598671:applications/AthenaDynamoDBConnector
SemanticVersion: 2025.15.1
Parameters:
AthenaCatalogName: aws-batch-jobs-data
# WARNING: If set to 'true' encryption for spilled data is disabled.
# DisableSpillEncryption: 'false' # Uncomment to override default value
# Lambda memory in MB (min 128 - 3008 max).
# LambdaMemory: '3008' # Uncomment to override default value
# Maximum Lambda invocation runtime in seconds. (min 1 - 900 max)
# LambdaTimeout: '900' # Uncomment to override default value
# The name of the bucket where this function can spill data.
SpillBucket: !Ref AthenaSpillS3Bucket
# The prefix within SpillBucket where this function can spill data.
# SpillPrefix: 'athena-spill' # Uncomment to override default value
BatchDataCatalog:
DependsOn: AthenaDynamoDBConnector
Type: AWS::Athena::DataCatalog
Properties:
Name: aws-batch-jobs-data
Parameters:
function: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:aws-batch-jobs-data'
Tags:
- Key: "Application"
Value: "BatchOperationalDashboard"
Type: LAMBDA
GrafanaWorkGroup:
Type: AWS::Athena::WorkGroup
Properties:
Name: 'batch-wg'
RecursiveDeleteOption: true
State: ENABLED
Tags:
- Key: "Application"
Value: "BatchOperationalDashboard"
WorkGroupConfiguration:
BytesScannedCutoffPerQuery: 1000000000
EnforceWorkGroupConfiguration: false
EngineVersion:
EffectiveEngineVersion: 'AUTO'
SelectedEngineVersion: 'Athena engine version 3'
PublishCloudWatchMetricsEnabled: false
RequesterPaysEnabled: false
GrafanaAthenaAccess:
Type: AWS::IAM::Policy
Properties:
PolicyName: 'GrafanaAthenaAccess'
PolicyDocument:
Statement:
- Effect: Allow
Action:
- athena:GetDatabase
- athena:GetDataCatalog
- athena:GetTableMetadata
- athena:ListDatabases
- athena:ListDataCatalogs
- athena:ListTableMetadata
- athena:ListWorkGroups
Resource:
- '*'
- Effect: Allow
Action:
- athena:GetQueryExecution
- athena:GetQueryResults
- athena:GetWorkGroup
- athena:StartQueryExecution
- athena:StopQueryExecution
Resource:
- !Join [ '', ['arn:aws:athena:', !Ref AWS::Region, ':', !Ref AWS::AccountId, ':workgroup/', !Ref GrafanaWorkGroup ]]
- !Join [ '', ['arn:aws:athena:', !Ref AWS::Region, ':', !Ref AWS::AccountId, ':workgroup/primary' ]]
- Effect: Allow
Action:
- s3:GetBucketLocation
- s3:GetObject
- s3:ListBucket
- s3:ListBucketMultipartUploads
- s3:ListMultipartUploadParts
- s3:AbortMultipartUpload
- s3:PutObject
- s3:PutBucketPublicAccessBlock
Resource:
- !GetAtt AthenaSpillS3Bucket.Arn
- !Join [ '', [ !GetAtt AthenaSpillS3Bucket.Arn, '/*' ]]
- !GetAtt BucketCURBatchReport.Arn
- !Join [ '', [ !GetAtt BucketCURBatchReport.Arn, '/*' ]]
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource:
- !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:aws-batch-jobs-data'
Roles:
- !Ref GrafanaRole
GrafanaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- grafana.amazonaws.com
Action:
- sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonGrafanaCloudWatchAccess
- arn:aws:iam::aws:policy/service-role/AmazonGrafanaAthenaAccess
GrafanaBatch:
Type: AWS::Grafana::Workspace
Properties:
AccountAccessType: CURRENT_ACCOUNT
AuthenticationProviders:
- AWS_SSO
DataSources:
- ATHENA
- CLOUDWATCH
GrafanaVersion: "9.4"
Name: "aws-batch-operation-dashboard"
PluginAdminEnabled: true
RoleArn: !Ref GrafanaRole
PermissionType: SERVICE_MANAGED
#### Cost
BucketCURBatchReport:
Type: AWS::S3::Bucket
DeletionPolicy: Retain
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: 'AES256'
PublicAccessBlockConfiguration:
BlockPublicAcls: True
BlockPublicPolicy: True
IgnorePublicAcls: True
RestrictPublicBuckets: True
Tags:
- Key: "Application"
Value: "BatchOperationalDashboard"
- Key: "Application"
Value: "BatchCostReport"
BucketCURBatchReportPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref BucketCURBatchReport
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 's3:GetBucketAcl'
- 's3:GetBucketPolicy'
Resource:
- !Join
- ''
- - 'arn:aws:s3:::'
- !Ref BucketCURBatchReport
Principal:
Service:
- 'billingreports.amazonaws.com'
Condition:
StringEquals:
aws:SourceArn: !Sub 'arn:aws:cur:${AWS::Region}:${AWS::AccountId}:definition/*'
aws:SourceAccount: !Sub '${AWS::AccountId}'
- Effect: Allow
Action:
- 's3:PutObject'
Resource:
- !Join
- ''
- - 'arn:aws:s3:::'
- !Ref BucketCURBatchReport
- /*
Principal:
Service:
- 'billingreports.amazonaws.com'
Condition:
StringEquals:
aws:SourceArn: !Sub 'arn:aws:cur:${AWS::Region}:${AWS::AccountId}:definition/*'
aws:SourceAccount: !Sub '${AWS::AccountId}'
CURAWSBatch:
DependsOn: BucketCURBatchReportPolicy
Type: AWS::CUR::ReportDefinition
Properties:
AdditionalArtifacts:
- 'ATHENA'
AdditionalSchemaElements:
- 'RESOURCES'
- 'SPLIT_COST_ALLOCATION_DATA'
Compression: 'Parquet'
Format: 'Parquet'
RefreshClosedReports: True
ReportName: 'AWSBatchCostReport'
ReportVersioning: 'OVERWRITE_REPORT'
S3Bucket: !Ref BucketCURBatchReport
S3Prefix: 'aws-batch'
S3Region: !Ref 'AWS::Region'
TimeUnit: 'HOURLY'
### Glue and Athena for CUR
AWSCURDatabase:
Type: 'AWS::Glue::Database'
Properties:
DatabaseInput:
Name: 'athenacurcfn_a_w_s_batch_cost_report'
CatalogId: !Ref AWS::AccountId
AWSCURCrawlerComponentFunction:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- glue.amazonaws.com
Action:
- 'sts:AssumeRole'
Path: /
ManagedPolicyArns:
- !Sub 'arn:${AWS::Partition}:iam::aws:policy/service-role/AWSGlueServiceRole'
Policies:
- PolicyName: AWSCURCrawlerComponentFunction
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource: !Sub 'arn:${AWS::Partition}:logs:*:*:*'
- Effect: Allow
Action:
- 'glue:UpdateDatabase'
- 'glue:UpdatePartition'
- 'glue:CreateTable'
- 'glue:UpdateTable'
- 'glue:ImportCatalogToGlue'
Resource: '*'
- Effect: Allow
Action:
- 's3:GetObject'
- 's3:PutObject'
Resource:
- !Join
- ''
- - 'arn:aws:s3:::'
- !Ref BucketCURBatchReport
- '/aws-batch/AWSBatchCostReport/AWSBatchCostReport*'
- PolicyName: AWSCURKMSDecryption
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'kms:Decrypt'
Resource: '*'
AWSCURCrawlerLambdaExecutor:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
Path: /
Policies:
- PolicyName: AWSCURCrawlerLambdaExecutor
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource: !Sub 'arn:${AWS::Partition}:logs:*:*:*'
- Effect: Allow
Action:
- 'glue:StartCrawler'
Resource: '*'
AWSCURCrawler:
Type: 'AWS::Glue::Crawler'
DependsOn:
- AWSCURDatabase
- AWSCURCrawlerComponentFunction
Properties:
Name: AWSCURCrawler-AWSBatchCostReport
Description: A recurring crawler that keeps your CUR table in Athena up-to-date.
Role: !GetAtt AWSCURCrawlerComponentFunction.Arn
DatabaseName: !Ref AWSCURDatabase
Targets:
S3Targets:
- Path: !Join ['', ['s3://', !Ref BucketCURBatchReport,'/aws-batch/AWSBatchCostReport/AWSBatchCostReport']]
Exclusions:
- '**.json'
- '**.yml'
- '**.sql'
- '**.csv'
- '**.gz'
- '**.zip'
SchemaChangePolicy:
UpdateBehavior: UPDATE_IN_DATABASE
DeleteBehavior: DELETE_FROM_DATABASE
AWSCURInitializer:
Type: 'AWS::Lambda::Function'
DependsOn: AWSCURCrawler
Properties:
Code:
ZipFile: |
// AWS SDK v3 for Glue
const { GlueClient, StartCrawlerCommand } = require('@aws-sdk/client-glue');
const response = require('./cfn-response');
exports.handler = function(event, context, callback) {
if (event.RequestType === 'Delete') {
response.send(event, context, response.SUCCESS);
} else {
// Create Glue client using SDK v3
const glue = new GlueClient();
// Create command for starting crawler
const command = new StartCrawlerCommand({ Name: 'AWSCURCrawler-AWSBatchCostReport' });
// Send the command
glue.send(command).then(data => {
if (event.ResponseURL) {
response.send(event, context, response.SUCCESS);
} else {
callback(null, response.SUCCESS);
}
}).catch(err => {
const responseData = err;
if (err.name === 'CrawlerRunningException') {
callback(null, err.message);
} else {
const responseString = JSON.stringify(responseData);
if (event.ResponseURL) {
response.send(event, context, response.FAILED,{ msg: responseString });
} else {
callback(responseString);
}
}
});
}
};
Handler: 'index.handler'
Timeout: 30
Runtime: nodejs22.x
ReservedConcurrentExecutions: 1
Role: !GetAtt AWSCURCrawlerLambdaExecutor.Arn
AWSStartCURCrawler:
Type: 'Custom::AWSStartCURCrawler'
Properties:
ServiceToken: !GetAtt AWSCURInitializer.Arn
AWSS3CUREventLambdaPermission:
Type: AWS::Lambda::Permission
Properties:
Action: 'lambda:InvokeFunction'
FunctionName: !GetAtt AWSCURInitializer.Arn
Principal: 's3.amazonaws.com'
SourceAccount: !Ref AWS::AccountId
SourceArn: !GetAtt BucketCURBatchReport.Arn
AWSS3CURLambdaExecutor:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
Path: /
Policies:
- PolicyName: AWSS3CURLambdaExecutor
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource: !Sub 'arn:${AWS::Partition}:logs:*:*:*'
- Effect: Allow
Action:
- 's3:PutBucketNotification'
Resource: !GetAtt BucketCURBatchReport.Arn
AWSS3CURNotification:
Type: 'AWS::Lambda::Function'
DependsOn:
- AWSCURInitializer
- AWSS3CUREventLambdaPermission
- AWSS3CURLambdaExecutor
Properties:
Code:
ZipFile: |
// Add S3 client import
const { S3Client, PutBucketNotificationConfigurationCommand } = require('@aws-sdk/client-s3');
const response = require('./cfn-response');
exports.handler = function(event, context, callback) {
const s3Client = new S3Client();
const putConfigRequest = function(notificationConfiguration) {
return new Promise(function(resolve, reject) {
const command = new PutBucketNotificationConfigurationCommand({
Bucket: event.ResourceProperties.BucketName,
NotificationConfiguration: notificationConfiguration
});
s3Client.send(command)
.then(data => resolve(data))
.catch(err => reject({ msg: err.message, error: err, data: null }));
});
};
const newNotificationConfig = {};
if (event.RequestType !== 'Delete') {
newNotificationConfig.LambdaFunctionConfigurations = [{
Events: [ 's3:ObjectCreated:*' ],
LambdaFunctionArn: event.ResourceProperties.TargetLambdaArn || 'missing arn',
Filter: { Key: { FilterRules: [ { Name: 'prefix', Value: event.ResourceProperties.ReportKey } ] } }
}];
}
putConfigRequest(newNotificationConfig).then(function(result) {
response.send(event, context, response.SUCCESS, result);
callback(null, result);
}).catch(function(error) {
response.send(event, context, response.FAILED, error);
console.log(error);
callback(error);
});
};
Handler: 'index.handler'
Timeout: 30
Runtime: nodejs22.x
ReservedConcurrentExecutions: 1
Role: !GetAtt AWSS3CURLambdaExecutor.Arn
AWSPutS3CURNotification:
Type: 'Custom::AWSPutS3CURNotification'
Properties:
ServiceToken: !GetAtt AWSS3CURNotification.Arn
TargetLambdaArn: !GetAtt AWSCURInitializer.Arn
BucketName: !Ref BucketCURBatchReport
ReportKey: 'aws-batch/AWSBatchCostReport/AWSBatchCostReport'
AWSCURReportStatusTable:
Type: 'AWS::Glue::Table'
DependsOn: AWSCURDatabase
Properties:
DatabaseName: athenacurcfn_a_w_s_batch_cost_report
CatalogId: !Ref AWS::AccountId
TableInput:
Name: 'cost_and_usage_data_status'
TableType: 'EXTERNAL_TABLE'
StorageDescriptor:
Columns:
- Name: status
Type: 'string'
InputFormat: 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OutputFormat: 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
SerdeInfo:
SerializationLibrary: 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
Location: !Join ['', ['s3://', !Ref BucketCURBatchReport,'/aws-batch/AWSBatchCostReport/cost_and_usage_data_status/']]
###
Outputs:
AthenaDataSource:
Value: !Ref BatchJobData
AthenaSpillBucket:
Value: !Ref AthenaSpillS3Bucket
GrafanaWorkspaceId:
Value: !Ref GrafanaBatch
CURBatchBucket:
Value: !Ref BucketCURBatchReport