0

在“本地”模式下使用 AWS Step Functions 状态机 (SFSM),即在我的笔记本电脑上的 Docker 中运行

试图在我的笔记本电脑主机上运行指向模拟服务的任务

我可以在 Docker 上正确安装 SFSM,更新它,运行它

aws stepfunctions --endpoint http://localhost:8083 create-state-machine \
    --definition file://src/my_sfn.json \
    --role-arn 'arn:aws:iam::ACCTNUM:role/DummyRole' \
    --name my_sfn

我可以curl http://host.docker.internal:5000从 docker 运行并连接到 moto_server

我在 SFSM 容器上安装了 aws cli,然后运行aws sns --endpoint http://host.docker.internal:5000 list-topics它显示了正确的主题

我在我的 docker env 文件中设置了 SNS_ENDPOINT url 以指向主机

但是如果运行 SFSM,我总是会收到 404 Not Found 错误:

2021-03-04 18:59:24.472: arn:aws:states:us-east-1:ACCTNUM:execution:my_sfn:7151fcf4-7e6f-4b16-9b64-2ac913e27e4c : {"Type":"TaskSubmitFailed","PreviousEventId":4,"TaskSubmitFailedEventDetails":{"ResourceType":"sns","Resource":"publish","Error":"SNS.AmazonSNSException","Cause":"null (Service: AmazonSNS; Status Code: 404; Error Code: 404 NOT FOUND; Request ID: null; Proxy: null)"}}
2021-03-04 18:59:24.473: arn:aws:states:us-east-1:ACCTNUM:execution:my_sfn:7151fcf4-7e6f-4b16-9b64-2ac913e27e4c : {"Type":"ExecutionFailed","PreviousEventId":5,"ExecutionFailedEventDetails":{"Error":"SNS.AmazonSNSException","Cause":"null (Service: AmazonSNS; Status Code: 404; Error Code: 404 NOT FOUND; Request ID: null; Proxy: null)"}}

my_sfn.json:

{
    "StartAt": "step1",
    "States": {
        "step1": {
            "Type": "Task",
            "Resource": "arn:aws:states:::sns:publish",
            "Parameters":{
                "Message":{"Input":"howdy"},
                "TopicArn":"arn:aws:sns:us-west-2:ACCTNUM:foo"
            },
            "End": true
        }
    }
}

码头工人-env.txt:

SNS_ENDPOINT=http://host.docker.internal:5000

知道如何解决吗?

4

1 回答 1

1

看起来我必须向环境文件添加更多信息:

AWS_ACCOUNT_ID=123456789012
AWS_ACCESS_KEY_ID=AAAAAAAAAAAAAAAA
AWS_SECRET_ACCESS_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AWS_DEFAULT_REGION=us-west-2

始终使用相同的帐户 ID 和区域,并且有效

于 2021-03-05T21:30:05.413 回答