"AWS OpsWorks helps you deploy and operate applications of all shapes and sizes. With AWS OpsWorks, you can model your application stack with layers that define the building blocks of your application: load balancers, application servers, databases, etc.
But did you know that you can also extend AWS OpsWorks layers or build your own custom layers? Whether you need to perform a specific task or install a new software package, AWS OpsWorks gives you the tools to install and configure your instances consistently and help them evolve in an automated and predictable fashion.
In this session, we dive into the development process including how to use attributes, recipes, and lifecycle events; show how to develop your environment locally; and provide troubleshooting steps that reduce your development time."
34. list
# list event history (up to 10 events)
# opsworks-agent-cli list
2014-11-06T10:26:58setup
2014-11-06T10:55:13configure2014-11-06T14:59:05execute_recipes
2014-11-07T18:25:53deploy
2014-11-07T18:34:11configure
2014-11-08T10:05:23configure
2014-11-08T14:43:43configure
35. get
# show JSON events (latest or by type/timestamp)
# opsworks-agent-cli get
{
"ssh_users": {
"2066": {
"name": "thomas",
"public_key": "ssh-rsa AAAAB3NzaC1...",
"sudoer": true
...
36. # list current agent folder and cookbooks
# ls/opt/aws/opsworks/current
cookbooks# OpsWorks cookbooks
berkshelf-cookbooks# CookbooksfromBerkshelf
site-cookbooks# Yourcookbooks
merged-cookbooks# Resultingcookbooksforrun
...
37. run
# run last setup event (changed cookbooks, same JSON)
# opsworks-agent-cli run setup
# or select specific date
# opsworks-agent-cli run 2014-11-08T14:43:43
[2014-11-12 13:06:41] INFO [opsworks-agent(17817)]:About to re-run 'setup' from 2014-11-08T14:43:43
Waiting for process 17817
...
Finished Chef run with exitcode 0
38. # change recipe
# cd /opt/aws/opsworks/current/site-cookbooks
# vim mycookbooks/recipes/default.rb
# confirm success
# opsworks-agent-cli run setup
# commit back to your git repo
# git commit -am “can develop on instance“
# git push
47. ‣attributes
‣recipes
‣templates
▾test
▾integration
▾default<--test suite name
‣bats<--test framework
.kitchen.yml
metadata.rb
48. ‣attributes
‣recipes
‣templates
▾test
▾integration
▾default<--test suite name
▾bats<--test framework
htop_installed.bats<--the actual test
.kitchen.yml
metadata.rb
49. Test file htop_installed.bats
#!/usr/bin/env bats
@test "htop binary is found in PATH"{
run which htop
[ "$status"-eq 0 ]
}