@@ -101,5 +101,61 @@ export default {
101101 Action : "iam:PassRole" ,
102102 Resource : [ "arn:*:iam::*:role/*Elastio*" ] ,
103103 } ,
104+
105+ {
106+ Sid : "ElastioKmsRead" ,
107+ Action : [
108+ "kms:DescribeKey" ,
109+ "kms:GetKeyPolicy" ,
110+ "kms:GetKeyRotationStatus" ,
111+ "kms:ListResourceTags" ,
112+ ] ,
113+ Resource : "*" ,
114+ } ,
115+
116+ {
117+ Sid : "ElastioKmsCreate" ,
118+ Action : [ "kms:CreateKey" ] ,
119+ Resource : "*" ,
120+ Condition : iam . hasRequestTag ( "elastio:resource" ) ,
121+ } ,
122+
123+ {
124+ Sid : "ElastioKmsWrite" ,
125+ Action : [
126+ "kms:PutKeyPolicy" ,
127+ "kms:ScheduleKeyDeletion" ,
128+ "kms:EnableKeyRotation" ,
129+ "kms:DisableKeyRotation" ,
130+
131+ "kms:TagResource" ,
132+ "kms:UntagResource" ,
133+
134+ // Data-level KMS operations are required for example to encrypt/decrypt
135+ // lambda env vars for lambda deployed as part of the Asset Account stack.
136+ "kms:Decrypt" ,
137+ "kms:Encrypt" ,
138+ "kms:GenerateDataKey" ,
139+ "kms:CreateGrant" ,
140+ ] ,
141+ Resource : "*" ,
142+ Condition : iam . hasResourceTag ( "elastio:resource" ) ,
143+ } ,
144+
145+ // For KMS aliases we need separate permissions for the alias resource
146+ // restricting it with the `elastio-` prefix.
147+ {
148+ Action : [ "kms:CreateAlias" , "kms:DeleteAlias" , "kms:UpdateAlias" ] ,
149+ Resource : [ `arn:aws:kms:*:*:alias/elastio-*` ] ,
150+ } ,
151+
152+ // Aliases require the same permissions both on the alias resource and on
153+ // the KMS key resource. This is separate statement to use a condition
154+ // by `elastio:resource` tag.
155+ {
156+ Action : [ "kms:CreateAlias" , "kms:DeleteAlias" , "kms:UpdateAlias" ] ,
157+ Resource : [ `arn:aws:kms:*:*:key/*` ] ,
158+ Condition : iam . hasResourceTag ( "elastio:resource" ) ,
159+ } ,
104160 ] ,
105161} satisfies iam . Policy ;
0 commit comments