About Sa Sa dot Com Limited
Sa Sa dot Com Limited is a global chain store company selling cosmetics, personal care, skin care and baby care products, often at discounted prices.
The company was founded by Kwok Siu-Ming in 1978. It was listed on the Hong Kong Stock Exchange in 1997. The chain has over 280 retail stores in Hong Kong, Macau, Mainland China, Singapore, Malaysia and Taiwan. In 2015, Forbes named Sa Sa one of their “Asia’s 200 Best Under a Billion” companies.
- Huge upfront costs in early stage if they choose to replace the current physical machines with new ones
- The resources in on-premises environment are lack of elasticity
- They use BitBucket for code repository, but there is no CI/CD flow for current stage
- There would be a mounts of the website update for Promotion/ Festival, traditional(manual) deployment may not be efficient and error-prone
- The current deployment timeframe is very long; it costs more than 2 hours in average to finish each website update
- They need online small dev and staging environments based on the prod flow for developers
Solutions provided by eCloudvalley
- Dev, Staging and Production environments: make use of the AWS VPC service to ensure the isolation between dev, staging and production environments. Also make use of the AWS VPN Connection and Direct Connect service to provide users to connect AWS EC2 and on-premise environment to balance the workload between EC2s, ECV suggest to make use of the ELB. Through AWS’s Elastic Load Balancing mechanism, traffic is diverted to EC2 dispersed in Available Zone A and Available Zone B
- Database: to mitigate the database management effort, eCloudvalley proposed to use AWS RDS (Relational Database Service) with Oracle. With few clicks of setup process, a high resilience and high performance database is launched. AWS would take care of the underlying virtual machine’s system patch, security firewall and health status. Moreover, it provides lots of the functionality likes auto minor version upgrade, snapshot, read replica …etc on the database, which could relieve the management difficulties customer encounters
- Web Accelerates User Experience: In order to speed up the user experience and prevent users from waiting for time-consuming in the overall network traffic environment, website uses CloudFront for acceleration so that users’ requests could quickly arrive at CloudFront’s edge nodes around the world. Respond immediately and disperse the capacity bottleneck of global users on the terminal demand traffic
- Easily Deploy AP New Versions: Further, to accelerate the deployment timeframe, ECV proposes a CI/CD flow. In the flow, ECV kept the usage of BitBucket which customers already leverage as a Git repository. Then ECV integrate BitBucket with the AWS CodeBuild to provide a testing and CI flow. To seamlessly and automatically deploy the code to AWS EC2 service, ECV also make use of the CodeDeploy to pack the codes and deploy it to EC2 servers
Proposed Solution & Architecture
In the design, ECV make use of the AWS VPC service to ensure the isolation between dev, staging and production environments. To provide high availability ability, we apply multi-az design principle and also auto-scaling policy on the Web and Application EC2s.
Figure 2. Infrastructure Diagram for Sa Sa
Further, to accelerate the deployment timeframe, ECV proposes a CI/CD flow as Figure 3. In the flow, ECV propose to maintain customer’s current code repository ‘Bitbucket’ to mitigate the transformation overhead. After developer commits the code to Bitbucket, it would trigger AWS CodeBuild to compile the code and pack it to a compression file. Then the webhook which runs in AWS Lambda would trigger the AWS CodeDeploy auto deploy the program to the corresponding environment.
The more detailed components in the architecture are as follow：
- CloudFront：CloudFront is a global content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to your viewers with low latency and high transfer speeds
- Simple Storage Service (S3)： Amazon S3 is object storage built to store and retrieve any amount of data from anywhere – web sites and mobile apps, corporate applications, and data from IoT sensors or devices. It is designed to deliver 99.999999999% durability, and stores data for millions of applications used by market leaders in every industry
- Relational Database Service(RDS)：RDS makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching and backups
- Lambda：AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security
- Elastic Compute Cloud (EC2)：EC2 presents a true virtual computing environment, allowing you to use web service interfaces to launch instances with a variety of operating systems, load them with your custom application environment, manage your network’s access permissions, and run your image using as many or few systems as you desire
- CodeBuild：CodeBuild is a fully managed build service. You just specify the location of your source code, choose your build settings, and CodeBuild will run build scripts for compiling, testing, and packaging your code. There are no servers to provision and scale, or software to install, configure, and operate
- CodeDeploy ：AWS CodeDeploy is a service that automates software deployments to a variety of compute services including Amazon EC2, AWS Lambda, and instances running on-premises. AWS CodeDeploy makes it easier for you to rapidly release new features, helps CTS avoid downtime during application deployment, and handles the complexity of updating your applications. CTS can use AWS CodeDeploy to automate software deployments, eliminating the need for error-prone manual operations. The service scales to match your deployment needs, from a single Lambda function to thousands of EC2 instances
- CodePipeline：CodePipeline is a continuous integration and continuous delivery service for fast and reliable application and infrastructure updates. CodePipeline builds, tests, and deploys your code every time there is a code change, based on the release process models you define. This enables you to rapidly and reliably deliver features and updates
- AWS Config ：AWS Config simplifies compliance auditing, security analysis, change management, and operational troubleshooting by continuously recording and evaluating your AWS resource configurations
- CloudWatch ：Amazon CloudWatch is a monitoring service for AWS cloud resources and the applications you run on AWS. Sa Sa can use Amazon CloudWatch to collect and track metrics, collect and monitor log files, set alarms, and automatically react to changes in your AWS resources such as Amazon EC2 instances, autoscaling and Amazon RDS DB instances
Through Sa Sa’ s case, Sa Sa dot Com Ltd. successfully constructed an production environment which is capable of handling heavy traffic loads on AWS. There is no idle machine at cost instead, it is charged based on number of incoming requests and runtimes in the AWS environments. Customers could make use of the managed service, likes RDS, and it would extremely reduce an amounts of daily maintenance costs and expenses. Lastly, the problem with the release is also solved by using use CodeBuild and CodeDeploy. There is no longer a service stoppage time.