AWS:使用事件桥在S3对象创建上触发步骤函数状态计算机无效

发布于 2025-01-24 07:34:22 字数 1088 浏览 0 评论 0原文

我在S3存储桶上启用了Amazon Eventbridge的通知。

然后我创建了一个具有以下事件模式的EventBridge规则:

{
  "detail": {
    "bucket": {
      "name": ["arn:aws:s3:::my-bucket"]
    }
  },
  "detail-type": ["Object Created"],
  "source": ["aws.s3"]
}

然后,我将状态计算机作为此规则的目标。我还在此事件目标的以下政策中附上了IAM角色。

"Statement": [
        {
            "Effect": "Allow",
            "Action": [ "states:StartExecution" ],
            "Resource": [ "arn:aws:states:*:*:stateMachine:*" ]
        }
    ]

然后,我也将以下策略附加到我的状态机器步骤功能上:

{ 
        "Action": "events:*", 
        "Resource": "arn:aws:events:us-east-1:my-account-id:event-bus/default", 
        "Effect": "Allow" 
      }

完成所有操作后,我的状态机仍未被调用。

我在这里缺少什么?我该如何调试问题可能在哪里?

I enabled notifications for Amazon EventBridge on my s3 bucket.
enter image description here

Then I created an EventBridge rule with the following event pattern:

{
  "detail": {
    "bucket": {
      "name": ["arn:aws:s3:::my-bucket"]
    }
  },
  "detail-type": ["Object Created"],
  "source": ["aws.s3"]
}

Then I added my state machine as the target of this rule. I also attached an IAM role with the following policy for this event target.

"Statement": [
        {
            "Effect": "Allow",
            "Action": [ "states:StartExecution" ],
            "Resource": [ "arn:aws:states:*:*:stateMachine:*" ]
        }
    ]

Then I attached the following policy to my state machine step function as well:

{ 
        "Action": "events:*", 
        "Resource": "arn:aws:events:us-east-1:my-account-id:event-bus/default", 
        "Effect": "Allow" 
      }

After doing all of this, still my state machine is not getting invoked.
enter image description here

What am I missing here? How can I debug where the issue might be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

む无字情书 2025-01-31 07:34:22

您是否检查了您的自定义模式与事件匹配?
我认为您不需要名称中的arn
尝试

{
  "detail": {
    "bucket": {
      "name": ["my-bucket"]
    }
  },
  "detail-type": ["Object Created"],
  "source": ["aws.s3"]
}

Have you checked if your custom pattern matches the event?
I think you do not need arn in the name.
Try with

{
  "detail": {
    "bucket": {
      "name": ["my-bucket"]
    }
  },
  "detail-type": ["Object Created"],
  "source": ["aws.s3"]
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文