5. Chef Setup in OpsWorks
• Supported Chef versions: 0.9, 11.4 or 11.10
• Built-in convenience cookbooks / bring your own
• Chef run is triggered by life cycle event firing
• Event comes with stack state JSON
15. Events
Events are triggered when your stack changes:
• Give you fine-grained control
• Faster to execute
• Context: run_list per event per layer (aka role)
22. Setup Event
• Sent when instance boots
• Includes deploy event
• Use for initial installation
of software & services
23. Setup Event – Recipe Execution Order
AWS
OpsWorks
setup recipes
Your setup
recipes
AWS
OpsWorks
deploy recipes
Your deploy
recipes
24. Configure Event
• Sent to all instances when
any instance enters or
leaves online state
• Use for making sure the
configuration is up-to-date
25. Deploy Event
• Sent you deploy via UI/API
also part of each setup
• Use for custom deployment
26. Undeploy Event
• Sent via UI/API when
apps are deleted
• Use to remove apps from
running instances
27. Shutdown Event
• Sent when an instance
is shut down
• ~45s to execute
• Use for clean shutdown
28. Stack State JSON
Each event gets JSON / attributes that define the
current stack state:
node[:opsworks]
node[:opsworks][:layers]
node[:opsworks][:instance]
node[:opsworks][:stack]
30. Search
Stack state JSON available through search
search(:node, “name:web1”)
search(:node, “name:web*”)
Attributes generated on nodes are not available
31. Search
appserver = search(:node, "role:php-app").first
Chef::Log.info(”Private IP: #{appserver[:private_ip]}")
Exposes: hostname/fqdn, IP/DNS, private IP/DNS,
instance type, AMI ID, AZ, …
32. Roles
OpsWorks layers mapped as roles
search(:node, “role:rails-app”)
search(:node, “role:custom-foo”)
Complete role functionality depends on supporting a
“full” chef repo
42. Main Differences To Chef Server
• One run vs. discrete events
• Push vs. pull
• Discovery: search & AWS OpsWorks attribute tree
• Encrypted data bags
• Environments & roles
43. AWS OpsWorks
• Life cycle framework
• Highly customizable –
in the end everything is a Chef run
• Expect us to integrate more over time
44. More information about AWS OpsWorks
• Follow us on twitter @AWSOpsWorks
• Find us on YouTube
• Docs: http://aws.amazon.com/documentation/opsworks
• Blog: http://blogs.aws.amazon.com/application-management