简体   繁体   中英

The notification destination service region is not valid for the bucket location constraint when creating SQS Event on S3 Bucket via Cloudformation

I'm creating a cloudformation template which has to create a private bucket and then add event notification that send a message to a queue every time there's an object created in bucket. When i run the stack i get the following error:

The notification destination service region is not valid for the bucket location constraint (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument;

This is the template in Json format:

    "AWSTemplateFormatVersion": "2010-09-09",
    "Metadata": {
        "AWS::CloudFormation::Designer": {
            "b4cec5e5-e02b-4489-80ee-9627fd1bbbff": {
                "size": {
                    "width": 60,
                    "height": 60
                },
                "position": {
                    "x": 40,
                    "y": 130
                },
                "z": 0,
                "embeds": [],
                "dependson": [
                    "8e5a0dc7-8982-475c-baa7-41de089beb18"
                ]
            }
        }
    },
    "Resources": {
        "S3B2HKY4": {
            "Type": "AWS::S3::Bucket",
            "Properties": {
                "BucketName": "cloudformation.bucket.sqs",
                "AccessControl": "Private",
                "NotificationConfiguration": {
                    "QueueConfigurations": [
                        {
                            "Event": "s3:ObjectCreated:*",
                            "Queue": "arn:aws:sqs:*:*:cloudformation_queue_s3"
                        }
                    ]
                }
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "b4cec5e5-e02b-4489-80ee-9627fd1bbbff"
                }
            }
        }
    }
}```

I have checked similar problems but most of them are for SNS and Lambda function. 

Your arn:aws:sqs:*:*:cloudformation_queue_s3 should be an absolute value (account and region).

The error is noted because the notifications from S3 event notifications must only be queued to resources in the same region as the bucket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM