How to extract part of the string from `$$.Execution.Name` in AWS step function?

不打扰是莪最后的温柔 提交于 2021-02-04 08:28:24

问题


From this page: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html

I'm using "TransformJobName.$": "$$.Execution.Name" to define a dynamic SageMaker job name since the name needs to be unique otherwise statemachine will fail

When I executed the statemachine, I got the error below:

{
  "resourceType": "sagemaker",
  "resource": "createTransformJob.sync",
  "error": "SageMaker.AmazonSageMakerException",
  "cause": "2 validation errors detected: Value '808bxx-xxxx-xxxx-xxxx-c831xxxxxx1_xxxxx0-xxxx-xxxx-xxxx-12345b071e5e' at 'transformJobName' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}; Value '808bxx-xxxx-xxxx-xxxx-c831xxxxxx1_xxxxx0-xxxx-xxxx-xxxx-xxxxxxxx71e5e' at 'transformJobName' failed to satisfy constraint: Member must have length less than or equal to 63 (Service: AmazonSageMaker; Status Code: 400; Error Code: ValidationException; Request ID: xxxxxxxxxxx; Proxy: null)"
}

How can I modify the definition file to make the job name to meet the requirement, something like myjobname-12345b071e5e, where 12345b071e5e is the final bit of the the Execution.Name?

I also tried "TransformJobName.$": "$$.Execution.StartTime", but it gave me error 1 validation error detected: Value '2021-01-14T16:15:14.437Z' at 'transformJobName' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62} (Service: AmazonSageMaker; Status Code: 400; Error Code: ValidationException; Request ID: xxxxxxxxxxxx; Proxy: null)

I've been struggling with this issue for a whole day now, can someone help please? Thanks in advance.

来源:https://stackoverflow.com/questions/65722714/how-to-extract-part-of-the-string-from-execution-name-in-aws-step-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!