1
+ AWSTemplateFormatVersion : 2010-09-09
2
+ Description : This CloudFormation template provisions all the infrastructure and dependencies for a Java Provider on Lambda
3
+
4
+ Parameters :
5
+ ManagementUserArn :
6
+ NoEcho : True
7
+ Type : String
8
+
9
+ Resources :
10
+ ArtifactBucket :
11
+ Type : AWS::S3::Bucket
12
+ Properties :
13
+ BucketEncryption :
14
+ ServerSideEncryptionConfiguration :
15
+ - ServerSideEncryptionByDefault :
16
+ KMSMasterKeyID :
17
+ Ref : EncryptionKey
18
+ SSEAlgorithm : aws:kms
19
+
20
+ LogGroup :
21
+ Type : AWS::Logs::LogGroup
22
+ Properties :
23
+ RetentionInDays : 30
24
+
25
+ LambdaRole :
26
+ Type : AWS::IAM::Role
27
+ Properties :
28
+ AssumeRolePolicyDocument :
29
+ Version : " 2012-10-17"
30
+ Statement :
31
+ -
32
+ Effect : " Allow"
33
+ Principal :
34
+ Service :
35
+ - " lambda.amazonaws.com"
36
+ Action : " sts:AssumeRole"
37
+ Policies :
38
+ -
39
+ PolicyName : CloudWatchMetricsPolicy
40
+ PolicyDocument :
41
+ Version : " 2012-10-17"
42
+ Statement :
43
+ -
44
+ Effect : " Allow"
45
+ Action : " cloudwatch:PutMetricData"
46
+ Resource : " *"
47
+ -
48
+ PolicyName : CloudWatchLogsPolicy
49
+ PolicyDocument :
50
+ Version : " 2012-10-17"
51
+ Statement :
52
+ -
53
+ Effect : " Allow"
54
+ Action :
55
+ - " logs:PutLogEvents"
56
+ - " logs:CreateLogGroup"
57
+ - " logs:CreateLogStream"
58
+ Resource : !GetAtt LogGroup.Arn
59
+ -
60
+ PolicyName : CloudWatchEventsPolicy
61
+ PolicyDocument :
62
+ Version : " 2012-10-17"
63
+ Statement :
64
+ -
65
+ Effect : " Allow"
66
+ Action :
67
+ - " events:DeleteRule"
68
+ - " events:PutTargets"
69
+ - " events:DescribeRule"
70
+ - " events:EnableRule"
71
+ - " events:PutRule"
72
+ - " events:RemoveTargets"
73
+ Resource : " *"
74
+
75
+
76
+ EncryptionKey :
77
+ Type : AWS::KMS::Key
78
+ Properties :
79
+ Description : KMS key used to encrypt the resource provider artifacts and API payloads
80
+ EnableKeyRotation : false # Can't rotate keys until we can ensure that re-invokes are not broken by rotation
81
+ KeyPolicy :
82
+ Version : " 2012-10-17"
83
+ Id : " key-default-1"
84
+ Statement :
85
+ -
86
+ Sid : " Allow administration of the key"
87
+ Effect : " Allow"
88
+ Principal :
89
+ AWS : !Ref ManagementUserArn
90
+ Action :
91
+ - " kms:Create*"
92
+ - " kms:Describe*"
93
+ - " kms:Enable*"
94
+ - " kms:List*"
95
+ - " kms:Put*"
96
+ - " kms:Update*"
97
+ - " kms:Revoke*"
98
+ - " kms:Disable*"
99
+ - " kms:Get*"
100
+ - " kms:Delete*"
101
+ - " kms:ScheduleKeyDeletion"
102
+ - " kms:CancelKeyDeletion"
103
+ Resource : " *"
104
+ -
105
+ Sid : " Allow use of the key"
106
+ Effect : " Allow"
107
+ Principal :
108
+ AWS :
109
+ - !GetAtt LambdaRole.Arn
110
+ - !Ref ManagementUserArn
111
+ Action :
112
+ - " kms:Encrypt"
113
+ - " kms:Decrypt"
114
+ - " kms:ReEncrypt*"
115
+ - " kms:GenerateDataKey*"
116
+ - " kms:DescribeKey"
117
+ Resource : " *"
118
+
119
+ Outputs :
120
+ BucketName :
121
+ Value : !Ref ArtifactBucket
122
+ Export :
123
+ Name : ArtifactBucket
124
+ EncryptionKey :
125
+ Value : !GetAtt EncryptionKey.Arn
126
+ Export :
127
+ Name : EncryptionKey
128
+ LambdaRole :
129
+ Value : !GetAtt LambdaRole.Arn
130
+ Export :
131
+ Name : LambdaRole
0 commit comments