-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtemplate.yml
86 lines (86 loc) · 2.68 KB
/
template.yml
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
---
AWSTemplateFormatVersion: 2010-09-09
Description: "**WARNING** This template creates IAM Role, AWS Glue job and related resources. You will be billed for the AWS resources used if you create a stack from this template."
Parameters:
S3Bucketname:
Description: Name of the existing Artifact store S3 bucket creation
Type: String
KMSKey:
Description: KMS Key used to encrypt the bucket
Type: String
Resources:
GlueJobRole:
Type: AWS::IAM::Role
Metadata:
cdk_nag:
rules_to_suppress:
- id: AwsSolutions-IAM5
reason: "Wild card in policy is required for matching S3 objects"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- glue.amazonaws.com
Action:
- sts:AssumeRole
Path: /
Policies:
- PolicyName: root
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- s3:GetObject
- s3:PutObject
- s3:ListBucket
- s3:DeleteObject
Resource:
- !Sub "arn:${AWS::Partition}:s3:::${S3Bucketname}"
- !Sub "arn:${AWS::Partition}:s3:::${S3Bucketname}/*"
- Effect: Allow
Action:
- kms:Decrypt
- kms:Encrypt
- kms:GenerateDataKey
- kms:DescribeKey
Resource:
- !Ref "KMSKey"
GlueJob:
Type: AWS::Glue::Job
Properties:
Command:
Name: glueetl
ScriptLocation: !Sub "s3://${S3Bucketname}/GlueJobs/sample.py"
DefaultArguments:
--job-bookmark-option: job-bookmark-enable
GlueVersion: "4.0"
ExecutionProperty:
MaxConcurrentRuns: 2
MaxRetries: 0
Name: samplejob
Role: !Ref "GlueJobRole"
WorkerType: G.2X
NumberOfWorkers: 10
SecurityConfiguration: !Ref "GlueSecurityConfiguration"
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
GlueSecurityConfiguration:
Type: AWS::Glue::SecurityConfiguration
Properties:
Name: DefaultSecurityConfiguration
EncryptionConfiguration:
CloudWatchEncryption:
CloudWatchEncryptionMode: SSE-KMS
KmsKeyArn: !Ref "KMSKey"
JobBookmarksEncryption:
JobBookmarksEncryptionMode: CSE-KMS
KmsKeyArn: !Ref "KMSKey"
S3Encryptions:
- KmsKeyArn: !Ref "KMSKey"
S3EncryptionMode: SSE-KMS
DeletionPolicy: Delete
UpdateReplacePolicy: Delete