- Newest
- Most votes
- Most comments
Hello.
Is the queue policy set in the target SQS queue as described in the following document?
If this is not set, it cannot be set as the destination for S3 event notifications.
https://repost.aws/knowledge-center/lambda-invoke-error-s3-bucket-permission#:~:text=Example%20Amazon%20SQS%20queue%20destination%20policy%3A
{
"Version": "2012-10-17",
"Id": "example-ID",
"Statement": [
{
"Sid": "example-statement-ID",
"Effect": "Allow",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Action": [
"SQS:SendMessage"
],
"Resource": "arn:aws:sqs:Region:account-id:queue-name",
"Condition": {
"ArnLike": {
"aws:SourceArn": "arn:aws:s3:*:*:awsexamplebucket1"
},
"StringEquals": {
"aws:SourceAccount": "bucket-owner-account-id"
}
}
}
]
}
The issue you're experiencing with creating an S3 event notification to an SQS queue is likely related to permissions. Even though you've successfully created the S3 buckets, SQS queue, and IAM permissions, there's an additional step required to allow S3 to send messages to the SQS queue.
To resolve this, you need to add a resource-based policy to the SQS queue. This policy should grant permission to the S3 service to send messages to the queue. Here's what you need to do:
- Go to the SQS console and select your queue.
- In the queue's details, find the "Access policy" section and edit it.
- Add a policy that allows S3 to send messages to this queue. The policy should look similar to this:
{ "Version": "2012-10-17", "Id": "example-ID", "Statement": [ { "Sid": "example-statement-ID", "Effect": "Allow", "Principal": { "Service": "s3.amazonaws.com" }, "Action": "SQS:SendMessage", "Resource": "ARN-of-your-SQS-queue", "Condition": { "ArnLike": { "aws:SourceArn": "arn:aws:s3:::your-s3-bucket-name" }, "StringEquals": { "aws:SourceAccount": "your-account-id" } } } ] }
Make sure to replace the placeholder values with your actual SQS queue ARN, S3 bucket name, and AWS account ID.
After adding this policy, try creating the S3 event notification again. This should resolve the "Unable to validate the following destination configurations" error you're encountering.
If you're still experiencing issues after applying this policy, it might be worth checking if there are any service disruptions or reaching out to AWS Support for further assistance.
Sources
S3 event notification to SQS | AWS re:Post
Cyclic dependency issue while using CloudFormation template for event notification configuration between S3 and SQS | AWS re:Post
S3 Events to SQS Trigger - Unable to validate the following destination configuration | AWS re:Post
Relevant content
- asked 2 years ago
- asked 2 years ago
