使用aws-cli将URL保存到AWS参数存储 [英] Saving a url to AWS parameter store with aws-cli

查看:196
本文介绍了使用aws-cli将URL保存到AWS参数存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我试图以编程方式将我的无服务器生成的API端点存储在参数存储中,以供另一个项目摄取.

Alright, so I'm trying to programmatically store my Serverless generated API endpoint in parameter store for another project to ingest.

仅作为示例,我将尝试存储google.com.

Just for an example, I'm going to try to store 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

但是,如果我将网址用引号引起来...

However, if I wrap the URL in quotes...

aws ssm put-parameter --name /dev/someStore --value "https://google.com" --type String

它仍然失败,并显示相同的错误.有什么方法可以阻止cli尝试评估URL并仅保存该死的字符串吗?

It still fails with the same error. Is there any way to stop the cli from trying to evaluate the URL and just save the goddamn string?

推荐答案

由于

This is happening because of a questionable behavior by the AWSCLI. When it sees a URL, it invokes an HTTP GET for a result.

您可以按照以下方法解决此问题:

You can work around this behavior as follows:

aws ssm put-parameter --cli-input-json '{
  "Name": "/dev/someStore",
  "Value": "https://google.com",
  "Type": "String"
}'

或者您可以将JSON存储在名为params.json的文件中并调用:

Or you can store the JSON in a file named params.json and invoke:

aws ssm put-parameter --cli-input-json file://params.json

您可以在 aws/aws-cli/issues/2507 .

这篇关于使用aws-cli将URL保存到AWS参数存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆