Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Monthly Webinar Series

4,746 views

Published on

In this session, we introduce you to a solution for easily running a Docker-powered microservices architecture on AWS using Elastic Beanstalk. We will also cover the fundamentals of Elastic Beanstalk and how it benefits developers looking for a quick and scalable way to get their applications running on AWS with no infrastructure work required.

Building a microservices architecture using Docker can require a lot of work, from launching and operating the underlying infrastructure to installing and maintaining cluster management software. With AWS Elastic Beanstalk’s multicontainer support feature, many of these tasks are simplified and abstracted away so you can focus on your application code. AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker."

Learning Objectives:
• Learn the basics of AWS Elastic Beanstalk
• Understand how to use Elastic Beanstalk to run containerized applications
• Learn how to use Elastic Beanstalk to start architecting microservices-based applications

Published in: Technology
  • Be the first to comment

Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Monthly Webinar Series

  1. 1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Brandon Chavis | Solutions Architect 08/25/2016 AWS Elastic Beanstalk (EB) Deploying Containers on EB
  2. 2. Agenda  Elastic Beanstalk vs DIY  How to use Elastic Beanstalk  Multi-Container Docker with AWS Elastic Beanstalk  Recently added features
  3. 3. Developer Challenges  Complexity of deploying code, provisioning and managing infrastructure  Expertise and time needed to manage and configure servers, databases, load balancers, firewalls, and networks  How to automate application scaling
  4. 4. What is Elastic Beanstalk? AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services.
  5. 5. AWS Elastic Beanstalk vs. Do It Yourself Your code HTTP Server Application Server Language Interpreter Operating System Host Elastic Beanstalk configures each EC2 instance in your environment with the components necessary to run applications for the selected platform. Focus on building your application Provided by you Provided and managed by AWS Elastic Beanstalk (EB) On-instance configuration
  6. 6. AWS Elastic Beanstalk vs. Do It Yourself  Preconfigured Infrastructure  Single Instance (Dev, Low Cost)  Load Balanced, Auto Scaling (Production)  Web & Worker tiers  Elastic Beanstalk provisions necessary infrastructure resources such as the load balancer, auto scaling group, security groups, database (optional), etc.  Provides a unique domain name for your application (e.g.: youapp.regionx.elasticbeanstalk.com) Infrastructure stack
  7. 7. Common Use Cases  Websites  API backends  Mobile backends  Asynchronous workers
  8. 8. Customers
  9. 9. Elastic Beanstalk Benefits Fast & simple to begin Developer productivity Impossible to outgrow Complete resource control No additional charge to use. You only pay for underlying AWS resources (i.e.: EC2 instances, S3, etc.)
  10. 10. How do I get started with Elastic Beanstalk
  11. 11. 01 02 03 04 Region Stack (container) type Single Instance Load Balanced with auto-scaling OR Database (RDS) Optional Your code Supported Platforms Information required to deploy application
  12. 12. Building applications with Elastic Beanstalk Application: api Environment prod-api V1 Environment dev-api V1.1 Environment browserClient V2 Environment browserClient V2.1 Environment dev-api V1.2 Environment browserClient V3 Application: browser
  13. 13. How to deploy applications 1. Via AWS Management Console 2. Via AWS Toolkit for Eclipse and Visual Studio IDE 3. Via AWS SDK’s and CLI 4. Via EB command line interface $ eb deploy
  14. 14. Deploy Sample Application (EB CLI) Initial application deployment workflow $ git clone https://github.com/awslabs/eb- node-express-sample.git Download sample application02 $ eb init Create your Elastic Beanstalk app03 Follow the prompts to configure the environment 04 05 Create the resources and launch the application $ eb create $ pip install --upgrade awsebcli Install the AWS Elastic Beanstalk command line interface (EB CLI) 01
  15. 15. Update Sample Application (EB CLI) Update application workflow Update your code01 $ git add . $ git commit –m “v2.0” $ eb deploy Add & commit code to repository02 Open application once deployment completes. 03 $ eb open
  16. 16. Docker with AWS Elastic Beanstalk
  17. 17. Benefits of using Multi-Container Docker with Elastic Beanstalk  Automation of capacity provisioning, load balancing, scaling, and application health monitoring  One stop management of your application in an environment that supports range of services that are integrated with Elastic Beanstalk, including but not limited to VPC, RDS, and IAM.
  18. 18. I’ve built my containers, how do I…?  Store my container images?  Configure containers for Beanstalk?  Test my config?  Deploy to Beanstalk?  Update my application?
  19. 19. Store your container images: Amazon ECR  Beanstalk can interact with any Docker Repository  Options include Dockerhub, Amazon ECR, and private repos  Amazon ECR allows access control via IAM for fine- grained permissions  Elastic Beanstalk can automatically authenticate with ECR
  20. 20. Amazon ECR Registry Usage
  21. 21. Dockerrun.aws.json: Introduction Specifies the version number as the value "2" for multicontainer Docker environments AWSEBDockerrunVersion01 An array of container definitions ContainerDefinitions03 Mount points in the container instance that a container can use Volumes02 "volumes": [ { "name": "volumename", "host": { "sourcePath": "/path/on/host/instance" } } ], Format:
  22. 22. Dockerrun.aws.json: A snippet "AWSEBDockerrunVersion": 2, "volumes": [ { "name": "php-app", "host": { "sourcePath": "/var/app/current/php-app" } }, { "name": "nginx-proxy-conf", "host": { "sourcePath": "/var/app/current/proxy/conf.d" } } ], "containerDefinitions": [ { "name": "php-app", "image": "php:fpm", "environment": [ { "name": "Container", "value": "PHP" } ], "essential": true, "memory": 128, "mountPoints": [ { "sourceVolume": "php-app", "containerPath": "/var/www/html", "readOnly": true } ] }, { "name": "nginx-proxy", "image": "nginx", "essential": true, "memory": 128, "portMappings": [ { "hostPort": 80, "containerPort": 80 } ], "links": [ "php-app" ], "mountPoints": [ { "sourceVolume": "php-app", "containerPath": "/var/www/html", "readOnly": true }, { "sourceVolume": "nginx-proxy-conf", "containerPath": "/etc/nginx/conf.d", "readOnly": true }, { "sourceVolume": "awseb-logs-nginx-proxy", "containerPath": "/var/log/nginx" } ] } ] } Multi Container requires version 2 Volume Container Definition The container definition and volumes sections of Dockerrun.aws.json use the same formatting as the corresponding sections of an Amazon ECS task definition file.
  23. 23. Test your Beanstalk application locally  Use EB “eb local run” command to run and test dockerrun.aws.json application locally
  24. 24. Choose the right Beanstalk container platform  Single Container Docker  Multi-Container Docker
  25. 25. Multi Container: Architecture  Each environment has its own ECS Cluster  Supports a single ECS Task definition per environment  The ECS Task is defined in the Dockerrun.aws.json file  Uses a flood scheduling mechanism  Provides out of the box auto scaling for ECS Tasks Elastic Beanstalk Environment Auto Scaling Group / ECS Cluster Instance 1 Instance 2 app1.elasticbeanstalk.com Elastic Load Balancing Container 2Container 1 Container 3 Container 2Container 1 Container 3
  26. 26. Multi Container with Elastic Beanstalk Nginx Proxy Example Code at: https://github.com/awslabs/eb-docker-nginx-proxy
  27. 27. Update your application: Application Deployment
  28. 28. Update your application: Deployment Policies  All at once: Deploy new version to all instances simultaneously  Rolling: Deploy new version in batches  Rolling with additional batch: Deploy in batches, +1 extra batch  Immutable: Deploy to fresh group of instances
  29. 29. All At Once Deployments
  30. 30. Step 0: All At Once Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1
  31. 31. Step 1: All At Once Auto Scaling Group Elastic Beanstalk Environment v2 v2 myapp.elasticbeanstalk.com v2v2
  32. 32. Rolling with Additional Batch
  33. 33. Step 0: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1
  34. 34. Step 1: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 v1 v1 myapp.elasticbeanstalk.com v1v1
  35. 35. Step 2: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 v1 v1 myapp.elasticbeanstalk.com v1v1
  36. 36. Step 3: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 v1 v1 myapp.elasticbeanstalk.com v1v1
  37. 37. Step 4: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 v2 v2 myapp.elasticbeanstalk.com v1v1
  38. 38. Step 5: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 v2 v2 myapp.elasticbeanstalk.com v1v1
  39. 39. Step 6: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 v2 v2 myapp.elasticbeanstalk.com v1v1
  40. 40. Step 7: Rolling with Additional Batch Auto Scaling Group Elastic Beanstalk Environment v2 v2 myapp.elasticbeanstalk.com v2v2
  41. 41. Update your application: Blue/Green
  42. 42. Update your application: Blue/Green  Pros:  Fast rollback because the previous environment is still running  Cons:  Slower deployment (5 minutes) due to new environment spin-up  Potential of DNS caching by mobile clients after CNAME swap
  43. 43. Step 0: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1
  44. 44. Step 1: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1 Auto Scaling Group v2
  45. 45. Step 2: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1 Auto Scaling Group v2
  46. 46. Step 3: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1 Auto Scaling Group v2 v2 v2v2
  47. 47. Step 4: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1 Auto Scaling Group v2 v2 v2v2
  48. 48. Step 5: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v1 v1 myapp.elasticbeanstalk.com v1v1 Auto Scaling Group v2 v2 v2v2
  49. 49. Step 6: Blue/Green Auto Scaling Group Elastic Beanstalk Environment v2 v2 myapp.elasticbeanstalk.com v2v2
  50. 50. Demo!
  51. 51. New Features
  52. 52. Recently added features • Support for Application Load Balancer - Learn more • Support for ASP.NET Core and Multi-App .NET deployment - Learn more • Support for EC2 Container Registry - Learn more • Managed Updates - Learn more
  53. 53. Questions? How to get in touch with the EB team? Forum: https://forums.aws.amazon.com/forum.jspa?forumID=86 Twitter @aws_eb

×