好吧,所以我尝试以编程方式将无服务器生成的 API 端点存储在参数存储中,以供另一个项目摄取。
举个例子,我将尝试存储 google.com。
aws ssm put-parameter --name /dev/someStore --value https://google.com --type String
这失败了,这是可以理解的。
Error parsing parameter '--value': Unable to retrieve https://google.com: received non 200 status code of 301
但是,如果我将 URL 用引号引起来...
aws ssm put-parameter --name /dev/someStore --value "https://google.com" --type String
它仍然失败并出现相同的错误。有什么方法可以阻止 cli 尝试评估 URL 并只保存该死的字符串吗?
发生这种情况是因为可疑的行为 https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-file-remote通过 awscli v1。当它看到 URL 时,它会调用 HTTP GET 来获取结果。这在 awscli v2 中不会发生 https://docs.aws.amazon.com/cli/latest/userguide/cliv2-migration.html#cliv2-migration-paramfile.
您可以按如下方式解决此问题:
aws ssm put-parameter --cli-input-json '{
"Name": "/dev/someStore",
"Value": "https://google.com",
"Type": "String"
}'
或者您可以将 JSON 存储在名为 params.json 的文件中并调用:
aws ssm put-parameter --cli-input-json file://params.json
根本问题已报告于aws/aws-cli/问题/2507 https://github.com/aws/aws-cli/issues/2507.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)