问题描述
使用以下步骤函数状态定义,我想引用我在命令运行器参数中传递给它的月份、日期、年份参数。现在,连接意外地评估为 "--src=s3://arn:aws:s3::: bababucketName/$.YEAR/$.MONTH/$.DAY/"
。有没有办法在云形成函数中使用阶跃函数参数?
"copyFromS3": {
"Type": "Task","Resource": "arn:aws:states:::elasticmapreduce:addStep.sync","Parameters": {
"ClusterId.$": "$.cluster.ClusterId","Step": {
"Name": "copyFromS3","HadoopJarStep": {
"Jar": "command-runner.jar","Args": [
"s3-dist-cp",{
"Fn::Join" : [ "",[
"--src=s3://",{ "Ref": "VehicleDataBucket" },"telemetry/","$.YEAR","/","$.MONTH","$.DAY","/"
]
]
},"--dest=hdfs:///output"
]
}
}
},
解决方法
请查看 States.Array 内部函数。 https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html
此外,AWS 刚刚发布了这个新工具,以便更轻松地开发工作流程。这应该可以帮助您编写状态机定义。 https://docs.aws.amazon.com/step-functions/latest/dg/workflow-studio.html