© 2020, Amazon Web Services, Inc. or its Affiliates.
How to migrate an existing
application to serverless
Marcia Villalba
@mavi888uy
© 2020, Amazon Web Services, Inc. or its Affiliates.
About me
AWS Developer Advocate
Coding for more than 15 years
Host of FooBar YouTube Channel
https://youtube.com/foobar_codes
© 2020, Amazon Web Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates.
2 stories
rovio
Successful story
Not that
successful story
© 2020, Amazon Web Services, Inc. or its Affiliates.
Serverless
”Serverless is a
methodology for
planning, building and
deploying software in a
way that maximizes value
by minimizing
undifferentiated heavy
lifting…”
Jeremy Daly
© 2020, Amazon Web Services, Inc. or its Affiliates.
What it means that something is serverless?
No managing infrastructure High availability built in
Pay for what you useScales automagically
© 2020, Amazon Web Services, Inc. or its Affiliates.
@theburningmonk
© 2020, Amazon Web Services, Inc. or its Affiliates.
Story 1
© 2020, Amazon Web Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates.
© 2020, Amazon Web Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates.
The big
rewrite
Please don’t do it
Strategy 1
© 2020, Amazon Web Services, Inc. or its Affiliates.
Story 2
© 2020, Amazon Web Services, Inc. or its Affiliates.
SCALING CHALLENGES
350
DONATIONS PER SECOND
© 2020, Amazon Web Services, Inc. or its Affiliates.
2016
Drupal 7 monolith
- Static content
- Pay-in fundraising
- Gift aid declaration
- Fundraiser gallery
- Contact us
Giving
Pages
Donate
© 2020, Amazon Web Services, Inc. or its Affiliates.
Where to start migrating?
Strategy 1
Start with the least critical
part of your system
Strategy 2
Start with the part of the
system with the highest
return of invested time
🤔
© 2020, Amazon Web Services, Inc. or its Affiliates.
2017
Drupal 7 monolith
- Static content
- Contact us
Drupal 8
- Static content
Pay-in
fund-
raising
SMS
Gift aid
Fundraise
gallery
Giving
Pages
Donate
© 2020, Amazon Web Services, Inc. or its Affiliates.
2018
Drupal 8
- Static content
Pay-in fund-
raising
SMS
Gift aid
Giving
Pages
Donate
Contact
us
Red Nose
Comp
School
step calc
© 2020, Amazon Web Services, Inc. or its Affiliates.
2018
Drupal 8
- Static content
Pay-in fund-
raising
SMS
Gift aid
Contact
usGiving
Pages
Donate
Red Nose
Comp
School
step calc
Mailer Service
Postcode lookup
© 2020, Amazon Web Services, Inc. or its Affiliates.
2019
Drupal 8
- Static content
Pay-in fund-
raising
Contact
us
Payment Service layer
Image uploader service
Marketing preferences service
Mailer Service
Postcode lookup service
SMS Gift
Aid
Donate
Donate
bit.ly/cr-donate-blueprint
OLD VS NEW
March 2019 cost*
$5,393
March 2015 cost*
$83,908
*All hosting costs are paid for through corporate partnerships.
100% of public donations go to the projects we fund.
WE COULD DO
IT ALL AGAIN TOMORROW
Serverless services cost
$92
© 2020, Amazon Web Services, Inc. or its Affiliates.
comicrelief.com/donate
© 2020, Amazon Web Services, Inc. or its Affiliates.
Strategy 2 - Strangler pattern
Monolith
Users
DB
Monolith
Service1
LB
Users
DBDB
Monolith
LB
Service1 Service n
Users
DB DB DB
© 2020, Amazon Web Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps for doing the strangler pattern
Migrating to serverless in 5 steps
© 2020, Amazon Web Services, Inc. or its Affiliates.
Foundational work
© 2020, Amazon Web Services, Inc. or its Affiliates.
Things to do before getting started
- Reverse Conway manuover
- Pick your tools
- Use infrastructure as code
- CI/CD pipeline
- Monitoring and observability
© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps
1. Find the seams of the code – if you have a monolith
© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps
1. Find the seams of the code – if you have a monolith
2. Organize the code inside the monolith
© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps
1. Find the seams of the code – if you have a monolith
2. Organize the code inside the monolith
3. Move the code gracefully
© 2020, Amazon Web Services, Inc. or its Affiliates.
Express tips to design serverless
applications
© 2020, Amazon Web Services, Inc. or its Affiliates.
EXPRESS TIPS TO DESIGN SERVERLESS APPS
1. Logical microservices
© 2020, Amazon Web Services, Inc. or its Affiliates.
Tidy Monolith
LB
Users
Logical microservice
AWS Lambda AWS Lambda
AWS Lambda AWS Lambda
AWS Lambda
DB
DB
© 2020, Amazon Web Services, Inc. or its Affiliates.
EXPRESS TIPS TO DESIGN SERVERLESS APPS
1. Logical microservices
2. Event – driven architectures
© 2020, Amazon Web Services, Inc. or its Affiliates.
Decoupling the services and functions
- Independent releases
- Scalability
- Modular code
- Easy to maintain and to work on
- Adds resiliency to the application Amazon Simple
Notification
Service
Amazon Simple
Queue Service
Amazon
EventBridge
© 2020, Amazon Web Services, Inc. or its Affiliates.
Why do you need a router?
© 2020, Amazon Web Services, Inc. or its Affiliates.
EXPRESS TIPS TO DESIGN SERVERLESS APPS
1. Logical microservices
2. Event – driven architectures
3. Replace what you can with managed services
© 2020, Amazon Web Services, Inc. or its Affiliates.
Replace existing functionality with managed services
Amazon Cognito
Order service
Customer
service
Items service
Users
© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps
1. Find the seams of the code – if you have a monolith
2. Organize the code inside the monolith
3. Move the code gracefully
4. Break the database
© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps
1. Find the seams of the code – if you have a monolith
2. Organize the code inside the monolith
3. Move the code gracefully
4. Break the database
5. Break the APIs
© 2020, Amazon Web Services, Inc. or its Affiliates.
Closing remarks
© 2020, Amazon Web Services, Inc. or its Affiliates.
Steps start migrating
1 – Do the foundational work
2 – Move your monolith to the cloud if needed
3 – Find the seams for your code
4 – Organize the data layer
5 – Move the code to serverless
6 – Break the database
7 – Break the APIs
8 – Repeat from step 5 until 7 until you are done
© 2020, Amazon Web Services, Inc. or its Affiliates.
Thanks a lot
Marcia Villalba
Developer Advocate AWS
Twitter: @mavi888uy
YouTube: https://youtube.com/foobar_codes

20200522 - How to migrate an existing app to serverless

  • 1.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. How to migrate an existing application to serverless Marcia Villalba @mavi888uy
  • 2.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. About me AWS Developer Advocate Coding for more than 15 years Host of FooBar YouTube Channel https://youtube.com/foobar_codes
  • 3.
    © 2020, AmazonWeb Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates. 2 stories rovio Successful story Not that successful story
  • 4.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Serverless ”Serverless is a methodology for planning, building and deploying software in a way that maximizes value by minimizing undifferentiated heavy lifting…” Jeremy Daly
  • 5.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. What it means that something is serverless? No managing infrastructure High availability built in Pay for what you useScales automagically
  • 6.
    © 2020, AmazonWeb Services, Inc. or its Affiliates.
  • 7.
  • 8.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Story 1
  • 9.
    © 2020, AmazonWeb Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates.
  • 10.
    © 2020, AmazonWeb Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates. The big rewrite Please don’t do it Strategy 1
  • 11.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Story 2
  • 12.
    © 2020, AmazonWeb Services, Inc. or its Affiliates.
  • 13.
  • 14.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 2016 Drupal 7 monolith - Static content - Pay-in fundraising - Gift aid declaration - Fundraiser gallery - Contact us Giving Pages Donate
  • 15.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Where to start migrating? Strategy 1 Start with the least critical part of your system Strategy 2 Start with the part of the system with the highest return of invested time 🤔
  • 16.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 2017 Drupal 7 monolith - Static content - Contact us Drupal 8 - Static content Pay-in fund- raising SMS Gift aid Fundraise gallery Giving Pages Donate
  • 17.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 2018 Drupal 8 - Static content Pay-in fund- raising SMS Gift aid Giving Pages Donate Contact us Red Nose Comp School step calc
  • 18.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 2018 Drupal 8 - Static content Pay-in fund- raising SMS Gift aid Contact usGiving Pages Donate Red Nose Comp School step calc Mailer Service Postcode lookup
  • 19.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 2019 Drupal 8 - Static content Pay-in fund- raising Contact us Payment Service layer Image uploader service Marketing preferences service Mailer Service Postcode lookup service SMS Gift Aid Donate
  • 20.
  • 21.
    OLD VS NEW March2019 cost* $5,393 March 2015 cost* $83,908 *All hosting costs are paid for through corporate partnerships. 100% of public donations go to the projects we fund.
  • 22.
    WE COULD DO ITALL AGAIN TOMORROW Serverless services cost $92
  • 23.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. comicrelief.com/donate
  • 24.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Strategy 2 - Strangler pattern Monolith Users DB Monolith Service1 LB Users DBDB Monolith LB Service1 Service n Users DB DB DB
  • 25.
    © 2020, AmazonWeb Services, Inc. or its Affiliates.© 2020, Amazon Web Services, Inc. or its Affiliates. Steps for doing the strangler pattern Migrating to serverless in 5 steps
  • 26.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Foundational work
  • 27.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Things to do before getting started - Reverse Conway manuover - Pick your tools - Use infrastructure as code - CI/CD pipeline - Monitoring and observability
  • 28.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Steps 1. Find the seams of the code – if you have a monolith
  • 29.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Steps 1. Find the seams of the code – if you have a monolith 2. Organize the code inside the monolith
  • 30.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Steps 1. Find the seams of the code – if you have a monolith 2. Organize the code inside the monolith 3. Move the code gracefully
  • 31.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Express tips to design serverless applications
  • 32.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. EXPRESS TIPS TO DESIGN SERVERLESS APPS 1. Logical microservices
  • 33.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Tidy Monolith LB Users Logical microservice AWS Lambda AWS Lambda AWS Lambda AWS Lambda AWS Lambda DB DB
  • 34.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. EXPRESS TIPS TO DESIGN SERVERLESS APPS 1. Logical microservices 2. Event – driven architectures
  • 35.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Decoupling the services and functions - Independent releases - Scalability - Modular code - Easy to maintain and to work on - Adds resiliency to the application Amazon Simple Notification Service Amazon Simple Queue Service Amazon EventBridge
  • 36.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Why do you need a router?
  • 37.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. EXPRESS TIPS TO DESIGN SERVERLESS APPS 1. Logical microservices 2. Event – driven architectures 3. Replace what you can with managed services
  • 38.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Replace existing functionality with managed services Amazon Cognito Order service Customer service Items service Users
  • 39.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Steps 1. Find the seams of the code – if you have a monolith 2. Organize the code inside the monolith 3. Move the code gracefully 4. Break the database
  • 40.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Steps 1. Find the seams of the code – if you have a monolith 2. Organize the code inside the monolith 3. Move the code gracefully 4. Break the database 5. Break the APIs
  • 41.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Closing remarks
  • 42.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Steps start migrating 1 – Do the foundational work 2 – Move your monolith to the cloud if needed 3 – Find the seams for your code 4 – Organize the data layer 5 – Move the code to serverless 6 – Break the database 7 – Break the APIs 8 – Repeat from step 5 until 7 until you are done
  • 43.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Thanks a lot Marcia Villalba Developer Advocate AWS Twitter: @mavi888uy YouTube: https://youtube.com/foobar_codes