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.
KD Singh
AWS Partner Solutions Architect
Architecting Microservices on AWS
March, 2017
What to expect from the session?
• Review microservices architecture and how it differs
from monolithic and service-orient...
Monolithic vs. SOA vs. Microservices
SOA
Coarse-
grained
Microservices
Fine-grained
Monolithic
Single Unit
Okay, let’s start from the beginning…
First let’s discuss Software Monoliths,
a poor approach to software design.
Break warehouse processes into few big blocks
INBOUND
• Track products traveling to the
warehouse
• Receive products
• Pre...
Set up Software Teams
INBOUND
• Track products traveling to the warehouse
• Receive products
• Prepare products to be stor...
Software Teams and Dependencies
Inbound Software Team
50+ developers
Shared libraries
Outbound Software Team
50+ developer...
Long Build/Test/Release Cycles
Inbound Software Team
Outbound Software Team
Build Test Release
Build Test Release
• “I’m c...
Problems With Monolithic Software
System operation is a nightmare
(module X is failing, who’s the owner?)
Lack of agility
...
Conway’s Law:
“Any organization that designs a system (defined broadly) will
produce a design whose structure is a copy of...
Use Microservices!
What are Microservices?
“A software architecture style in which complex
applications are composed of small, independent
pr...
The Anatomy of a Microservice
Micro-service = Fine-grained Service-oriented architecture + “small” public API
Micro-servic...
Web of Microservices
Store products in the warehouse
Pick products for customers Report defects
Track shipments
Product De...
Benefits of Microservices for Amazon
Build Test Release
Build Test Release
• 50 Million Deployments a Year
• Software enha...
Characteristics of Microservice Architectures
Do one
thing well
Independent
Decentralized
Black box
Polyglot
You build it,...
Key Microservices Design
Principles
public API
Principle 1: Microservices only rely on each other’s public API
public API
Microservice A Microservice B
public API public API
Principle 1: Microservices only rely on each other’s public API
(Hide Your Data)
Microservice A Micr...
public API
Nope!
Microservice A Microservice B
Principle 1: Microservices only rely on each other’s public API
(Hide Your ...
public API
Microservice A Microservice B
Principle 1: Microservices only rely on each other’s public API
(Hide Your Data)
...
storeRestaurant (id, name, cuisine)
Version 1.0.0
public API
Microservice A
Principle 1: Microservices only rely on each o...
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, arbitrary_metadata)
add...
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, arbitrary_metadata)
add...
public API public API
DynamoDB
Microservice A Microservice B
Principle 2: Use the right tool for the job
(Embrace polyglot...
public API public API
DynamoDB
Microservice A Microservice B
Amazon
Elasticsearch
Service
Principle 2: Use the right tool ...
public API public API
RDS
MySQL
Microservice A Microservice B
Amazon
Elasticsearc
Service
Principle 2: Use the right tool ...
public API public API
RDS
MySQL
Microservice A Microservice B
Amazon
Elasticsearc
Service
Principle 2: Use the right tool ...
public API public API
RDS
Aurora
Microservice A Microservice B
Amazon
Elasticsearc
Service
Principle 2: Use the right tool...
Principle 3: Secure Your Services
• Defense-in-depth
• Network level (e.g. VPC, Security Groups, TLS)
• Server/container-l...
Hey Sally, we need
to call your micro-
service to fetch
restaurants details.
Sure Paul. Which APIs
you need to call? Once ...
Restaurant
Micro-service
15 TPS100 TPS5 TPS20 TPS
Before we let you call
our micro-service we
need to understand
your use ...
…and many,
many others!
Distributed monitoring and tracing
• “Is the service meeting its SLA?”
• “Which services were invo...
Principle 5: Automate everything
AWS
CodeCommit
AWS
CodePipeline
AWS
CodeDeploy
EC2 ELB
Auto
ScalingLambdaECS
DynamoDBRDS ...
Example Microservices Design
Patterns in AWS
Simple EC2 based Microservice Architecture
Example Microservice Architecture on ECS
Serverless Microservice
Demo
Questions?
Introduction to Microservices
Upcoming SlideShare
Loading in …5
×

Introduction to Microservices

5,007 views

Published on

by KD Singh, AWS Partner Solutions Architect, AWS

  • Hey guys! Who wants to chat with me? More photos with me here 👉 http://www.bit.ly/katekoxx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Introduction to Microservices

  1. 1. KD Singh AWS Partner Solutions Architect Architecting Microservices on AWS March, 2017
  2. 2. What to expect from the session? • Review microservices architecture and how it differs from monolithic and service-oriented architectures • Key microservices design principles • Example design patterns for Micro-services in AWS • Demo • Q&A
  3. 3. Monolithic vs. SOA vs. Microservices SOA Coarse- grained Microservices Fine-grained Monolithic Single Unit
  4. 4. Okay, let’s start from the beginning…
  5. 5. First let’s discuss Software Monoliths, a poor approach to software design.
  6. 6. Break warehouse processes into few big blocks INBOUND • Track products traveling to the warehouse • Receive products • Prepare products to be stored • Store products • Handle inbound defects • … OUTBOUND • Pick customer orders • Prepare shipments • Track shipments • Handle outbound defects • …
  7. 7. Set up Software Teams INBOUND • Track products traveling to the warehouse • Receive products • Prepare products to be stored • Store products in the warehouse • Handle inbound defects • … OUTBOUND • Pick customer orders • Prepare shipments • Track shipments • Report defects • Handle outbound defects • … Inbound Software Team Outbound Software Team
  8. 8. Software Teams and Dependencies Inbound Software Team 50+ developers Shared libraries Outbound Software Team 50+ developers Inbound Software Monolith Outbound Software Monolith High software coupling!
  9. 9. Long Build/Test/Release Cycles Inbound Software Team Outbound Software Team Build Test Release Build Test Release • “I’m constantly having to resolve commit conflicts and merges. This is taking too much of my time!” • “Our last build attempt failed after 4 hours. We don’t know who broke the build as 30 commits were made” Massive builds Long time to run tests Ever growing release binaries
  10. 10. Problems With Monolithic Software System operation is a nightmare (module X is failing, who’s the owner?) Lack of agility (very long time to add new features) Lack of innovation (team always busy fixing inefficiencies) Long Build/Test/Release Cycles (who broke the build?) Software architecture is hard to maintain and evolve Scalability is compromised (vertical scalability) Slow development pace (developers busy fixing issues) Customers frustrated (new releases take months)
  11. 11. Conway’s Law: “Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.” Melvyn Conway, 1967 So, it’s not only about changing the software architecture but also changing the way software teams are organized. … but How? http://www.melconway.com/Home/Conways_Law.html
  12. 12. Use Microservices!
  13. 13. What are Microservices? “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.”
  14. 14. The Anatomy of a Microservice Micro-service = Fine-grained Service-oriented architecture + “small” public API Micro-service Software Modules (application code, libraries, etc) Data Store (eg, DynamoDB, RDS, ElastiCache, S3) Public API addProductDetails(ProductId id, ProductDetails details) removeProductDetails(ProductId id) getProductDetails(ProductId id) : ProductDetails
  15. 15. Web of Microservices Store products in the warehouse Pick products for customers Report defects Track shipments Product Details
  16. 16. Benefits of Microservices for Amazon Build Test Release Build Test Release • 50 Million Deployments a Year • Software enhancements delivered every second Build Test Release Build Test Release Build Test Release Build Test Release … … … … … … Gigantic Web of Micro-services at Amazon 2-pizza Amazon Development Teams
  17. 17. Characteristics of Microservice Architectures Do one thing well Independent Decentralized Black box Polyglot You build it, you run it
  18. 18. Key Microservices Design Principles
  19. 19. public API Principle 1: Microservices only rely on each other’s public API public API Microservice A Microservice B
  20. 20. public API public API Principle 1: Microservices only rely on each other’s public API (Hide Your Data) Microservice A Microservice B
  21. 21. public API Nope! Microservice A Microservice B Principle 1: Microservices only rely on each other’s public API (Hide Your Data) public API
  22. 22. public API Microservice A Microservice B Principle 1: Microservices only rely on each other’s public API (Hide Your Data) public API
  23. 23. storeRestaurant (id, name, cuisine) Version 1.0.0 public API Microservice A Principle 1: Microservices only rely on each other’s public API (Evolve API in backward-compatible way…and document!)
  24. 24. storeRestaurant (id, name, cuisine) storeRestaurant (id, name, cuisine) storeRestaurant (id, name, arbitrary_metadata) addReview (restaurantId, rating, comments) Version 1.0.0 Version 1.1.0 public API Microservice A Principle 1: Microservices only rely on each other’s public API (Evolve API in backward-compatible way…and document!)
  25. 25. storeRestaurant (id, name, cuisine) storeRestaurant (id, name, cuisine) storeRestaurant (id, name, arbitrary_metadata) addReview (restaurantId, rating, comments) storeRestaurant (id, name, arbitrary_metadata) addReview (restaurantId, rating, comments) Version 1.0.0 Version 1.1.0 Version 2.0.0 public API Microservice A Principle 1: Microservices only rely on each other’s public API (Evolve API in backward-compatible way…and document!)
  26. 26. public API public API DynamoDB Microservice A Microservice B Principle 2: Use the right tool for the job (Embrace polyglot persistence)
  27. 27. public API public API DynamoDB Microservice A Microservice B Amazon Elasticsearch Service Principle 2: Use the right tool for the job (Embrace polyglot persistence)
  28. 28. public API public API RDS MySQL Microservice A Microservice B Amazon Elasticsearc Service Principle 2: Use the right tool for the job (Embrace polyglot persistence)
  29. 29. public API public API RDS MySQL Microservice A Microservice B Amazon Elasticsearc Service Principle 2: Use the right tool for the job (Embrace polyglot programming frameworks)
  30. 30. public API public API RDS Aurora Microservice A Microservice B Amazon Elasticsearc Service Principle 2: Use the right tool for the job (Embrace polyglot programming frameworks)
  31. 31. Principle 3: Secure Your Services • Defense-in-depth • Network level (e.g. VPC, Security Groups, TLS) • Server/container-level • App-level • IAM policies • Gateway (“Front door”) • API Throttling • Authentication & Authorization • Client-to-service, as well as service-to-service • API Gateway: custom Lambda authorizers • IAM-based Authentication • Token-based auth (JWT tokens, OAuth 2.0) • Secrets management • S3 bucket policies + KMS + IAM • Open-source tools (e.g. Vault, Keywhiz) API Gateway
  32. 32. Hey Sally, we need to call your micro- service to fetch restaurants details. Sure Paul. Which APIs you need to call? Once I know better your use cases I’ll give you permission to register your service as a client on our service’s directory entry. Micro-service A Micro-service B public API public API Principle 4: Be a good citizen within the ecosystem
  33. 33. Restaurant Micro-service 15 TPS100 TPS5 TPS20 TPS Before we let you call our micro-service we need to understand your use case, expected load (TPS) and accepted latency Principle 4: Be a good citizen within the ecosystem
  34. 34. …and many, many others! Distributed monitoring and tracing • “Is the service meeting its SLA?” • “Which services were involved in a request?” • “How did downstream dependencies perform?” Shared metrics • e.g. request time, time to first byte + User-experience metrics Distributed tracing • e.g. AWS X-Ray, Zipkin, OpenTracing, Wingtips Principle 4: Be a good citizen within the ecosystem
  35. 35. Principle 5: Automate everything AWS CodeCommit AWS CodePipeline AWS CodeDeploy EC2 ELB Auto ScalingLambdaECS DynamoDBRDS ElastiCache SQS SWF SES SNS API GatewayCloudWatch Cloud Trail KinesisElastic Beanstalk
  36. 36. Example Microservices Design Patterns in AWS
  37. 37. Simple EC2 based Microservice Architecture
  38. 38. Example Microservice Architecture on ECS
  39. 39. Serverless Microservice
  40. 40. Demo
  41. 41. Questions?

×