AWS步骤函数状态。Format不使用策略

发布于 01-17 21:12 字数 1163 浏览 2 评论 0原文

我有一个步骤函数任务,我尝试根据作为输入传递的动态值设置 SQS 队列策略。不幸的是,每当我执行该步骤时它都会完成,但它分配给 Q 的策略文档无效,并且“State.Format”不起作用。

"SetQueueAttributes": {
  "Type": "Task",
  "Parameters": {
    "Attributes": {
      "Policy": {
        "Version": "2008-10-17",
        "Id": "__default_policy_ID",
        "Statement": [
          {
            "Sid": "Allow-SNS-SendMessage",
            "Effect": "Allow",
            "Principal": {
              "Service": "sns.amazonaws.com"
            },
            "Action": "sqs:SendMessage",
            "Resource": "States.Format('arn:aws:sqs:us-east-1:{}:{}', $.Account, $.tenantId)",
            "Condition": {
              "ArnEquals": {
                "aws:SourceArn": "States.Format('arn:aws:sns:us-east-1:{}:my-execution-results', $.Account)"
              }
            }
          }
        ]
      }
    },
    "QueueUrl.$": "$.CreatQueueResult.QueueUrl"
  },
  "Resource": "arn:aws:states:::aws-sdk:sqs:setQueueAttributes",
  "End": true
}

输入图片这里的描述

我在这里做错了什么吗?有可能做到这一点吗?

I have a step function task where I try to set an SQS queue policy based on dynamic values passed as input. Unfortunately, it completes whenever I execute the step, but the policy document it assigns to the Q is invalid, and "State.Format" does not work.

"SetQueueAttributes": {
  "Type": "Task",
  "Parameters": {
    "Attributes": {
      "Policy": {
        "Version": "2008-10-17",
        "Id": "__default_policy_ID",
        "Statement": [
          {
            "Sid": "Allow-SNS-SendMessage",
            "Effect": "Allow",
            "Principal": {
              "Service": "sns.amazonaws.com"
            },
            "Action": "sqs:SendMessage",
            "Resource": "States.Format('arn:aws:sqs:us-east-1:{}:{}', $.Account, $.tenantId)",
            "Condition": {
              "ArnEquals": {
                "aws:SourceArn": "States.Format('arn:aws:sns:us-east-1:{}:my-execution-results', $.Account)"
              }
            }
          }
        ]
      }
    },
    "QueueUrl.
quot;: "$.CreatQueueResult.QueueUrl"
  },
  "Resource": "arn:aws:states:::aws-sdk:sqs:setQueueAttributes",
  "End": true
}

enter image description here

Am I doing something wrong here? is it even possible to do this?

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

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

发布评论

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

评论(1

秋风の叶未落2025-01-24 21:12:38

我自己发现 States.Format 就像 JSON 路径选择器一样,因此任何策略键都必须以 .$ 结尾,以便 States.Format 正常工作

I figured it out myself States.Format is just like JSON path selector so any policy key must end with .$ in order for States.Format to work properly

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文