I am trying to configure a CloudTrail in a master AWS account and an AWS s3 bucket in a logging account. I've configured the s3 bucket policy in the logging account such that the master account CloudTrail resource has access to write to it. However, when I edit the CloudTrail in the master account I get
The AWS KMS key policy does not grant CloudTrail sufficient access multiple accounts
Expected: After editing the master account Cloudtrail and clicking save the CloudTrail logs from the master account flow to the s3 bucket.
Actual:
After editing the master account CloudTrail and clicking save the following error is produced: The AWS KMS key policy does not grant CloudTrail sufficient access
The kms key policy for the master account is configured like so
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnableIAMUserPermissions",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "kms:*",
"Resource": "*"
},
{
"Sid": "AllowCloudTrailAccess",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "kms:DescribeKey",
"Resource": "*"
},
{
"Sid": "AllowCloudTrailToEncryptLogs",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "kms:GenerateDataKey*",
"Resource": "*",
"Condition": {
"StringLike": {
"kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:master_account_id:trail/*"
}
}
},
{
"Sid": "EnableCloudTrailLogDecryptPermissions",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"kms:ReEncryptFrom",
"kms:Decrypt"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"kms:CallerAccount": "master_account_id"
},
"StringLike": {
"kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:master_account_id:trail/*"
}
}
},
{
"Sid": "AllowAliasCreationDurningSetup",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "kms:CreateAlias",
"Resource": "*",
"Condition": {
"StringEquals": {
"kms:ViaService": "ec2.us-east-1.amazonaws.com",
"kms:CallerAccount": "master_account_id"
}
}
},
{
"Sid": "EnableCrossAccountLogDecryption",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"kms:ReEncryptFrom",
"kms:Decrypt"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"kms:CallerAccount": "master_account_id"
},
"StringLike": {
"kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:master_account_id:trail/*"
}
}
},
{
"Sid": "EnableCrossAccountLogDecryption",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"kms:ReEncryptFrom",
"kms:Decrypt"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"kms:CallerAccount": "logging_account_id"
},
"StringLike": {
"kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:logging_account_idtrail/*"
}
}
}
]
}
The master_account_id
is the id of the master AWS account. The logging_account_id
is the id of the AWS logging account. How can I troubleshoot this issue?