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

  • 4,513 views
Uploaded 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 …

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.

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • For more on ThoughtWorks and the Mingle Team who developed eb_deployer, check out this post: http://getmingle.io/scaling/2014/02/03/EB-deployer.html
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
4,513
On Slideshare
0
From Embeds
0
Number of Embeds
16

Actions

Shares
Downloads
46
Comments
1
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. DMG301 – AWS Elastic Beanstalk Under the Hood Chris Whitaker, Amazon Web Services November 14, 2013 © 2013 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. Featuring Sudhindra R Rao and Pengchao Wang, ThoughtWorks
  • 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. Under the Hood Series • • • • Elastic Beanstalk experience assumed Practical tips and tricks Real stories, real advice, from real customers Q&A!
  • 5. Flow AWS ThoughtWorks Q&A (25m) (25m) (10m)
  • 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. Resource Lifetime http://www.your-app.com ELB Alert Log App Terminate environment AZ Mon
  • 8. Resource Lifetime http://www.your-app.com ELB Alert Log App Terminate environment AZ Mon
  • 9. A CloudFormation Template • Demo
  • 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. Adding Resources Using EBExtensions http://www.your-app.com ELB Alert App Log Mon EBSAZ EBS
  • 12. Adding Resources using CloudFormation option_settings: "aws:autoscaling:launchconfiguation": InstanceType: "m1.large" BlockDeviceMappings: "/dev/sdj:100" http://www.your-app.com Alert ELB create_resources.config Resources: AlarmTopic: Type: AWS::SNS::Topic Properties: … App CpuAlarm: Type: AWS::CloudWatch::Alarm Properties… Log Mon EBSAZ EBS
  • 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. Extending Your Configuration • Adding additional resources (Alarm and Topic) AlarmTopic: Type: AWS::SNS::Topic Properties: Subscription: - Endpoint: Fn::GetOptionSetting: OptionName: AlarmEmail DefaultValue: "nobody@amazon.com" 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. 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. 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. Using Branches Git repository V1 git commit Users V1 V2 V2 Branch1 Branch2
  • 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. Zero Downtime Deployments • Deploy new version with zero downtime and ability to roll back (i.e., CNAME swap)
  • 20. http://www.your-app.com V1 V1
  • 21. http://www.your-app.com V1 V1
  • 22. http://www.your-app.com V1 V1 V2 V2
  • 23. http://www.your-app.com V1 V1 V2 V2
  • 24. http://www.your-app.com V1 V1 V2 V2
  • 25. http://www.your-app.com V1 V1 V2 V2
  • 26. http://www.your-app.com V1 V1 V2 V2
  • 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. Controlling Traffic http://your-app.com V1 V1 V2 V2 Weight 100 Weight 0
  • 29. Controlling Traffic http://your-app.com V1 V1 V2 V2 Weight 100 Weight 10
  • 30. Controlling Traffic http://your-app.com V1 V1 V2 V2 Weight 0 Weight 100
  • 31. Controlling Traffic • Demo
  • 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. 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. 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. Sudhindra R Rao and Pengchao Wang
  • 36. Blue-Green Deployments with AWS Elastic Beanstalk
  • 37. Elastic Beanstalk I am so beautiful !
  • 38. Elastic Beanstalk – Missing Parts? Automated Blue-Green Deployments
  • 39. AWS Elastic Beanstalk blue-green deployment automation http://thoughtworksstudios.github.io/eb_deployer
  • 40. Blue Green Deployments on Elastic Beanstalk version n version n+1 terminate testing
  • 41. EbDeployer Automates Blue-Green Deployments
  • 42. Deployment with EbDeployer version n scale down version n+1 smoke tests
  • 43. Package and Deploy
  • 44. A Sample Smoke Test
  • 45. Demo
  • 46. EbDeployer Makes Shared Resource Blue-Green Deployments Easier
  • 47. Elastic Beanstalk Resource Management version n version n+1
  • 48. Shared Resources version n version n+1
  • 49. EbDeployer Adding RDS to the Deployment
  • 50. Add a CloudFormation Template for RDS
  • 51. Add Resource Declaration
  • 52. Demo
  • 53. EbDeployer Provides Different Deployment Flavors
  • 54. Phoenix Server • phoenix_mode: true
  • 55. Deployment Strategy • blue-green vs. inplace-update
  • 56. EbDeployer in Our Pipeline
  • 57. Continuous Delivery
  • 58. EbDeployer
  • 59. Have a Pull Request? http://thoughtworksstudios.github.io/eb_deployer wpc@thoughtworks.com srao@thoughtworks.com @alexhal9000 @sudhindraRao
  • 60. Please give us your feedback on this presentation DMG301 As a thank you, we will select prize winners daily for completed surveys!