我有一个AWS cli命令来更新dynamo db表中的项目:
aws dynamodb update-item --table-name pib-deployments --key '{“stackname”:{“S”:“factiva_search”}}' - update-expression'SET githuburl =:gu,ldapCommaSepList =:ll,lz =:lz,slackChannelName = :scn,slackToken =:st'--expression-attribute-values '{“:gu”:{“S”:“https://github.com/djin-infrastructure/djin_acntsvc_factiva_search.git”},“:ll”:{“S”:“gillinwar”},“:scn”:{“S”:“搜索” -aws-TF-工作“}, “:ST”:{ “S”: “MjcAvMeG9d2CExW6GzSURMqa”}, “:LZ”:{ “M”:{ “cntsvc”:{ “M”:{ “PROD”:{ “M”:{ “蓝色”:{ “M”:{ “弗吉尼亚”:{ “M”: {“approver”:{“S”:“lana”},“last_modified”:{“S”:“08/18/2017 11:00:29.450”},“status”:{“S”:“up” }}}}}}}}}}}}” - 返回值ALL_NEW
这给了我:
{
"githuburl": "https://github.com/djin-infrastructure/djin_acntsvc_factiva_search.git",
"ldapCommaSepList": "gillinwar",
"lz": {
"cntsvc": {
"prod": {
"blue": {
"virginia": {
"approver": "lana",
"last_modified": "08/18/2017 11:00:29.450",
"status": "up"
}
}
}
}
},
"slackChannelName": "search-on-aws-tf-jobs",
"slackToken": "MjcAvMeG9d2CExW6GzSURMqa",
"stackname": "factiva_search"
}
这就是我需要的。现在我需要在cntsvc
下添加另一个密钥来更新表,所以我使用:
aws dynamodb update-item --table-name pib-deployments --key '{“stackname”:{“S”:“factiva_search”}}' - update-expression'SET githuburl =:gu,ldapCommaSepList =:ll,lz =:lz,slackChannelName = :scn,slackToken =:st'--expression-attribute-values '{“:gu”:{“S”:“https://github.com/djin-infrastructure/djin_acntsvc_factiva_search.git”},“:ll”:{“S”:“gillinwar”},“:scn”:{“S”:“搜索” -aws-TF-工作“}, “:ST”:{ “S”: “MjcAvMeG9d2CExW6GzSURMqa”}, “:LZ”:{ “M”:{ “cntsvc”:{ “M”:{ “鹿”:{ “M”:{ “蓝色”:{ “M”:{ “弗吉尼亚”:{ “M”: {“approver”:{“S”:“lana”},“last_modified”:{“S”:“08/18/2017 11:00:29.450”},“status”:{“S”:“up” }}}}}}}}}}}}” - 返回值ALL_NEW
注意cli之间的唯一区别是prod变成了stag,我期待下面的树:
{
"githuburl":"https://github.com/djin-infrastructure/djin_acntsvc_factiva_search.git",
"ldapCommaSepList":"gillingwar",
"lz":{
"cntsvc":{
"prod":{
"blue":{
"virginia":{
"approver":"lana",
"last_modified":"08/18/2017 11:00:29.450",
"status":"up"
}
}
},
"stag":{
"blue":{
"virginia":{
"approver":"lana",
"last_modified":"08/18/2017 11:00:29.450",
"status":"up"
}
}
}
}
},
"slackChannelName":"search-on-aws-tf-jobs",
"slackToken":"MjcAvMeG9d2CExW6GzSURMqa",
"stackname":"factiva_search"
}
但我最终得到的是:
{
"githuburl": "https://github.com/djin-infrastructure/djin_acntsvc_factiva_search.git",
"ldapCommaSepList": "gillingwar",
"lz": {
"cntsvc": {
"stag": {
"blue": {
"virginia": {
"approver": "lana",
"last_modified": "08/18/2017 11:00:29.450",
"status": "up"
}
}
}
}
},
"slackChannelName": "search-on-aws-tf-jobs",
"slackToken": "MjcAvMeG9d2CExW6GzSURMqa",
"stackname": "factiva_search"
}
基本上我的树完全取代了新树而不是添加到它。任何想法为什么以及如何解决?