简体   繁体   English

如何使用 AWS SNS 设置 AWS S3 以进行上传事件?

[英]How do i set AWS S3 with AWS SNS for upload event?

I want to use event notification which is one of the basic functions of AWS S3 and AWS SNS.我想使用事件通知,这是 AWS S3 和 AWS SNS 的基本功能之一。 Setting the event in S3 raises the following warning.在 S3 中设置事件会引发以下警告。

“Unable to validate the following destination configurations. “无法验证以下目标配置。 Permissions on the destination topic do not allow S3 to publish notifications from this bucket”目标主题的权限不允许 S3 发布来自此存储桶的通知”

So I go to the S3 policy generator.所以我 go 到 S3 策略生成器。

 { "Id": "Policy1571877681758", "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1571877676943", "Action": "sns:*", "Effect": "Allow", "Resource": “mysnsarn”, "Principal": "*" } ] }

but there's some error like this “Policy has invalid action”但有一些像这样的错误“政策有无效的行动”

i don't know what to do..我不知道该怎么办..

You have multiple problems in the json:您在 json 中有多个问题:

  1. The quotes in resource value is wrong资源值中的引号是错误的
  2. Principal filed is not allowed (as this is a role policy)不允许提交委托人(因为这是一项角色政策)
  3. Leading spaces in json json 中的前导空格

A corrected version of your policy, which is reviewd to be good in IAM looks like this:您的政策的更正版本(在 IAM 中被审核为良好)如下所示:

{ 
   "Id":"Policy1571877681758",
   "Version":"2012-10-17",
   "Statement":[ 
      { 
         "Sid":"Stmt1571877676943",
         "Action":"sns:*",
         "Effect":"Allow",
         "Resource":"yourSNSARNHere"
      }
   ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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