69
© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. AWS マイスターシリーズ AWS OpsWorks アマゾン データサービス ジャパン株式会社 プリンシパル ソリューションアーキテクト 荒 靖宏 ソリューションアーキテクト 崎 健治 re:Generate

[AWSマイスターシリーズ] AWS OpsWorks

Embed Size (px)

DESCRIPTION

 

Citation preview

  • 1. re:G eneAWS rateAWS OpsWorks 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

2. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 2 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 3. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 3 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 4. Introduction Most IT organizations still install and maintain computers the same way the automotive industry built cars in the early 1900's: An individual craftsman manually manipulates a machine into being, and manually maintains it afterward.IT1900 Steve Traugott, Sterling Software, NASA Ames Research Center http://www.infrastructures.org/bootstrap/ALL.shtml 4 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 5. Infrastructure as Code ! 1! Infrastructure as Code 5 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 6. ChefRight Scale State of 2013 industry survey http://www.rightscale.com/blog/cloud-industry-insights/rightscale-statecloud-2013-look-ahead 6 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 7. OpsWorks ! AWS DevOps Chef-Solo(Chef) 7 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 8. OpsWorks ! ! SaaS E Web 8 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 9. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 9 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 10. Chef ! ChefCookbook Cookbookpackage httpd install10httpd.co nf Ruby 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 11. Chef ! ! Recipe ! OS11 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 12. Chef ! Ruby # haproxy case node[:platform] when 'ubuntu' package 'haproxy' do action :install end end12 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 13. + Eric Joyner ericjoyner.com13 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 14. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 14 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 15. OpsWorks EC2 OpsWorks Agent talks withOpsWorks15 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 16. OpsWorks EC2 OpsWorks Agent OpsWorks AgentChef solo16 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 17. OpsWorks! AWS ! 17 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 18. ()OpsWorks OpsWorks S/W We HAProxy 18 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 19. AWS Elastic BeanstalkOpsWorksCloudFormation 19 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 20. OpsWorks ! AMI Amazon LinuxUbuntu 12.04LTS! Chef9,11 ! VPC VPC, VPC! ELB! OpsWorks 20 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 21. OpsWorks ! AWS! AWS CLI OpsWorksEndPointus-east-1( https://opsworks.us-east-1.amazonaws.com$ aws opsworks describe-stacks! AWS SDK for Java / .NET / PHP / Python / Ruby 21 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 22. OpsWorks )Stack (JSON)Load BalancerApp Server Database UserLBWeb /AppWeb /AppDBAWS Management Console22 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 23. OpsWorks ! Setup Configure Deploy Undeploy Shutdown 45 23 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 24. ! OpsWorks ! DB ! ! 24 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 25. ! EBS RAID Security Group 25 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 26. ! EC2 ! AZVPC 26 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 27. App ! ! Ruby on Rails / PHP / Node.js(JavaScript) / Static(HTML) / Other(Java)! Git / Subversion / HTTP archive / S3 Archive / Other27 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 28. OpsWorks ! 28 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 29. ! 24/7 29 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 30. ! Auto Healing agentOpsWorkspolling Auto Healing 3-5 OpsWorks Elastic IPElastic IPagentagent30 EIPEIP EBSEBS Volume 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 31. ! JSON"opsworks": { "layers": { "php-app": { "id": "4a2a56c8-f909-4b39-81f8-556536d20648", "instances": { "php-app2": { "elastic_ip": null, "region": "us-west-2", "booted_at": "2013-02-26T20:41:10+00:00", "ip": "192.112.235.192", "aws_instance_id": "i-34037f06", "availability_zone": "us-west-2a", "instance_type": "c1.medium", "private_dns_name": "ip-10-252-0-203.us-west-2.com "private_ip": "10.252.0.203", "created_at": "2013-02-26T20:39:39+00:00", "status": "online", "backends": 8, $ opsworks-agent-cli get-json "public_dns_name": "ec2-192-112-235-192.uswest-2.compute.amazonaws.com" }, "php-app1": { ... } }, "name": "PHP Application Server" }, 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. "lb": {! ! 31{ 32. ! ! ! SSH key GitHub Enterprise SSH32 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 33. ! Setup / Congure / Deploy ! Install Dependencies Ruby gems Update Dependencies Ruby gems Update Cookbooks cookbook Execute Recipes 33 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 34. ! CloudWatch CPU / Memory / Load / Processes 34 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 35. ! AWS OpsWorks ! OpsWorks { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:*", "s3:*", "opsworks:*", "iam:PassRole"], "Resource": "*" } ] }35 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 36. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 36 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 37. OpsWorks Stack HAProxy Layer Github Recipe & App RepositoryPHP App Server LayerPHPPHP AppPHPPHP AppMySQL LayerGanglia Layer37 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 38. OpsWorks ! VPC OpsWorks OpsWorks Private NAT PHP App Server Internet GatewayNAT VPC Public SubnetGithub Recipe RepositoryMySQL DB App Code Repository VPC Private Subnet Virtual Private Cloud38 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 39. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 39 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 40. Language Cloud ! ! OpsWorks AWSEC2 Continuous IntegrationJenkins statsd chefnode.jsWebAWS OpsWorks Language Cloud Co-founder,Franky Chung40 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 41. WorkFu ! ! HAProxy PHP App Server MySQL Memcached Que Worker RabbitMQ Sphinx! 1 41 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 42. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 42 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 43. OpsWorks ! /var/lib/aws/opsworks/chefChef /var/log/aws/opsworksOpsWorks! SSHagent CLI run_command43 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 44. Agenda ! ! ! ! ! ! ! Introduction Chef OpsWorks OpsWorks OpsWorks OpsWorks 44 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 45. ! OpsWorks ! Chef ! VPC DevOps 45 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 46. Links ! OpsWorks User Guide http://docs.aws.amazon.com/opsworks/latest/userguide/ welcome.html! OpsWorks http://aws.amazon.com/jp/opsworks/faqs/! http://tech-sketch.jp/2013/08/aws-opsworks.html! http://tech-sketch.jp/2013/08/aws-opsworks-1.html46 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 47. APPENDIX 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 48. Chef-Solohttpd(1) ! 1. Chef-Solo $ curl -L http://www.opscode.com/chef/install.sh | sudo bash! 2. Cookbook$ knife cookbook create apache -o cookbooks! 3. Chef-Solo2 $ cat > solo.rb file_cache_path "/tmp/chef-solo" cookbook_path ["/home/ec2-user/cookbooks"]48$ cat > localhost.json { "run_list" : [ "recipe[apache]" ] } 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 49. Chef-Solohttpd(2) ! 4. $ cat > ./cookbooks/apache/recipes/default.rb package httpd" do action :install end! 5. Chef-Solo $ sudo chef-solo -c solo.rb -j ./localhost.json49 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 50. App ServerRDS ! StackRDS! http://docs.aws.amazon.com/opsworks/latest/ userguide/customizing-rds.html 50 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 51. Git CodeJenkins BuildTestOpsWorks ProvisionDeployMonitor51 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 52. AWS Management Console 1. http://aws.amazon.com/jp/console 2. 3. OpsWorks52 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 53. Stack53 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 54. Stack54 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 55. PHP App Server Layer55 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 56. PHP App Server Layer56 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 57. PHP App Server LayerInstance 57 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 58. PHP App Server Layer Instance58 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 59. PHP App Server Layer Instance59 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 60. PHP App Server Layer Instance60 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 61. PHP App Server Layer Instance61 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 62. App ! NavigationApps62 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 63. Appgit://github.com/amazonwebservices/ opsworks-demo-php-simple-app.git63 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 64. App64 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 65. App Deploy65 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 66. App66 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 67. 67 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 68. App ! NavigationInstance68 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 69. App69 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.