Automating Opsworks: How do you execute recipes?
amazon-ec2, amazon-web-services, automation
Solution
edit: example fixed, explanation added
awscli metadata is extremely finnicky and lower/upper case matters. You just have to change the named argument "Recipes" to "recipes" and your command should send a new deployment command to AWS.
aws opsworks create-deployment --stack-id xxxx --command '{ "Name": "execute_recipes", "Args": {"recipes": ["book:rec"]}}' --instance-ids xxxx
additional discussion: https://forums.aws.amazon.com/thread.jspa?messageID=469835񲭋
Problem
I'm using the awscli to try to automate a deployment process (upload cookbook changes to s3, click stuff to update cookbooks, click stuff to run a recipie, type in the name of the recipe i want to execute). I'm really close, but I can't find anything about how to actually execute a given recipe in opsworks through the awscli. I figure it must be awfully close to updating custom cookbooks: ``` $ aws opsworks create-deployment --command "{\"Name\":\"update_custom_cookbooks\"}" --stack-id xxxxx --instance-ids xxxxxxxxx xxxxxxxx #deployment id ``` The documentation doesn't tell me what the format is for the 'execute_recipes' command: http://docs.aws.amazon.com/cli/latest/reference/opsworks/create-deployment.html After sending it a bunch of guesses and using the gloriously insightful "Invalid value", SerializationException, and ValidationExceptions I have deduced that the following is probably close to what I want: ``` $ aws opsworks create-deployment --command "{\"Name\":\"execute_recipes\", \"Args\":{\"Recipes\":[\"book::recipe\"]}}" --stack-id xxxxxx --instance-ids xxxxxxxx A client error (ValidationException) occurred ``` What is the correct JSON schema for getting Opsworks to execute a recipe on a given instance?