AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013


Published on

AWS Elastic Beanstalk provides a number of simple, flexible interfaces for developing and deploying your applications. In this session, learn how ThoughtWorks leverage the Elastic Beanstalk API to continuously deliver their applications with smoke tests and blue-green deployments. Also learn how to deploy your apps with Git and eb, a powerful CLI that allows developers to create, configure, and manage Elastic Beanstalk applications and environments from the command line.

Published in: Technology, Business
1 Comment
  • For more on ThoughtWorks and the Mingle Team who developed eb_deployer, check out this post:
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013

  1. 1. DMG301 – AWS Elastic Beanstalk Under the Hood Chris Whitaker, Amazon Web Services November 14, 2013 © 2013, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of, Inc.
  2. 2. Featuring Sudhindra R Rao and Pengchao Wang, ThoughtWorks
  3. 3. Have you ever wanted to… • Control the lifetime of your AWS resources separately from your application code? • Extend or add more AWS resources to your Elastic Beanstalk environment? • Control traffic to your application as you deploy? You have come to the right place!
  4. 4. Under the Hood Series • • • • Elastic Beanstalk experience assumed Practical tips and tricks Real stories, real advice, from real customers Q&A!
  5. 5. Flow AWS ThoughtWorks Q&A (25m) (25m) (10m)
  6. 6. Controlling the Lifetime • Out-of-the-box Elastic Beanstalk supports – Amazon Relational Database Service (RDS) • Tied to the lifetime of your environment – Terminating or rebuilding your environment removes or replaces your database • Use AWS CloudFormation to manage resource lifetimes independently
  7. 7. Resource Lifetime ELB Alert Log App Terminate environment AZ Mon
  8. 8. Resource Lifetime ELB Alert Log App Terminate environment AZ Mon
  9. 9. A CloudFormation Template • Demo
  10. 10. Extending Your Configuration • Elastic Beanstalk gives you the following: – Load balanced, auto scaling; single instance – Amazon RDS database • What if your application needs other resources – Amazon ElastiCache cache cluster, Amazon DynamoDB table, Amazon Elastic Block Store (EBS) volumes, Amazon CloudWatch alarms… • Two options – Elastic Beanstalk extensions (resources with lifetime tied to the code or instance) – AWS CloudFormation templates (resources with independent lifetime)
  11. 11. Adding Resources Using EBExtensions ELB Alert App Log Mon EBSAZ EBS
  12. 12. Adding Resources using CloudFormation option_settings: "aws:autoscaling:launchconfiguation": InstanceType: "m1.large" BlockDeviceMappings: "/dev/sdj:100" Alert ELB create_resources.config Resources: AlarmTopic: Type: AWS::SNS::Topic Properties: … App CpuAlarm: Type: AWS::CloudWatch::Alarm Properties… Log Mon EBSAZ EBS
  13. 13. Extending Your Configuration • Attach an EBS-optimized volume • Supported directly by Elastic Beanstalk option_settings: "aws:autoscaling:launchconfiguation": InstanceType: "m1.large" BlockDeviceMappings: "/dev/sdj:100"
  14. 14. Extending Your Configuration • Adding additional resources (Alarm and Topic) AlarmTopic: Type: AWS::SNS::Topic Properties: Subscription: - Endpoint: Fn::GetOptionSetting: OptionName: AlarmEmail DefaultValue: "" Protocol: email CpuAlarm: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: "Alarm if CPU grows beyond 90%" Namespace: "AWS/EC2" MetricName: CPUUtilization Dimensions: - Name: AutoScalingGroupName Value : { "Ref" : "AWSEBAutoScalingGroup" } Statistic: Average Period: 300 EvaluationPeriods: 1 Threshold: 90 ComparisonOperator: GreaterThanThreshold AlarmActions: - Ref: AlarmTopic
  15. 15. Built-in Resources Resource Name Description AWSEBAutoScalingGroup The name of the Auto Scaling group that Elastic Beanstalk uses when it launches Amazon EC2 instances. AWSEBAutoScalingLaunchConfiguration The name for the launch configuration settings that Elastic Beanstalk uses when it launches EC2 instances. AWSEBEnvironmentName The name of the Elastic Beanstalk environment. AWSEBLoadBalancer The name of the elastic load balancer used in the Elastic Beanstalk environment. AWSEBRDSDatabase The name of the Amazon RDS database. AWSEBSecurityGroup The name for the EC2 security group that Elastic Beanstalk uses when it launches EC2 instances.
  16. 16. Advanced Deployment Techniques • Deploying to QA and Production using branches – Use multiple Git branches deployed to multiple environments • Zero downtime deployments using CNAME flip – Deploy a new version even under heavy load • Controlling traffic using Amazon Route 53 – Define how much traffic is directed to your new version
  17. 17. Using Branches Git repository V1 git commit Users V1 V2 V2 Branch1 Branch2
  18. 18. Deploying Using Multiple Branches  git init  eb init  git add . … edit your source  git commit  git aws.push  git branch v1  git checkout v1  eb branch  git aws.push  git checkout master … edit your source  git aws.push Test cycle deployed to test Create a V1 branch and deploy to production Continue to develop and test
  19. 19. Zero Downtime Deployments • Deploy new version with zero downtime and ability to roll back (i.e., CNAME swap)
  20. 20. V1 V1
  21. 21. V1 V1
  22. 22. V1 V1 V2 V2
  23. 23. V1 V1 V2 V2
  24. 24. V1 V1 V2 V2
  25. 25. V1 V1 V2 V2
  26. 26. V1 V1 V2 V2
  27. 27. Controlling Traffic • What if you want more control of the traffic when you deploy a new version? • Use Amazon Route 53 weighted resource record sets – Associate multiple Elastic Beanstalk environments with the same DNS name – Control traffic flow using weights
  28. 28. Controlling Traffic V1 V1 V2 V2 Weight 100 Weight 0
  29. 29. Controlling Traffic V1 V1 V2 V2 Weight 100 Weight 10
  30. 30. Controlling Traffic V1 V1 V2 V2 Weight 0 Weight 100
  31. 31. Controlling Traffic • Demo
  32. 32. Geographic Load Balancing • Extend the Amazon Route53 idea to use latency record sets – Associate multiple Elastic Beanstalk environments in different regions with the same DNS name – Latency-based routing selects the “nearest” Elastic Beanstalk environment
  33. 33. Call to Action • Customize your infrastructure with EBExtensions • Use AWS CloudFormation in conjunction with Elastic Beanstalk to control resources lifetime • Deploy using multiple branches for development and production • Use CNAME flip or Amazon Route 53 configuration to manage your deployments
  34. 34. Other Resources • DMG204 - Zero to Sixty: AWS Elastic Beanstalk • DMG201 - Zero to Sixty: AWS CloudFormation • DMG303 - AWS CloudFormation Under the Hood Come find me in the developer resources booth
  35. 35. Sudhindra R Rao and Pengchao Wang
  36. 36. Blue-Green Deployments with AWS Elastic Beanstalk
  37. 37. Elastic Beanstalk I am so beautiful !
  38. 38. Elastic Beanstalk – Missing Parts? Automated Blue-Green Deployments
  39. 39. AWS Elastic Beanstalk blue-green deployment automation
  40. 40. Blue Green Deployments on Elastic Beanstalk version n version n+1 terminate testing
  41. 41. EbDeployer Automates Blue-Green Deployments
  42. 42. Deployment with EbDeployer version n scale down version n+1 smoke tests
  43. 43. Package and Deploy
  44. 44. A Sample Smoke Test
  45. 45. Demo
  46. 46. EbDeployer Makes Shared Resource Blue-Green Deployments Easier
  47. 47. Elastic Beanstalk Resource Management version n version n+1
  48. 48. Shared Resources version n version n+1
  49. 49. EbDeployer Adding RDS to the Deployment
  50. 50. Add a CloudFormation Template for RDS
  51. 51. Add Resource Declaration
  52. 52. Demo
  53. 53. EbDeployer Provides Different Deployment Flavors
  54. 54. Phoenix Server • phoenix_mode: true
  55. 55. Deployment Strategy • blue-green vs. inplace-update
  56. 56. EbDeployer in Our Pipeline
  57. 57. Continuous Delivery
  58. 58. EbDeployer
  59. 59. Have a Pull Request? @alexhal9000 @sudhindraRao
  60. 60. Please give us your feedback on this presentation DMG301 As a thank you, we will select prize winners daily for completed surveys!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.