- 1. re:G eneAWS rateAWS ElasticBeanstalk 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 ! AWS Elastic Beanstalk? Elastic Beanstalk! Auto
Scaling ! Advanced Tips VPC ! 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. AWS ElasticBeanstalk InstanceWARdeploy!Instance
CloudWatchJavaPythonAmazon RDSElastic Load BalancerPHP.NETAuto
scaling GroupRubynodeJS3 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.
AWS Elastic BeanstalkOpsWorksCloudFormation 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. ElasticBeanstalk Application
Environment URLEnvironment ConfigurationEnvironment URLEnvironment
ConfigurationVersion Respository WAR/ZIP WAR/ZIP WAR/ZIPEnvironment
URLEnvironment ConfigurationWAR/ZIPConfiguration Template5 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. ! ! SSH, AMIApplication
Environment URLEnvironment ConfigurationAMI Admin AWS Management
ConsoleInstanceUsersElastic Load BalancerAmazon RDSSSHInstance
CloudWatchAuto Scaling GroupDeveloperWAR6 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. Single Instance EnvironmentURLManagement
ConsoleSNSHM EC2 eclipseCloudWatchS3AutoScalingELB ElasticBeanstalk
API 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. !
Application ApplicationEnvironmentVersion WAR/ZIP ! Environment URL
URLXXX.elasticbeanstalk.com EC2ELB 1S38 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. ! Version Web S3 VersionWAR/ZIPEnvironment 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. !
/JavaPythonPHP.NETRubyJavaApache +Tomcat6, Apache+
Tomcat7.NETIIS7.5, IIS8PHPApache + mod_phpPythonApache +
mod_wsgiRubyNginx + PassengerNode.jsnodeJSNginx / Apache +
node.js10 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. ! ! IDE
Eclipse Java VisualStudio .Net! AWS SDKEclipse Java, PHP, Ruby,
Python, .Net ! AWS CLI$ aws elasticbeanstalk ! eb 11 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. eb: CLIElasticBeanstalk !
eb init ! eb start ! eb status ! eb update ! eb stop ! eb delete
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. eb ebinit ELB
Autoscalingeb updateebstart Conguration CreatedLaunching
ebdeleteReadyeb stopebdeleteUpdatingeb startTerminating , e.g.:
AutoscalingNot Running ELB 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 ! Elastic Beanstalk? Elastic Beanstalk!
Auto Scaling ! Advanced Tips VPC ! 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. ! ! ! ! ! ! ! Auto Scaling 15 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. 16 16 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. 17 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. ! Click18 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. ! 19 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. ! 2 WARZIP GitPush! S3 WAR/ZIPDeveloper 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. ZIPWAR ! 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. ZIPWAR !
IDEVisualStudioEclipse22 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. Git ! ElasticBeanstalkCLI URLURL
http://aws.amazon.com/code/6752709412171743 Version 2.5.1$ wget
https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalkCLI-2.5.1.zip
$ unzip AWS-ElasticBeanstalk-CLI-2.5.1.zip23 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. Git ! $ mkdir ebapp # rails rails
new ebapp $ cd ebapp $ git init! AWS Dev Tool git $
~/AWS-ElasticBeanstalk-CLI-2.5.1/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh
aws.cong24$ git aws.config AWS Access Key: AKIXXXXXXXXXXXXXXXX AWS
Secret Key: zGt9B9XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX AWS Region
[default to us-east-1]: ap-northeast-1 AWS Elastic Beanstalk
Application: My First Elastic Beanstalk Application AWS Elastic
Beanstalk Environment: Default-Environment24 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. Security Credentials ! IAM25 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. Security Credentials26
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. Git ! Git $ git
add . $ git commit -m "initial commit"! Beanstalk $ git aws.push
Counting objects: 3, done. Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 306 bytes, done. Total 3 (delta 0),
reused 0 (delta 0) remote: To https://AKIA.... * [new branch] HEAD
-> master27 27 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. 28 Running Version 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
29. 1. Running VersionUpload and Deploy2. All Versions 29 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. 30 30 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. Application Default Environment
URLEnvironment ConfigurationVersion WAR/ZIP WAR/ZIP
http://Default-EnvironmentXXXXXX.elasticbeanstalk.com 31 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. 32. RDS ! RDS ! RDS production:
adapter: mysql2 encoding: utf8 database: username: password: host:
port: InstanceAmazon RDSElastic Load Balancer Instance
CloudWatchAuto scaling Group32 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. S3 ! S3 S3IAM Role 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. ! 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. 35 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. CPUAuto Scaling36 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. Auto Scaling ! Scaling37 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. Auto Scaling ! CPU CPUUtilization
Percent 70 3038 38 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. 39 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. Create New
Environment40 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. DNS41 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. 42 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. StagingURL
Default-EnvironmentDefault-Environment URLStaging-Environment43 43
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. Route53 ! DNS !
Weighted Round Robin Weighted Transition Route 53Old
Environment44Auto scaling GroupNew EnvironmentAuto scaling Group
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. Application Default
Environment URLEnvironment ConfigurationVersion
WAR/ZIPhttp://Default-EnvironmentXXXXXX.elasticbeanstalk.comStaging
Environment URLWAR/ZIP Environment Configuration45 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. eb + git !ElasticBeanstalkCLIebGit
$ $ $ $mkdir project cd project git init eb init # AWSCredential $
eb start# $ eb staus# StatusReady $ git aws.push# 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. eb + git ! eb branchgit git$ git
checkout b new_branch Switched to a new branch 'new_branch'
new_branch $ eb branch The current branch is "new_branch". Enter an
AWS Elastic Beanstalk environment name (auto-generated value is
sample-newbranch-env"): Do you want to copy the settings from
environment "nodesample-env" for the new branch? [y/n]: y
new_branch $ eb start Starting application "sample". Waiting for
environment "sample-newbranch-env" to launch. 2013-10-08 08:12:59
INFO createEnvironment is starting. 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. Agenda ! Elastic Beanstalk? Elastic Beanstalk!
Auto Scaling ! Advanced Tips VPC ! 48 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. Advanced Tips -VPC-49 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. VPC ! Elastic BeanstalkVPC(*) VPC!
ELBEC2 subnet VPChttp://docs.aws.amazon.com/
elasticbeanstalk/latest/dg/ AWSHowTo-vpc-basic.html(*) 20134.NETVPC
Legacy50 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. ! ELB,
EC2AZ1 ELBEC2 RDS2 51 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. Advanced Tips --52 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. ! AMI! /.ebextensions/*.cong gityumgit packages: yum: git: []
commands: 01prepare: command: scripts/prepare.sh53 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. ! packages yumrpm! sources (tar)!
les ! services service! users/groups /
http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/customize-containers.html54
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. ! commands
OS!container_commands !option_settings ! Resources
SQSDynamoDBCloudWatch55 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. 1 ! New Relic .ebextensions/01newrelic.config packages: yum:
newrelic-sysmond: [] rpm: newrelic:
http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelicrepo-5-3.noarch.rpm
commands: configure_new_relic: command: nrsysmond-config --set
license_key=XXXXX 56 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. ! CommandsContainer Commands CommandsContainer Commands
leader_only container_commands: leader_only_command: command:
leader_only: true every_node_command: command: Leader57 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. !
1.commands2./opt/elasticbeanstalk/hooks/appdeploy/pre/*
DB3.container_commands4./opt/elasticbeanstalk/hooks/appdeploy/enact/*
5./opt/elasticbeanstalk/hooks/appdeploy/post/* 58 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. 2 ! files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/01a_bootstraup.sh":
mode: "000755" owner: root group: root content: | #!/usr/bin/env
bash cd /var/app/ondeck/public s3cmd get s3://mybucket/assets.tgz
tar xvzf assets.tgz59 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. 3 ! files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_start_resque_worker.sh":
mode: "000755" owner: root group: root content: | #!/usr/bin/env
bash . /opt/elasticbeanstalk/support/envvars cd
$EB_CONFIG_APP_CURRENT if [ -e /var/run/resque.pid ]; then kill
`cat /var/run/resque.pid` fi chown $EB_CONFIG_APP_USER
/var/run/resque.pid su -c "PIDFILE=/var/run/resque.pid
BACKGROUND=yes RAILS_ENV=productionQUEUE=default bundle exec rake
environment resque:work" $EB_CONFIG_APP_USER60 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. Advanced Tips --61 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. ! Resources Resources: : Type:
Properties: : ! DynamoDB ElastiCache SQS SNS CloudWatch 62 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. DynamoDB
.ebextensions/sessiontable.cong Resources: SessionTable: Type:
AWS::DynamoDB::Table Properties: KeySchema: HashKeyElement:
AttributeName: "username" AttributeType: "S" ProvisionedThroughput:
ReadCapacityUnits: 1 WriteCapacityUnits: 1 les:
"/var/app/support/sessiontable": mode: "000444" content: | `{"Ref"
: "SessionTable"}` `{"Ref" : "AWS::Region"}`63 Ref Fn::GetAtt,
Fn::Join CloudFormation 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. Agenda ! Elastic Beanstalk? Elastic Beanstalk! Auto Scaling !
Advanced Tips VPC ! 64 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. ! ElasticBeanstalk ! AWS ! ElasticBeanstalk Happy Coding! 65
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.