Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Refactoring enterprise applications for cloud-native architecture

Refactoring enterprise applications for cloud-native architecture

Modern applications allow you to accelerate the time to release while reducing risk and decreasing your total cost of ownership (TCO). In this chalk talk, learn best practices for refactoring traditional enterprise applications to a modern event-based microservices design. We dive into refactoring techniques used by AWS customers in optimizing their applications to take advantage of cloud-native architecture components and answer any related questions.

A53b603265b6c5bf492b18a182cb15d0?s=128

Dennis Kieselhorst

May 25, 2022
Tweet

More Decks by Dennis Kieselhorst

Other Decks in Technology

Transcript

  1. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Refactoring enterprise applications for cloud-native architecture Senior Solutions Architect AWS Yasser Quraishi (he/him) Senior Solutions Architect AWS Dennis Kieselhorst (he/him) M G R 3 0 3
  2. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Organizations are moving legacy applications and data to the cloud Modern Legacy Access cloud scale, performance, and operations Improve security and compliance Accelerate business transformation Reduce operating costs Increase agility and innovate quickly Goals SOURCE: Flexera 2021 State of the Cloud Report >50%of enterprise workloads and data are expected to be in a public cloud within 12 months Windows SAP VMware Databases Mainframe
  3. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. A sample application: How would you start? Proxy server Proxy server Enterprise application server Enterprise application server Commercial database NFS volume HTTPS load balancer Corporate data center
  4. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Challenge: Refactoring monolithic applications Business • Slow product innovation • Decreased time to market • Drive unclear team ownership boundaries • Changes have unforeseen side effects Technical • High coupling and low cohesion • Difficult and infrequent deployments • Apps are brittle and difficult to understand • Rapid experimentation has the potential of high- scale collateral impact 7 Rs Refactor Replatform Repurchase Rehost Relocate Retain Retire Business value
  5. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. First step: Lift and shift (rehost) AWS Cloud Region VPC Elastic Load Balancing (ELB) Amazon EC2 Amazon EC2 Monolith on premises Monolith on AWS Amazon S3 Proxy server Proxy server Enterprise application server Enterprise application server Commercial database NFS volume HTTPS load balancer Corporate data center Availability Zone Availability Zone Amazon RDS Primary Standby AWS CloudFormation Code repository CI/CD pipeline
  6. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. • Update the operating system • Upgrade frameworks • Improve security • Clean up access rights • Explore database options Related blog post: https://a.co/4DYzYdd Minimal viable refactoring
  7. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Containerize (replatform) AWS Cloud Region VPC Elastic Load Balancing (ELB) Container Container Amazon S3 Availability Zone Availability Zone Amazon RDS Primary Standby AWS CloudFormation Code repository CI/CD pipeline Amazon ECS Container registry AWS Cloud Region VPC Elastic Load Balancing (ELB) Amazon EC2 Amazon EC2 Availability Zone Availability Zone Amazon RDS Primary Standby Monolith on VMs Containerized monolith
  8. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS App2Container Discover and analyze Create application inventory and analyze runtime dependencies 1 Create deployment artifacts Generate the ECS tasks or Kubernetes pod definitions and create CI/CD pipelines 3 Extract and containerize Extract application with dependencies and create container image 2 Deploy to AWS and launch Store image in Amazon ECR and deploy to Amazon ECS or Amazon EKS 4
  9. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. • Make container images complete and static • Maintain fast container launch times by keeping container images as small as possible • Only run a single application (server) process with a container image • Handle SIGTERM within the application (server) • Configure containerized applications to write logs to stdout and stderr • Version container images using tags Best practices containerization
  10. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Traditional three-tier application architecture Web servers Presentation layers Application servers Business logic Database servers Data layer
  11. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Queues/messages Presentation Business logic Data Events Events A modern three-tier application architecture APIs
  12. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. How to break the monolith AWS Cloud Region VPC Elastic Load Balancing (ELB) Container Container Availability Zone Availability Zone Amazon RDS Primary Standby Amazon ECS Containerized monolith Invoicing Shopping cart Order management Inventory Notifications Product catalog
  13. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Breaking up the monolith Monolith Database Notifications
  14. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Create a new service for one domain (refactor) AWS Cloud Region VPC Elastic Load Balancing (ELB) Container Container Amazon S3 Availability Zone Availability Zone Amazon RDS Primary Standby AWS CloudFormation Code repository CI/CD pipeline Amazon ECS Container registry Amazon API Gateway AWS Lambda function Notifications
  15. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Breaking up the monolith Monolith Database Notifications Data store
  16. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Best practice: Use purpose-built databases Amazon Aurora Amazon RDS Amazon DynamoDB Amazon DocumentDB Amazon Timestream Amazon Neptune Amazon ElastiCache Amazon QLDB Amazon Keyspaces for Apache Cassandra Relational Referential integrity, ACID transactions, schema-on-write Key value High-throughput, low-latency reads and writes; endless scale Document Store documents and quickly access querying on any attribute In memory Query by key with microsecond latency Graph Time series Collect, store, and process data sequenced by time Ledger Scalable, highly available, and managed Apache Cassandra- compatible service Quickly and easily create and navigate relationships between data Wide column Complete, immutable, and verifiable history of all changes to application data Lift-and-shift, ERP, CRM, finance Content management, personalization, mobile Leaderboards, real-time analytics, caching Fraud detection, social networking, recommendation engine IoT applications, event tracking Systems of record, supply chain, healthcare, registrations, financial AWS service(s) Common use cases Build low-latency applications, leverage open source, migrate Cassandra to the cloud Real-time bidding, shopping cart, social, product catalog, customer preferences Amazon Redshift Amazon MemoryDB for Redis
  17. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Use a separate database AWS Cloud Region VPC Elastic Load Balancing (ELB) Container Container Amazon S3 Availability Zone Availability Zone Amazon RDS Primary Standby AWS CloudFormation Code repository CI/CD pipeline Amazon ECS Container registry Amazon API Gateway AWS Lambda function Amazon DynamoDB Notifications
  18. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. How to integrate services • Event = a signal that a system’s state has changed • Services interact through events • Events allow loose coupling E V E N T - D R I V E N A R C H I T E C T U R E "detail-type": OrderCreated "source": " ", "detail": "order_id": "created_at": "price": ”memberId":
  19. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Message bus and queues Client Client Message Synchronous communication Producer Consumer Message Message Queue Asynchronous communication Producer function Consumer function Action Event bus Event
  20. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Publisher/subscriber Topic Publisher Publisher AWS Lambda subscriber Email subscriber Amazon Kinesis Data Firehose subscriber
  21. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. How to properly direct external consumers AWS Cloud Region VPC Elastic Load Balancing (ELB) Container Container Amazon S3 Availability Zone Availability Zone Amazon RDS Primary Standby AWS CloudFormation Code repository CI/CD pipeline Amazon ECS Container registry Amazon API Gateway AWS Lambda function Amazon DynamoDB Notifications ?
  22. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Facade pattern Analogous to the proxy, a facade is an object that serves as a front-facing interface masking more complex underlying or structural code Service contract Monolith Shopping cart Order management Inventory Notifications Facade layer Product catalog Invoicing Product catalog Invoicing
  23. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Strangler Fig helps you achieve team independence and a modern app architecture • Define the interface to the first piece to be refactored • Design, implement, and test the new capability • Redirect old to new • Turn off the old code or service Refactor incrementally Strangler Fig pattern
  24. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Strangler Fig pattern example Monolith Shopping cart Order management Inventory Notifications
  25. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Migration Hub Refactor Spaces Reduce the time to set up and manage a refactor environment AWS Migration Hub Refactor Spaces Shield application consumers from infrastructure changes Reroute traffic from old to new across multiple AWS accounts Start refactoring applications in days instead of months
  26. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Delivering customer choice W I T H R E F A C T O R S P A C E S , Y O U C A N D E F I N E T H E R I G H T A P P R O A C H F O R E A C H A P P L I C A T I O N Choose how fast you want to transform an app Choose how much app transformation to do Launch new features in microservices with minimal risk to the existing app Partial app transformation running old and new together Complete app transformation, eliminating the existing app Leave and layer Strangler Fig
  27. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Refactor Spaces orchestration • AWS Transit Gateway, AWS RAM, and Amazon VPC to bridge networking across accounts, simplifying communication between old and new services • Amazon API Gateway for external access to transparently add new services or incrementally route traffic from old to new • Resource sharing across multiple accounts
  28. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Private subnet App refactor with Refactor Spaces Monolith instances Amazon API Gateway Network load balancer API Gateway Amazon VPC link Private subnet AWS Fargate Application load balancer AWS Transit Gateway Account (Refactor Spaces environment owner) Account (new microservice) Account (monolith) Amazon VPC Amazon VPC Private subnet Amazon VPC Create refactor space Share environment Create application Create services with URL or AWS Lambda Add routes
  29. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Best practices: Consider all key pillars of modernization Ops and governance at scale Automate, enable, and self-service People, process, and culture Organized for value Technology and architecture Independent business functions
  30. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Two-pizza team Small, decentralized teams are nimble Own and run what you build • Minimizes social constraints (Conway’s law) • Move from manual handoffs to “as a service” • Automate all the things • Simplify and decompose monoliths • Two-pizza service teams
  31. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Add more services for different domains AWS Cloud Region VPC Elastic Load Balancing (ELB) Container Container Availability Zone Availability Zone Amazon RDS Primary Standby AWS CloudFormation Code repository CI/CD pipeline Amazon ECS Container registry Amazon API Gateway AWS Lambda function Amazon DynamoDB AWS Lambda function Amazon DocumentDB AWS Lambda function Amazon Aurora Frontend App AWS Amplify … … Amazon SNS
  32. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Fully modernized application AWS Cloud Region AWS CloudFormation Code repository CI/CD pipeline Amazon API Gateway AWS Lambda function Amazon DynamoDB AWS Lambda function Amazon DocumentDB AWS Lambda function Amazon Aurora Frontend App AWS Amplify … … AWS Lambda function Amazon DynamoDB AWS Lambda function Amazon DynamoDB Amazon SNS
  33. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. • Keep functions simple – use single- focused functions • Each service should have its own data store • Use asynchronous communication to achieve loose coupling • Ensure backwards compatibility • Establish two-pizza teams with ownership • Automate all manual tasks Best practices: Microservices
  34. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Summary and actions we recommend
  35. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Modernization pathways: Overview Applications Databases Move to managed data Managed provisioning, backups, patching, monitoring, and scaling No code changes Amazon RDS Migrate to the cloud Apps/DBs run on VMs No code changes Customer operates everything above the infrastructure VMware Cloud on AWS Amazon EC2 Database on Amazon EC2 Relocate/rehost Purpose-built databases High performance and scalability Licensing savings Amazon Aurora Amazon DynamoDB Amazon Neptune Amazon Redshift Move to open-source License freedom/savings Performance improvement Cross-platform support Refactor/rewrite Move to containers Develop and deploy faster Application portability No code changes Replatform Amazon ECS AWS Fargate Amazon EKS Move to cloud- native Move from idea to market, faster Lower costs … AWS Lambda
  36. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. • Refactor when it provides business value • Ensure executive sponsorship and leadership commitment • Iterate incrementally; don’t use a big bang approach • Get in touch with AWS modernization experts and apply insights Actions we recommend
  37. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS has the tools, programs, and services Purpose-built AWS and partner offerings Third-party offerings Free resources AWS Professional Services Certified partner services Incentive programs Modern Legacy Windows SAP VMware Databases Mainframe
  38. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS has the innovation and experience Scale Security Performance Agile application development Advanced data analytics Resiliency 10+ years and thousands of customer migration and modernization projects completed
  39. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Deepen your skills with digital learning on demand Access 500+ free digital courses and Learning Plans Earn an industry-recognized credential AWS Skill Builder AWS Certifications Explore resources with a variety of skill levels and 16+ languages to meet your learning needs Join the AWS Certified community and get exclusive benefits Receive Foundational, Associate, Professional, and Specialty certifications Train now Access new exam guides © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Learn in-demand AWS Cloud skills
  40. Thank you! © 2022, Amazon Web Services, Inc. or its

    affiliates. All rights reserved. Dennis Kieselhorst linkedin.com/in/kieselhorst Yasser Quraishi linkedin.com/in/yasserquraishi
  41. © 2022, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Please complete the session survey in the mobile app Android iOS