使用文档源选项创建IoT作业模板。

0

【以下的问题经过翻译处理】 我可以使用 --document 选项创建一个作业模板,像这样:

$ aws iot create-job-template --job-template-id 'test-job-template' --description 'test job template' --document '{"version":"1.0","steps":[{"action":{"name":"Run-Command","type":"runCommand","input":{"command":"ls"},"runAsUser":"root"}}]}'

然而,如果我执行以下操作,我会收到“作业文档源无效 ${aws:iot:s3-presigned-url:https://s3.amazonaws.com/jobsdocs/testDoc.json}(InvalidRequestException)” 的错误提示:

aws iot create-job-template --job-template-id 'test-job-template' --description 'test job template' --document-source '${aws:iot:s3-presigned-url:https://s3.amazonaws.com/jobsdocs/testDoc.json}'

谢谢, Gary

profile picture
EXPERT
asked 6 months ago13 views
1 Answer
0

【以下的回答经过翻译处理】 我刚意识到您正在将S3对象链接包装到作业文档中的预签名URL占位符中。这是不正确的。为了澄清一下:

*在CLI命令中嵌入作业文档的正文时,请使用 --document

  • 当您的工作文档位于S3存储桶中时,请使用 --document-source。 *仅当作业文档的正文引用另一个S3对象时才需要预签名URL占位符。该占位符应仅出现在作业文档的正文中。 *使用 --document-source时,在CLI命令中不需要使用预签名URL占位符。

因此,您的第二个命令应该是:

aws iot create-job-template --job-template-id 'test-job-template' --description 'test job template' --document-source https://s3.amazonaws.com/jobsdocs/testDoc.json'

如果 testDoc.json 包括一个预签名占位符,则还需要 --presigned-url-config

profile picture
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions