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.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Pierre Steckmeyer, Solutions Architect
April 28t...
What to Expect from this Session
Microservices: What are They?
Challenges of Microservices
Microservices on Amazon ECS
What are Microservices?
What are Microservices?
“is a software architecture style in which complex
applications are composed of small, independent...
Monolithic vs. SOA vs. Microservices
SOA
Coarse-grained
Microservices
Fine-grained
Monolithic
Single Unit
Order UI User UI
Shipping
UI
Order
Service
User
Service
Shipping
Service
Data
Access
Monolithic Architecture
Monolithic Architecture – Scaling
Order UI User UI
Shipping
UI
Order
Service
User
Service
Shipping
Service
Microservices Architecture
Order UI User UI UI
Order
Service
Service
Shipping
Service
Order UI
Order UI
User UI UIShipping
UI
Order
ServiceOrder
Serv...
Characteristics of Microservices Architectures
Do one
thing well
Independent
Decentralized
Black Box
Polyglot
You build it...
What are Microservices challenges?
Resource and State Management
Data Management
Monitoring
Service Discovery
Deployment
What are Microservices challenges?
Resource and State Management
Data Management
Monitoring
Service Discovery
Deployment
Amazon EC2 Container Service
Containers are natural for services
Simple to model
Any app, any language
Image is the version
Test & deploy same artifact...
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Managing one host is straightforward
Managing a fleet is hard
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
Server
Guest OS
S...
Easily Manage Clusters for Any Scale
Nothing to run
Complete state
Control and monitoring
Scale
Scalable
Flexible Container Placement
Applications
Batch jobs
Multiple schedulers
Designed for use with other AWS services
Elastic Load Balancing
Amazon Elastic Block Store
Amazon Virtual Private Cloud
AW...
Clusters
Regional
Resource pool
Grouping of Container Instances
Start empty, dynamically scalable
Tasks
Unit of work
Grouping of related Containers
Run on Container Instances
Services
Good for long-running applications
Load Balance traffic across containers
Automatically recover unhealthy contain...
What are Microservices challenges?
Resource and State Management
Data Management
Monitoring
Service Discovery
Deployment
Monitoring with Amazon CloudWatch
Metric data sent to CloudWatch in 1-minute periods and
recorded for a period of two week...
Monitoring with Amazon CloudWatch
Monitoring with Amazon CloudWatch
Use the Amazon CloudWatch Monitoring Scripts to monitor
additional metrics, e.g. disk sp...
Monitoring Amazon ECS with Datadog
Monitoring Amazon ECS with Sysdig Cloud
What are Microservices challenges?
Resource and State Management
Data Management
Monitoring
Service Discovery
Deployment
Service Discovery with ECS Services & Route 53
Route 53 private hosted zone
Set search path on hosts with DHCP option sets...
Service Discovery with ECS Services & Route 53
Task
Task TaskTask
ECS
Service
Application
router, e.g.
nginx
Internal ELB ...
Service Discovery with Weaveworks
DNS interface for cross-host container communication
Gossip protocol to share grouped up...
Service Discovery with Weaveworks
Service Discovery and Configuration
Management with Consul
Three main components:
• Consul agent - Runs on each node, resp...
Service Discovery and Configuration
Management with Consul
ECSCluster
consul-agent
registrator
ECS Instance
Back end 1
Bac...
What are Microservices challenges?
Resource and State Management
Data Management
Monitoring
Service Discovery
Deployment
Scheduling Containers on ECS
Batch Jobs
ECS Task scheduler
Run tasks once
Batch jobs
RunTask (random)
StartTask (placed)
L...
Scheduling Containers: Long-running App
Optionally run your service behind a load balancer.
ELB currently supports a fixed...
Scheduling Containers: Long-running App
Update service’s task definition (rolling update)
Specify a deployment configurati...
Scheduling Containers: Long-running app
Deploy using the least space: minimumHealthyPercent =
50%, maximumPercent = 100%
Scheduling Containers: Long-running App
Deploy quickly without reducing service capacity:
minimumHealthyPercent = 100%, ma...
Scheduling Containers: Long-running App
Blue-Green Deployments
• Define two ECS services
• Each service is associated w/ E...
microservicesdevelopers delivery pipeline
Microservices development lifecycle
build pipeline
build pipeline
build pipeline...
Continuous Delivery to ECS with Jenkins
4. Push image to
Docker registry
2. Build image
from sources 3. Run test on image
...
Continuous Delivery to ECS with Jenkins
Easy Deployment
Developers – Merge into master, done!
Jenkins Build Steps
Trigger ...
ECS CI/CD Partners
Continuous Delivery to ECS with Shippable
Demo
Demo
TaskTask
Task
Thank you!
Upcoming SlideShare
Loading in …5
×

Running Microservices on Amazon ECS - AWS April 2016 Webinar Series

3,399 views

Published on

Running and managing large scale applications with microservices architectures is hard and often requires operating complex container management infrastructure. Amazon EC2 Container Service (ECS) is a highly scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances.

In this webinar, we will walk through a number of patterns used by our customers to run their microservices platforms. We will dive deep into some of the challenges of running microservices and we’ll see how Amazon ECS can help address them.

Learning Objectives:
• Understand the basics of Amazon ECS
• How to run and manage microservices using Amazon ECS

Published in: Technology

Running Microservices on Amazon ECS - AWS April 2016 Webinar Series

  1. 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Pierre Steckmeyer, Solutions Architect April 28th, 2016 Running Microservices on Amazon ECS
  2. 2. What to Expect from this Session Microservices: What are They? Challenges of Microservices Microservices on Amazon ECS
  3. 3. What are Microservices?
  4. 4. What are Microservices? “is a software architecture style in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs. These services are small, highly decoupled and focus on doing a small task, facilitating a modular approach to system-building.” - Wikipedia https://en.wikipedia.org/wiki/Microservices
  5. 5. Monolithic vs. SOA vs. Microservices SOA Coarse-grained Microservices Fine-grained Monolithic Single Unit
  6. 6. Order UI User UI Shipping UI Order Service User Service Shipping Service Data Access Monolithic Architecture
  7. 7. Monolithic Architecture – Scaling
  8. 8. Order UI User UI Shipping UI Order Service User Service Shipping Service Microservices Architecture
  9. 9. Order UI User UI UI Order Service Service Shipping Service Order UI Order UI User UI UIShipping UI Order ServiceOrder Service Service Service Service Service User Service Shipping Service Microservices Architecture – Scaling
  10. 10. Characteristics of Microservices Architectures Do one thing well Independent Decentralized Black Box Polyglot You build it, you run it
  11. 11. What are Microservices challenges? Resource and State Management Data Management Monitoring Service Discovery Deployment
  12. 12. What are Microservices challenges? Resource and State Management Data Management Monitoring Service Discovery Deployment
  13. 13. Amazon EC2 Container Service
  14. 14. Containers are natural for services Simple to model Any app, any language Image is the version Test & deploy same artifact Stateless servers decrease change risk
  15. 15. Server Guest OS Bins/Libs Bins/Libs App2App1 Managing one host is straightforward
  16. 16. Managing a fleet is hard Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS Server Guest OS AZ 1 AZ 2 AZ 3
  17. 17. Easily Manage Clusters for Any Scale Nothing to run Complete state Control and monitoring Scale
  18. 18. Scalable
  19. 19. Flexible Container Placement Applications Batch jobs Multiple schedulers
  20. 20. Designed for use with other AWS services Elastic Load Balancing Amazon Elastic Block Store Amazon Virtual Private Cloud AWS Identity and Access Management AWS CloudTrail
  21. 21. Clusters Regional Resource pool Grouping of Container Instances Start empty, dynamically scalable
  22. 22. Tasks Unit of work Grouping of related Containers Run on Container Instances
  23. 23. Services Good for long-running applications Load Balance traffic across containers Automatically recover unhealthy containers Discover services
  24. 24. What are Microservices challenges? Resource and State Management Data Management Monitoring Service Discovery Deployment
  25. 25. Monitoring with Amazon CloudWatch Metric data sent to CloudWatch in 1-minute periods and recorded for a period of two weeks Available metrics: CPUReservation, MemoryReservation, CPUUtilization, MemoryUtilization Available dimensions: ClusterName, ServiceName
  26. 26. Monitoring with Amazon CloudWatch
  27. 27. Monitoring with Amazon CloudWatch Use the Amazon CloudWatch Monitoring Scripts to monitor additional metrics, e.g. disk space: # Edit crontab > crontab -e # Add command to report disk space utilization to CloudWatch every five minutes */5 * * * * <path_to>/mon-put-instance-data.pl --disk-space-util --disk-space-used --disk- space-avail --disk-path=/ --from-cron
  28. 28. Monitoring Amazon ECS with Datadog
  29. 29. Monitoring Amazon ECS with Sysdig Cloud
  30. 30. What are Microservices challenges? Resource and State Management Data Management Monitoring Service Discovery Deployment
  31. 31. Service Discovery with ECS Services & Route 53 Route 53 private hosted zone Set search path on hosts with DHCP option sets Define ECS services with ELB Create CNAMEs for each ELB
  32. 32. Service Discovery with ECS Services & Route 53 Task Task TaskTask ECS Service Application router, e.g. nginx Internal ELB with CNAME, e.g. api.example.com Route 53 private zone, e.g. example.com
  33. 33. Service Discovery with Weaveworks DNS interface for cross-host container communication Gossip protocol to share grouped updates Overlay network between hosts
  34. 34. Service Discovery with Weaveworks
  35. 35. Service Discovery and Configuration Management with Consul Three main components: • Consul agent - Runs on each node, responsible for checking the health of the services and of the node itself. • One or more Consul servers - Store and replicate data, leader elected using the Raft consensus algorithm • Registrator agent - Automatically register/deregisters services based on published ports and metadata from the container environment variables defined in the ECS task definition
  36. 36. Service Discovery and Configuration Management with Consul ECSCluster consul-agent registrator ECS Instance Back end 1 Back end 2 consul-agent registrator ECS Instance Front end ECSCluster consul-server ECS Instance
  37. 37. What are Microservices challenges? Resource and State Management Data Management Monitoring Service Discovery Deployment
  38. 38. Scheduling Containers on ECS Batch Jobs ECS Task scheduler Run tasks once Batch jobs RunTask (random) StartTask (placed) Long-Running Apps ECS Service scheduler Health management Scale-up and scale-down AZ aware Grouped Containers
  39. 39. Scheduling Containers: Long-running App Optionally run your service behind a load balancer. ELB currently supports a fixed relationship between the load balancer port and the container instance port. If a task fails the ELB health check, the task is killed and restarted (until service reaches desired capacity).
  40. 40. Scheduling Containers: Long-running App Update service’s task definition (rolling update) Specify a deployment configuration for your service: • minimumHealthyPercent: lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running in a service during a deployment. • maximumPercent: upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment.
  41. 41. Scheduling Containers: Long-running app Deploy using the least space: minimumHealthyPercent = 50%, maximumPercent = 100%
  42. 42. Scheduling Containers: Long-running App Deploy quickly without reducing service capacity: minimumHealthyPercent = 100%, maximumPercent = 200%
  43. 43. Scheduling Containers: Long-running App Blue-Green Deployments • Define two ECS services • Each service is associated w/ ELB • Both ELBs in Route 53 record set with weighted routing policy, 100% Primary, 0% Secondary • Deploy to Blue or Green service and switch weights TaskTask Route 53 record set with weighted routing policy 0% 100%
  44. 44. microservicesdevelopers delivery pipeline Microservices development lifecycle build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline build pipeline
  45. 45. Continuous Delivery to ECS with Jenkins 4. Push image to Docker registry 2. Build image from sources 3. Run test on image 1. Code push triggers build 5. Update Service 6. Pull image 4. Push image to Docker registry
  46. 46. Continuous Delivery to ECS with Jenkins Easy Deployment Developers – Merge into master, done! Jenkins Build Steps Trigger via Webhooks, Monitoring, Lambda Build Docker image via Build and Publish plugin Push Docker image into Registry Register Updated Job with ECS API
  47. 47. ECS CI/CD Partners
  48. 48. Continuous Delivery to ECS with Shippable
  49. 49. Demo
  50. 50. Demo TaskTask Task
  51. 51. Thank you!

×