文档定义了endpoint如此:
endpoint(String) - 发送请求的端点URI.默认端点是根据配置构建的
region.端点应该是一个字符串'https://{service}.{region}.amazonaws.com'.
我相信服务名称是StepFunctions,我正在使用该区域us-east-1,因此网址应该是:
https://stepfunctions.us-east-1.amazonaws.com
Run Code Online (Sandbox Code Playgroud)
但是,这似乎不对,这项服务的实际端点网址是什么?
编辑:(回答)
https://states.us-east-1.amazonaws.com
Run Code Online (Sandbox Code Playgroud) 我有一个步骤函数,它应该调用 API 网关资源而不是 lambda。这样做的语法是什么?
{"Comment": "A Hello World example of the Amazon States Language using a Pass state",
"StartAt": "QueueProducts",
"States": {
"GetProductsFromDb": {
"Type": "Task",
"Resource":"some-lambda",
"Next": "InvokeAPIGatewayWorkers"
}
},
"InvokeAPIGatewayWorkers":{
"Type": "Parallel",
"Branches": [
....]
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,是否可以在资源中调用 API 网关而不是“some-lamda”
I have a parallel task in the step function that contains two branches. The input was:
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
}
Run Code Online (Sandbox Code Playgroud)
Each branch return a json result like the following
Branch 1 (I used "OutputPath": "$"):
{
"requestType": "GrantAccess",
"DBUser": "exists",
"ADUser": "exists"
}
Run Code Online (Sandbox Code Playgroud)
Branch 2 (I used "ResultPath": "$.approvalStatus"):
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
"approvalStatus": "Approved"
}
Run Code Online (Sandbox Code Playgroud)
When both the branches complete, the output of the …
我正在考虑使用步骤函数每 30 秒轮询一次来自外部数据库的更新,并运行映射 lambda 将数据存储在 s3 中。
实现步骤函数非常简单。我注意到限制的有效期为一年。http://docs.aws.amazon.com/step-functions/latest/dg/limits.html
我的问题是这是否有效,或者为此目的使用步骤函数是否存在缺陷。对于我的场景来说,每 1000 步 0.025 的价格是可以接受的。
我有以下步骤功能。执行在选择状态下失败。
"States": {
"Process": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123:function:dummy1",
"OutputPath": "$",
"Next": "ChoiceStatePre"
},
"ChoiceStatePre": {
"Type": "Choice",
"Choices": [{
"Variable": "$.status_pre",
"Next": "Series0",
"NumericEquals": 1
}, {
"Variable": "$.status_pre",
"Next": "MatchStatePre",
"NumericEquals": 8
}]
},
"MatchStatePre": {
"Type": "Task",
"Next": "PreProcess",
"Resource": "arn:aws:states:us-east-1:123:activity:dummy2"
},
"Series0": {
"Resource": "arn:aws:lambda:us-east-1:123:function:dummy3",
"Type": "Task",
"InputPath": "$.seq0.step0",
"ResultPath": "$.seq0.step0",
"OutputPath": "$",
"Next": "ChoiceStateTrigger0"
}
}
Run Code Online (Sandbox Code Playgroud)
错误 -
{
"error": "States.Runtime",
"cause": "An error occurred while executing the state 'ChoiceStatePre'
(entered at the event id …Run Code Online (Sandbox Code Playgroud) 我想使用 Terraforms api_gateway_integration和sfn_state_machine使用 API 网关创建一个步进函数 API。
我现在必须在 api_gateway_integration 处填写uri 参数。
我的 step 函数已创建,我可以引用 step 函数的 id(类似于arn:aws:states:*region*:*account*:stateMachine:*step-function-name*:stateMachine:*step-function-entry-point*)。
如果 AWS 阶跃函数是目标,谁能告诉我该方案或 uri 参数外观的示例?
resource "aws_api_gateway_integration" "endpoint_integration" {
...
integration_http_method = "POST"
type = "AWS"
uri = <<<<< What to place here???
}
Run Code Online (Sandbox Code Playgroud) amazon-web-services terraform aws-api-gateway aws-step-functions
我正在研究AWS步骤功能,但是无法找到用例需要的问题的答案。假设我们总体上可以完成10个任务。有时,我们必须按顺序执行任务1、3,有时执行4、8,而有时执行1、9、5。
要执行的任务及其执行顺序由传入json数据到系统中确定。
我想知道是否可以根据出现的需求动态创建步进功能。
我正在尝试创建一个可以调用另一个状态机的状态机。我尝试使用以下方法来获取 ARN。但是,这会返回错误 Arn is not a valid property,正在创建哪个堆栈。
ParentStateMachine:
Type: "AWS::StepFunctions::StateMachine"
Properties:
StateMachineName: !Sub "ParentStateMachine"
DefinitionString:
Fn::Sub:
- |-
{
"Comment": "...",
"StartAt": "State1",
"States": {
"State1": {
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution.sync",
"Parameters": {
"StateMachineArn": "${ChildStateMachineArn}",
"Input": {
"StatePayload": {
"datasetDate.$": "$.datasetDate"
},
"AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id"
}
},
"End": true
}
}
}
- {
ChildStateMachineArn:
Fn::GetAtt:
- ChildStateMachine
- Arn
}
RoleArn:
Fn::GetAtt:
- StatesExecutionRole
- Arn
Run Code Online (Sandbox Code Playgroud)
我还尝试使用此字符串生成 ARN。
arn:aws:states:${AWS::Region}:${AWS::AccountId}:stateMachine:ChildStateMachine
Run Code Online (Sandbox Code Playgroud)
但是,这给出了错误
Failed to call Step Functions for request: 'com.amazonaws.services.stepfunctions.model.CreateStateMachineRequest'. (Service: …Run Code Online (Sandbox Code Playgroud) 我创建了 3 个 Glue 作业,其中作业参数键/值之一如下所示: runid id
如果我像这样使用 AWS CLI 执行 Glue 作业,则它工作正常: awsglue start-job-run --jobname $job --arguments='--runid="Runid_10"'
这 3 个 Glue 作业位于一步函数和状态机内,定义为:
{
"Comment":"Sample Step Function",
"StartAt":"First Glue Job",
"States": {
"First Glue Job":{
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName": "GlueJob-Firstjob"
},
"Next": "Second Glue Job"
},
"Second Glue Job":{
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName": "GlueJob-Secondjob"
},
"Next": "Third Glue Job"
},
"Third Glue Job":{
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName": "GlueJob-Thirdjob"
},
"End": true …Run Code Online (Sandbox Code Playgroud) 我在AWS Step Functions 中定义了一个管道。一个步骤被定义为Fargate Task,它拉取一个 docker 镜像并运行一些 python 代码。我惊讶地发现,如果在 Fargate 任务中运行的容器遇到运行时错误,Step Functions 不会捕获失败的任务并照常继续管道(将 Fargate 任务设置为成功),但根据文档,管道一旦发生这种情况,应该会失败。
这是阶跃函数定义:
{
"Comment": "My state machine",
"StartAt": "MyFargateTask",
"States": {
"MyFargateTask": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"InputPath": "$",
"Parameters": {
"Cluster": "my-cluster",
"TaskDefinition": "arn:aws:ecs:us-east-1:617090640476:task-definition/my-task:1",
"LaunchType": "FARGATE",
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"Subnets": [
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-yyyyyyyyyyyyyyyyy"
],
"AssignPublicIp": "ENABLED"
}
},
},
"Next": "Done"
},
"Done": {
"Type": "Succeed"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我已经为 Fargate 容器尝试了以下简单的 python 代码:
def main():
raise Exception("foobar") …Run Code Online (Sandbox Code Playgroud) debugging amazon-web-services aws-step-functions aws-fargate
aws-fargate ×1
aws-glue ×1
aws-lambda ×1
aws-sdk ×1
debugging ×1
json ×1
jsonpath ×1
terraform ×1