AWS Update | London - Elastic Beanstalk

2,408 views
2,134 views

Published on

We are excited to continue our work on BeanStalk with the introduction of a range of great new features. If you are a Python shop you'll learn how BeanStalk now supports Python containers and the Django and Flask frameworks. Hear about BeanStalk integration with RDS and how custom configuration of containers is possible through simple configuration files.

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,408
On SlideShare
0
From Embeds
0
Number of Embeds
215
Actions
Shares
0
Downloads
44
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

AWS Update | London - Elastic Beanstalk

  1. 1. Amazon Web Services Update | LondonNovember 2012
  2. 2. Elastic Bean StalkQuickly deploy and manage apps in AWS…
  3. 3. Elastic Bean StalkApplication package is deployed into Beanstalk
  4. 4. Elastic Bean Stalk Which creates the container in EC2 User Application Application Service HTTP ServiceLanguage Interpreter Operating System Host
  5. 5. Elastic Bean StalkBeanstalk takes care of the environment…
  6. 6. Elastic Bean Stalk…adding Elastic Load Balancer…
  7. 7. Elastic Bean Stalk …Auto Scaling groups
  8. 8. Elastic Bean Stalk …and launching instances
  9. 9. Elastic Bean Stalk…all wired into the Beanstalk framework
  10. 10. Elastic Bean Stalk…and published under a CNAME
  11. 11. Elastic Bean Stalk…with logs and app versions held in S3
  12. 12. What about the container?
  13. 13. Elastic Bean Stalk …into a range of containers.Net PHP Java
  14. 14. Elastic Bean Stalk Adding new containers…Ruby + Python
  15. 15. Elastic Bean Stalk Containers… User Application Application Service HTTP ServiceLanguage Interpreter Operating System Host
  16. 16. Elastic Bean Stalk …Python mod-wsgi & apache User ApplicationApplication Service Apache mod_wsgi Python Operating System Host
  17. 17. Elastic Bean Stalk …Python mod-wsgi & apache requirements.txtDjango==1.4.1 Flask==0.9
  18. 18. Elastic Bean Stalk Containers… User Application Application Service HTTP ServiceLanguage Interpreter Operating System Host
  19. 19. Elastic Bean Stalk Passenger & Nginx… User ApplicationApplication Service Nginx passenger Ruby Operating System Host
  20. 20. Elastic Bean Stalk Passenger & Nginx…Classic rails MVC Bare-metal routes (non-MVC)
  21. 21. What about the data?
  22. 22. D.I.Y
  23. 23. Elastic Bean Stalk Adding new containers…Ruby + Python + Java
  24. 24. Elastic Bean Stalk Adding new containers…Ruby + Python + Java RDS
  25. 25. Option tocreate RDS at application launch:
  26. 26. Grab connection details for use:String dbName =System.getProperty("RDS_DB_NAME");String userName = System.getProperty("RDS_USERNAME");String password = System.getProperty("RDS_PASSWORD");String hostname = System.getProperty("RDS_HOSTNAME");String port = System.getProperty("RDS_PORT");
  27. 27. Grab connection details from os.environ’simport osif RDS_HOSTNAME in os.environ: DATABASES = { default: { ENGINE: django.db.backends.mysql, NAME: os.environ[RDS_DB_NAME], USER: os.environ[RDS_USER], PASSWORD’: os.environ[RDS_PASSWORD], HOST: os.environ[RDS_HOSTNAME], PORT: os.environ[RDS_PORT], }}
  28. 28. Add “.ebextensions” directory Add “python.config” filecommands: syncdb: command: "django-admin.py syncdb --noinput" leader_only: trueoption_settings: "aws:elasticbeanstalk:application:python:environment": DJANGO_SETTINGS_MODULE: "mysite.settings" "aws:elasticbeanstalk:container:python": WSGIPath: "mysite/wsgi.py"
  29. 29. RDS populated from Django model (use Django Evolution etc to upate when model changes)commands: syncdb: command: "django-admin.py syncdb --noinput" leader_only: trueoption_settings: "aws:elasticbeanstalk:application:python:environment": DJANGO_SETTINGS_MODULE: "mysite.settings" "aws:elasticbeanstalk:container:python": WSGIPath: "mysite/wsgi.py"
  30. 30. Update database.yml to include generated RDSdetails:production: adapter: mysql2 encoding: utf8 database: <%= ENV[RDS_DB_NAME] %> username: <%= ENV[RDS_USERNAME] %> password: <%= ENV[RDS_PASSWORD] %> host: <%= ENV[RDS_HOSTNAME] %> port: <%= ENV[RDS_PORT] %>
  31. 31. Add “.ebextensions” directory Add “.config” file# Configure third-party service credentials# Run rake tasks before an application deploymentcontainer_commands: 01deploy: command: rake my_deployment_tasks# in environment variables:option_settings: - option_name: AIRBRAKE_API_KEY value: MYAPIKEY
  32. 32. RDS populated from rails model# Configure third-party service credentials# Run rake tasks before an application deploymentcontainer_commands: 01deploy: command: rake my_deployment_tasks# in environment variables:option_settings: - option_name: AIRBRAKE_API_KEY value: MYAPIKEY
  33. 33. Rails rake Git Beanstalk RDSDjango syncdb
  34. 34. Container config .ebextensions Git Beanstalk RDSLanguage/ver Configuration/co sions mmands
  35. 35. .ebextensions Java, Python & Ruby container configurationpackagesDownload and install pre-packaged applications and components using apt, yum,rubygems, python, and rpmsourcesDownload an archive file and unpack it in a target directory on the EC2 instance(e.g from S3). Supported formats are tar, tar+gzip, tar+bz2 and zipfilesCreate files on the EC2 instanceUsers/groupsCreate Linux/UNIX users/groups on the EC2 instance
  36. 36. .ebextensions Java, Python & Ruby container configurationpackages packages:Download and install pre-packagedyum: applications and components using apt, yum,rubygems, python, and rpm package1: [3.2.1]sources package2: [1.0] rpm:Download an archive file and unpack it in a target directory on the EC2 instance package3(e.g from S3). Supported formats are tar, tar+gzip, tar+bz2 and zipfilesCreate files on the EC2 instanceUsers/groupsCreate Linux/UNIX users/groups on the EC2 instance
  37. 37. .ebextensions Java, Python & Ruby container configurationpackagesDownload and install pre-packaged applications and components using apt, yum,rubygems, python, and rpm sources:sources /home/myfiles: https://s3.amazonaws.com/bucket/myfDownload an archive file and unpack it in a target directory on the EC2 instance iles.zip(e.g from S3). Supported formats are tar, tar+gzip, tar+bz2 and zipfilesCreate files on the EC2 instanceUsers/groupsCreate Linux/UNIX users/groups on the EC2 instance
  38. 38. .ebextensions Java, Python & Ruby container configurationpackages files:Download and install pre-packaged“/home/ec2-user/myfile” : applications and components using apt, yum, mode: "000777"rubygems, python, and rpm owner: ec2-user group: ec2-usersources source: http://foo.bar/myfileDownload an archive file and unpack it in a target directory on the EC2 instance “/home/ec2-user/myfile2” :(e.g from S3). Supported formats are tar, tar+gzip, tar+bz2 and zip mode: “000777” owner: ec2-userfiles group: ec2-userCreate files on the EC2 instance content: | # this is my file # with contentUsers/groupsCreate Linux/UNIX users/groups on the EC2 instance
  39. 39. .ebextensions Java, Python & Ruby container configurationpackages users:Download and install pre-packaged - myuser : and components using apt, yum, applicationsrubygems, python, and rpm groups: - group1sources - group2 uid: 50Download an archive file and unpack it in a target directory on the EC2 instance(e.g from S3). Supported formats are tar,homedir: tar+bz2 and zip tar+gzip, “/tmp”files groups: - group1 : 45Create files on the EC2 instance - group2 : 99 - group3Users/groupsCreate Linux/UNIX users/groups on the EC2 instance
  40. 40. .ebextensions Java, Python & Ruby container configurationcommandExecute commands on the EC2 instancecontainer_commandsExecute commands for your containerservicesDefine which services should be started or stopped when the instance is launchedincluding dependencies that require Beanstalk to execute a restartoption_settingsDefine container settings that get passed in as environment variables on yourAmazon EC2 instances
  41. 41. .ebextensions Java, Python & Ruby container configurationcommand commands:Execute commands on the EC2 instance myscript:container_commands command: myscript.py cwd: /home/ec2-userExecute commands for your container env:services a: bDefine which services should be started or stopped when the instance is launchedincluding dependencies that require Beanstalk to execute a restartoption_settingsDefine container settings that get passed in as environment variables on yourAmazon EC2 instances
  42. 42. .ebextensions Java, Python & Ruby container configurationcommandExecute commands on the EC2 instance container_commands:container_commands replace-config-label:Execute commands for your containercommand: cp .ebextensions/server.xmlservices /etc/tomcat7/server.xmlDefine which services should be started or stopped when the instance is launchedincluding dependencies that require Beanstalk to execute a restartoption_settingsDefine container settings that get passed in as environment variables on yourAmazon EC2 instances
  43. 43. .ebextensions Java, Python & Ruby container configurationcommandExecute commands on the EC2 instancecontainer_commands services:Execute commands for your container sysvinit:services - myservice:Define which services should be started or stopped when the instance is launched enabled: trueincluding dependencies that require Beanstalk to execute a restart ensureRunning: trueoption_settingsDefine container settings that get passed in as environment variables on yourAmazon EC2 instances
  44. 44. .ebextensions Java, Python & Ruby container configurationcommand option_settings:Execute commands on the EC2 instance - namespace: aws:elasticbeanstalk:container:tomcontainer_commands cat:jvmoptionsExecute commands for your container option_name: Xmx value: 256mservices - option_name: AWS_SECRET_KEYDefine which services should be started or stopped when the instance is launched value:including dependencies that require Beanstalk to execute a restart wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMoption_settings PLEKEY - option_name: AWS_ACCESS_KEY_IDDefine container settings that get passed in as environment variables on your value: AKIAIOSFODNN7EXAMPLEAmazon EC2 instances
  45. 45. VPC
  46. 46. Elastic Bean Stalk Deploy apps inside a Virtual Private Cloud Launch apps into a VPCLaunch “private” Deeper networking applications control
  47. 47. Elastic Bean Stalk Additional required optionsVPCIdContains the ID of the VPCSubnetsContains the ID of the Auto Scaling group subnetELBSubnetsContains the ID of the subnet for the elastic loadbalancerSecurityGroupsContains the ID of the security group.
  48. 48. VPC ID
  49. 49. VPC ID Auto-scaling subnet
  50. 50. VPC ID Auto-scaling subnetELBSubnet
  51. 51. SummaryNew Python & Ruby containers Beanstalk integrates with RDS Beanstalk in VPC
  52. 52. http://aws.amazon.com/ela sticbeanstalk

×