[英]Storing yaml into AWS SSM store
I have the following YAML file(sample content in the below section) which I would like to store in AWS-SSM.我有以下 YAML 文件(以下部分中的示例内容),我想将其存储在 AWS-SSM 中。 Each property in YAML should be kept as a key/value pair in the AWS parameter store.
YAML 中的每个属性都应作为键/值对保存在 AWS 参数存储中。
doe: "a deer, a female deer"
ray: "a drop of golden sun"
pi: 3.14159
xmas: true
french-hens: 3
calling-birds:
- huey
- dewey
- louie
- fred
xmas-fifth-day:
calling-birds: four
french-hens: 3
golden-rings: 5
partridges:
count: 1
location: "a pear tree"
turtle-doves: two
In SSM it should be stored as,在 SSM 中,它应该存储为,
name=xmas-fifth-day/partridges/count
value=1
name=xmas-fifth-day/partridges/location
value=a pear tree
etc etc.
There is a library for json2SSM it would be great if we have one for yaml2SSM or if we can able to achieve it using was AWS-CLI command is exceptionally grateful.有一个用于json2SSM的库,如果我们有一个用于 yaml2SSM 的库,或者如果我们能够使用 AWS-CLI 命令实现它,那就太好了。非常感谢。
AWS SSM PUT_PARAMETERS support yaml-input
but the format YAML is different than the one I have. AWS SSM PUT_PARAMETERS 支持
yaml-input
但格式 YAML 与我的格式不同。 If converting the YAML to a different one is the only solution then do we have any simple way to convert it?如果将 YAML 转换为另一个不同的解决方案是唯一的解决方案,那么我们是否有任何简单的方法来转换它? Any python/js/java library which converts the format?
任何转换格式的 python/js/java 库?
you can convert yaml to json with yq
.您可以使用
yq
将 yaml 转换为 json。
# install on mac
brew install yq
yq -o=json ssm-input.yml | json2ssm put-json --json-file /dev/stdin
yq -o=json ssm-input.yml
yq -o=json ssm-input.yml
json2ssm put-json --json-file /dev/stdin
send json file to SSM with json2ssm
json2ssm put-json --json-file /dev/stdin
使用json2ssm
发送json文件到SSM It supports encryption
as well.它还支持
encryption
。 See: https://github.com/b-b3rn4rd/json2ssm/blob/master/cmd/json2ssm/main.go#L25参见: https://github.com/b-b3rn4rd/json2ssm/blob/master/cmd/json2ssm/main.go#L25
Updated command with encryption:使用加密更新命令:
yq -o=json ssm-input.yml | json2ssm put-json --json-file /dev/stdin --encrypt
Update 2:更新 2:
{
"Parameters": [
{
"Name": "/path/to/base_linux_ami",
"Type": "String",
"Value": "ami-aminumber"
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.