[英]How to escape curly bracket in AWS CLI Bash
I'm trying to use AWS CLI Lambda to replace environment variables. 我正在尝试使用AWS CLI Lambda替换环境变量。 However the value I want to replace has a pair of curly braces in it and CLI complaints about json format even when I already put the whole thing in single quote.
但是,即使我已经将整个内容放在单引号中,我要替换的值中也带有一对花括号,并且CLI抱怨json格式。 Here's my command:
这是我的命令:
aws lambda update-function-configuration --function-name myFunc --environment Variables={URL='http://example.com/api/{0}'}
Here's the error: 这是错误:
Error parsing parameter '--environment': Expected: ',', received: '}' for input:
The funny thing is that if I removed the closing bracket }
, it worked: 有趣的是,如果我删除了右括号
}
,它会起作用:
aws lambda update-function-configuration --function-name myFunc --environment Variables={URL='http://example.com/api/{0'}
Please help!!! 请帮忙!!!
Enclose in double quotes: 用双引号引起来:
Variables="{URL='http://example.com/api/{0}'}"
aws lambda update-function-configuration --function-name myFunc --environment Variables="{URL='http://example.com/api/{0}'}"
An error occurred (ResourceNotFoundException) when calling the UpdateFunctionConfiguration operation: Function not found: arn:aws:lambda:us-west-1:1234567890:function:myFunc
调用UpdateFunctionConfiguration操作时发生错误(ResourceNotFoundException):找不到函数:arn:aws:lambda:us-west-1:1234567890:function:myFunc
aws lambda update-function-configuration --function-name myFunc --environment "Variables={URL='http://example.com/api/{0}'}"
这是有关aws cli中双引号的详细问题https://github.com/aws/aws-cli/issues/2638
This worked, my command is different though. 这有效,但是我的命令却不同。
aws apigateway update-resource \
--rest-api-id <rest_api_id> \
--resource-id <resource_id> \
--patch-operations 'op=replace,path=/pathPart,value="{something}"'
The points are: 这些要点是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.