从AWS CLI中的本地文件加载参数

发布于 2025-01-25 06:45:37 字数 1471 浏览 1 评论 0原文

我正在尝试从AWS CLI创建胶水工作。当我在中使用实际的胶合作业名称 - 名称字段时,它可以

aws glue create-job \
    --name my-first-glue-job-cli \
    --role arn:aws:iam::***:role/GlueRole \
    --command file://command.json \
    --region us-east-2 \
    --output json \
    --default-arguments file://arguments.json \
    --glue-version 3.0 \
    --profile ***

工作- Default-arguments/- 命令

我知道后两个选项是结构/地图类型,-name是字符串类型。我已经通过 glue文档

也通过 cli文档从文件加载参数。他们只提到JSON用例。

我尝试从创建的本地TXT文件加载值,并将作业名称放入该TXT文件中。

aws glue create-job \
    --name file://gluejobname.txt \
    --role arn:aws:iam::***:role/GlueRole \
    --command file://command.json \
    --region us-east-2 \
    --output json \
    --default-arguments file://arguments.json \
    --glue-version 3.0 \
    --profile ***

显示错误是:

An error occurred (ValidationException) when calling the CreateJob operation: 1 validation error detected: Value 'my-first-glue-job-cli
' at 'name' failed to satisfy constraint: Member must satisfy regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*

I am trying to create a glue job from AWS CLI. It works when I use the actual Glue Job name in the --name field

aws glue create-job \
    --name my-first-glue-job-cli \
    --role arn:aws:iam::***:role/GlueRole \
    --command file://command.json \
    --region us-east-2 \
    --output json \
    --default-arguments file://arguments.json \
    --glue-version 3.0 \
    --profile ***

But I want the value attached in the --name parameter to be loaded from a file just like --default-arguments / --command

I understand the latter two options are structure/map type and --name is of string type. I have gone through the glue documentation

Also went through the cli documentation to load parameters from a file. They only mention json use-cases.

I tried loading the value from a local txt file I created and put the job-name inside that txt file.

aws glue create-job \
    --name file://gluejobname.txt \
    --role arn:aws:iam::***:role/GlueRole \
    --command file://command.json \
    --region us-east-2 \
    --output json \
    --default-arguments file://arguments.json \
    --glue-version 3.0 \
    --profile ***

Error being displayed is:

An error occurred (ValidationException) when calling the CreateJob operation: 1 validation error detected: Value 'my-first-glue-job-cli
' at 'name' failed to satisfy constraint: Member must satisfy regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疯到世界奔溃 2025-02-01 06:45:37

CLI将以file> file://gluejobname.txt接受标量参数。使用未引用的文字,没有新线!

或者,使用-cli-Input-json flag传递所有参数作为单个JSON文件。例如:

# Generate a template (optional):
aws glue get-job --generate-cli-skeleton > params.json
// params.json
{ "JobName": "" }
# pass all params in one file
aws glue get-job --cli-input-json file://params.json

The cli will accept a scalar parameter from a file as file://gluejobname.txt. Use unquoted text, no newlines!

Alternatively, pass all params as a single JSON file using the --cli-input-json flag. For example:

# Generate a template (optional):
aws glue get-job --generate-cli-skeleton > params.json
// params.json
{ "JobName": "" }
# pass all params in one file
aws glue get-job --cli-input-json file://params.json
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文