我正在构建一个用于使用ElasticSearch,Logstash和GoogleBigQuery处理数据的步进函数管道。我的第一步是长时间运行的Elasticsearch容器,该容器将异步执行,其输出将发送到第二步,第二步期望将privateIP作为ENV变量,但是,一旦异步启动第一步,就不会立即显示IP地址需要一些时间才能将IP分配给容器。有没有办法等到IP可用后再继续执行下一步?
我尝试与ecs:runTask.waitForTaskToken同步运行该步骤,并通过CLI发送SendTaskSuccess令牌,但是由于输出被覆盖,所以运气不佳。如果我不必再使用一个lambda函数,那就太好了。
我可能会采用另一种方法,从step函数中删除第一步,并使用单独的lambda函数启动集群,但想知道是否可以在step函数中完成所有操作,并且不会引入其他依赖项...
部分步骤功能,仅作为示例
"StartAt": "start_cluster",
"States": {
"start_cluster": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.waitForTaskToken", //ecs:runTask
"InputPath": "$",
"ResultPath": "$",
"OutputPath": "$",
"Parameters": {
"LaunchType": "FARGATE",
"Cluster": "arn:aws:ecs:REGION:ID:cluster/CLUSTER NAME",
"TaskDefinition": "arn:aws:ecs:REGION:ID:task-definition/TASK DEFINITION",
"NetworkConfiguration": {
"AwsvpcConfiguration": {
"AssignPublicIp": "ENABLED",
"Subnets": [
"subnet-XXX",
"subnet-XXX"
]
}
},
"Overrides": {
"ContainerOverrides": [
{
"Name": "CONTAINER NAME",
"Environment": [
{
"Name": "ES_HOST_IP",
"Value.$": "$.output.Tasks.Containers.NetworkInterfaces.privateIP"
},
{
"Name": "TOKEN",
"Value.$": "$$.Task.Token"
}
]
}
]
}
},
"Next": "wait_one_minute",
"TimeoutSeconds": 420
},
"wait_one_minute": {
"Type": "Wait",
"Seconds": 60,
"Next": "NEXT_STEP"
},
"NEXT_STEP": {
}
}
}```
I expect to continue on the next step once the privateIP is available