我正在使用 awscli 尝试自动化部署过程(将食谱更改上传到 s3,单击内容以更新食谱,单击内容以运行食谱,输入我要执行的食谱的名称)。

我真的很接近,但我找不到任何关于如何通过 awscli 在 opsworks 中实际执行给定配方的信息。我认为它必须非常接近更新自定义食谱:

$ aws opsworks create-deployment --command "{\"Name\":\"update_custom_cookbooks\"}"  --stack-id xxxxx --instance-ids xxxxxxxxx
xxxxxxxx #deployment id

文档没有告诉我“execute_recipes”命令的格式是什么:http://docs.aws.amazon.com/cli/latest/reference/opsworks/create-deployment.html

在向它发送了一堆猜测并使用了极具洞察力的“无效值”、SerializationException 和 ValidationExceptions 之后,我推断出以下内容可能与我想要的很接近:
$ aws opsworks create-deployment --command "{\"Name\":\"execute_recipes\", \"Args\":{\"Recipes\":[\"book::recipe\"]}}"  --stack-id xxxxxx --instance-ids xxxxxxxx
A client error (ValidationException) occurred

让 Opsworks 在给定实例上执行配方的正确 JSON 模式是什么?

最佳答案

编辑:示例已修复,已添加说明

awscli 元数据非常挑剔,大小写很重要。您只需将命名参数“Recipes”更改为“recipes”,您的命令就会向 AWS 发送一个新的部署命令。

aws opsworks create-deployment --stack-id xxxx --command '{ "Name": "execute_recipes", "Args": {"recipes": ["book:rec"]}}' --instance-ids xxxx

补充讨论:
https://forums.aws.amazon.com/thread.jspa?messageID=469835&#469835

关于amazon-web-services - 自动化 Opsworks : How do you execute recipes?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20204519/

10-12 20:53