Giter VIP home page Giter VIP logo

aws-saas-factory-serverless-workshop's Introduction

AWS SaaS Factory Monolith to Serverless SaaS Workshop

Overview

The move from a single-tenant monolithic architecture to a multi-tenant, modern architecture can be challenging for many organizations. The tight coupling and interwoven dependencies of a monolithic environment makes it especially difficult to move your system to microservices. Now, layer on that the goal of moving to a serverless model that supports multi-tenant SaaS and you now have a rather long list of technical, migration, and design challenges that will further complicate this transformation.

Given this complexity, many organizations will attempt to tackle this migration in a more evolutionary fashion where the elements of your system are incrementally transformed to a modern multi-tenant architecture without requiring some “big bang” moment where you completely rewrite your system. This approach also tends to fit better with the business priorities of organizations that are trying to find ways to continue to support existing customers while they gradually move their architecture over to this new model.

The goal of this lab is to guide you through a monolith to serverless SaaS migration that provides a more in-depth look at the common moving parts of this problem. Certainly, each solution will have its own unique collection of migration challenges. However, seeing a working example can provide you with insights into patterns and strategies that can help shape your approach to moving your monolithic environment to a multi-tenant SaaS model.

In this Lab, we'll start with a traditional monolithic architecture for a working sample application. Then, we'll progressively migrate the elements of the single-tenant monolithic architecture to a modern multi-tenant solution. This will include moving to a modern web application hosted on S3, introducing the API Gateway, decomposing the application tier into serverless microservices, and carving data out of our monolithic database and moving management of this data to the individual microservices that take over ownership of managing this data. Along the way, we'll also introduce the elements needed to introduce multi-tenant best practices into your solution.

How do I start?

If you are participating in this workshop during an AWS event, follow the instructions of the instructors on site.

If you would like to run through the lab exercises in a self-guided manner, follow the steps below:

  1. Use an existing S3 bucket, or create a new S3 bucket in the same AWS Region where you’re going to run the workshop.
  2. Copy the 2 CloudFormation custom resources and the main workshop template to your S3 bucket.
aws s3 cp s3://aws-saas-factory-serverless-saas-workshop-us-west-2/CopyS3Objects.jar ./ && aws s3 cp CopyS3Objects.jar s3://my-saas-workshop-bucket/ 
aws s3 cp s3://aws-saas-factory-serverless-saas-workshop-us-west-2/ClearS3Bucket.jar ./ && aws s3 cp ClearS3Bucket.jar s3://my-saas-workshop-bucket/ 
aws s3 cp s3://aws-saas-factory-serverless-saas-workshop-us-west-2/workshop.template ./ && aws s3 cp workshop.template s3://my-saas-workshop-bucket/
  1. Launch the workshop’s CloudFormation stack and give it your S3 bucket name as the value for the EEAssetsBucket parameter. Leave all other parameters default.
aws cloudformation create-stack --capabilities CAPABILITY_NAMED_IAM --stack-name saas-workshop --template-url https://my-saas-workshop-bucket.s3.amazonaws.com/workshop.template --parameters ParameterKey=EEAssetsBucket,ParameterValue=my-saas-workshop-bucket

Replace my-saas-workshop-bucket with your settings. The stack will probably take around 20+ minutes to complete due to the RDS clusters.

Note that this workshop deploys infrastructure into your AWS account that is outside of the free tier, and you should delete the CloudFormation stack when you are finished to minimize costs.



Lab 1 – Deploying, Exploring, and Exercising the Single-Tenant Monolith

Lab1

Lab 2 – Onboarding, Identity, and a Modern Client

Lab2

Lab 3 – Carving Out Our First Multi-Tenant Serverless Microservice

Lab3

Lab 4 – Extracting the Remaining Service — Goodbye Monolith!

Lab4

Proceed to Lab 1 when you are ready to begin.

License

This workshop is licensed under the MIT-0 License. See the LICENSE file.

aws-saas-factory-serverless-workshop's People

Contributors

amazon-auto avatar apeeters avatar billtarr-aws avatar bluedoors avatar brtrvn avatar dependabot[bot] avatar nicolasbolanosamazon avatar robin-xyzt-ai avatar zpbappi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-saas-factory-serverless-workshop's Issues

Failed to copy assets from s3

Following command in README failed.

aws s3 cp s3://aws-saas-factory-serverless-saas-workshop-us-west-2/CopyS3Objects.jar ./
fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden

Lab 2 / Step 15 issue, open blank page for product

Hi,

I created the tenant successfully. I can login to my tenant. On the dashboard I saw that we have 122 products and 122 Orders.
But when I click to create new product as guidance, the page is blank.

Please help to check and advise me.

Thank you!

Deprecated PostgreSQL Version (13.6) in CloudFormation Template Causes Deployment Failure

The CloudFormation template fails to deploy due to a deprecated PostgreSQL version (13.6). This causes an error during the RDS resource creation, blocking the workshop's setup.

Resource handler returned message: "Cannot find version 13.6 for aurora-postgresql (Service: Rds, Status Code: 400, Request ID: fb96b633-7d68-4ff5-a98c-7c7a60f80e70)" (RequestToken: 22d733e0-1ade-8f69-e1b3-99801b99e611, HandlerErrorCode: InvalidRequest)

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/AuroraPostgreSQL.Updates.html#AuroraPostgreSQL.Updates.20180305.136X

Please update the template to use a supported PostgreSQL version for Aurora RDS.

Lab 1 - Step 15 : Git commit step does not trigger codepipeline.

Git push does commits the changes to CodeCommit but not on the main branch. The pipeline is set to trigger on main branch. Is this by design ?

Mitigated by creating a pull request OR directly committing to the main branch will trigger the Codepipeline to run.

Lab 2 & 4 : Multi-tenant support does not work for more than 1 registration.

After completing lab 2 and all the steps successfully, i proceed to try to simulate a second tenant by signing up with a whole different set of fictitious account. However after multiple attempts, the "new" tenant was created but showed 122 orders & products in the dashboard of the app.

After completing lab 4, I was also not able to create a "new" tenant successfully.

Is this by design of the lab ?

Autoscale Health Check doesn't utilise ELB checks

The configuration for the Auto Scaling Group only utilises EC2 Health Checks. When leaving the lab running over for a few days noticed that 502 errors were returned in the HTML site. tracking down the problem the ALB had the two backing EC2 instances marked as 'unhealthy' and therefore were not routing traffic. However they remained in the Autoscale pool as they were marked as Healthy by the EC2 health check (rather than the defined ALB Health Check /health.html).

Suggest updating the Cloudformation to configure the Auto Scaling Groups HealthCheckType to use ELB health checks.

Lab2 website-lab2.sh issue replacing the API Gateway URL

Tried to start Lab2 again and found that there is an issue on step 2 :
The sed command in website-lab2.sh does not properly replace the API Gateway URL in the client/src/shared/config.jsfile.
There are no visible errors appart that later the call from the React Client to the REST API fails while trying to call the register URL /v1/registration
After fixing this issue and redeploying the React Client with website-lab2.sh I fall into another trap : the registration Lambda is returning an error :
Cannot register new tenant. Hot pool of RDS clusters has been depleted.

Instructions to setup the Lab1 environment

I am referring to the instructions for Lab1. It looks like that the instructions in the Readme assumes a lot of steps with the environment setup. Can we verify on what all steps should someone execute while trying the Lab1 in their AWS account and also for the subsequent labs.
As an example, there are multiple bash scripts and CF templates in the resources folder, do we need to run them in any definite order?

Base Structure for workshop

The manual assumes the account we are working on already have a pipeline provisioned where adding the repo will directly kick in the pipeline and build the stack, which is the case for people trying to do the workshop on their own.

Is there any document to show the base architect they started from ?

master to main

Recent change by user brtrvn "Changing the name of the default branch to main from master" 9b1ff9b 2 days ago
Appears to have updated the code commit repo default branch to main however the Lab1 template CodePipeline source stage and CloudWatch Event still appear to reverence master.

Will update Lab1.template and submit PR

When deleting lab1.template the LogGroup with name /var/log/messages is getting recreated

When you delete the lab1.template, the template is deleting the LogGroup with name /var/log/messages but the EC2 instance has a cloudwatch logs agent which is creating a LogGroup with name /var/log/messages to log messages while EC2 is shutting down. The issue with this is later when you rerun the lab1.template in the same account it will fail saying LogGroup with name /var/log/messages already exists.

Lab 2 npm audit vulnerabilities

During step 3 of Lab 2 (deploying the website), the npm package installation fails the audit so nothing gets installed (or built), resulting in no website behind CloudFront.

89 vulnerabilities (38 moderate, 50 high, 1 critical)

Can work-around by modifying website-lab2.sh to reference npm install --audit=false which is subjectively ok for a sample.

Lab 2 Error on public-read ACL

Lab 2 errors out when running "sh website-lab2.sh" throwing a PutObject Access Denied when run with "--acl public-read".

If "Block Public Access" is disabled, the script works. This is not the recommended best practice for S3 buckets.

Nested stacks of [saas-workshop] are failing due to unsupported runtime Java8 issue.

Following documentation here

"eventSource": "lambda.amazonaws.com",
    "eventName": "CreateFunction20150331",
    "awsRegion": "us-east-2",
    "sourceIPAddress": "cloudformation.amazonaws.com",
    "userAgent": "cloudformation.amazonaws.com",
    "errorCode": "InvalidParameterValueException",
    "errorMessage": "The runtime parameter of java8 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (java21) while creating or updating functions.",

Lab 2: Unable to build React app

During Lab 2, the React app fails to build because webpack 4.x uses a legacy openssl provider, documented here.

A workaround is to add the following to website-lab2.sh:

export NODE_OPTIONS=--openssl-legacy-provider

Error:

Creating an optimized production build... Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at module.exports (/home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/webpack/lib/NormalModule.js:417:16) at handleParseError (/home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/webpack/lib/NormalModule.js:471:10) at /home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/webpack/lib/NormalModule.js:503:5 at /home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/webpack/lib/NormalModule.js:358:12 at /home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/loader-runner/lib/LoaderRunner.js:373:3 at iterateNormalLoaders (/home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/loader-runner/lib/LoaderRunner.js:214:10) at iterateNormalLoaders (/home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/loader-runner/lib/LoaderRunner.js:221:10) /home/ec2-user/environment/saas-factory-serverless-workshop/lab2/client/node_modules/react-scripts/scripts/build.js:19 throw err; ^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.