I have an Elasticache cluster and a snapshot (rdb file) on S3, the bucket and also elasticache are deployed using terraform code.
but it fails everytime with this error :
Download of snapshot arn:aws:s3:::bucket-test/raw-data/dump.rdb failed for node 0001. Failed to retrieve file from S3
Here is the code used to grant access on S3 bucket :
resource "aws_s3_bucket_policy" "allow_access_from_another_account" {
bucket = module.bucket.id
policy = data.aws_iam_policy_document.allow_access_from_another_account.json
}
data "aws_iam_policy_document" "allow_access_from_another_account" {
statement {
principals {
type = "CanonicalUser"
identifiers = ["540804c33a284a299d2547575ce1010f2312ef3da9b3a053c8bc45bf233e4353"]
}
actions = [
"s3:GetObject",
"s3:GetBucketAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:DeleteObject",
]
resources = [
module.bucket.arn,
"${module.bucket.arn}/*",
]
}
}
Taking a look at the file’s permissions on S3 :
file permissions
Any ideas what could’ve be missing ?