AWS Certified Cloud Practitioner (CLF-C02) Exam Prep›one shop website moved from an office server to aws
Card 1 of 5

Moving ChaiCart to AWS

ChaiCart is an online tea shop in India. Its website used to run on an office server, a computer kept in the company's own building. The move to AWS changes where those parts run, but visitors still use the same website.

Each part of the website gets a matching AWS service:

Part of the websiteBeforeOn AWS
Web pages and app codeOffice serverAmazon EC2
Splitting visitor requestsOne office serverApplication Load Balancer
Products, customers, ordersDatabase on the office serverAmazon RDS for MySQL
Product photosOffice server folderAmazon S3
Curious? Ask the AI Guide
1 / 5

One shop website moved from an office server to aws

Lesson 1 of 88 in AWS Certified Cloud Practitioner (CLF-C02) Exam Prep. Free to read, no account needed.

Moving ChaiCart to AWS

ChaiCart is an online tea shop in India. Its website used to run on an office server, a computer kept in the company's own building. The move to AWS changes where those parts run, but visitors still use the same website.

Each part of the website gets a matching AWS service:

Part of the websiteBeforeOn AWS
Web pages and app codeOffice serverAmazon EC2
Splitting visitor requestsOne office serverApplication Load Balancer
Products, customers, ordersDatabase on the office serverAmazon RDS for MySQL
Product photosOffice server folderAmazon S3

Application Load Balancer

A visitor opening the ChaiCart home page sends a request over the internet. Once ChaiCart runs several web servers, something must decide which one answers each request. The Application Load Balancer receives every request and passes it to one of the web servers.

Each web server is an Amazon EC2 virtual server, a rented machine in AWS's data centres that runs the page and application code. Here are four visitors and where the load balancer sends them:

Visitor requestSent to
1. Priya opens the home pageWeb server 1
2. Arjun searches for Assam teaWeb server 2
3. Meena opens her cartWeb server 3
4. Ravi opens the home pageWeb server 1

Database on RDS for MySQL

ChaiCart keeps its products, customer accounts and orders in a database. On the office server, that database ran on the same machine as the website. Amazon RDS for MySQL runs a MySQL database on AWS for ChaiCart, so the shop keeps the same database software.

Worked example: Ravi buys 2 packs of Assam tea at ₹450 each, a total of ₹900. The order is saved in the RDS for MySQL database, not on the web server that handled his visit. Because every web server reads from the same database, any of them can show Ravi his order.

Product photos in S3

Product photos are large files that the website shows on every product page. Amazon S3 is a service that stores files as whole objects, and it keeps them apart from the web servers and the database.

Worked example: the photo of Darjeeling tea is stored in S3 as one file. The product page contains only a link to that file. When a visitor opens the page, the browser fetches the photo from S3, so the web servers never have to hold a copy.

The Mumbai Region

Every AWS service ChaiCart uses has to run somewhere. A Region is the geographic area you choose for your AWS services, and each Region has its own AWS data centres. ChaiCart uses the Asia Pacific (Mumbai) Region, code ap-south-1.

That choice places the EC2 web servers, the Application Load Balancer, the RDS for MySQL database and the S3 product photos in ap-south-1. Visitors reach the same website, and all four parts sit together in Mumbai.

Practice questions

  1. 1.

    In AWS, what is a Region, such as ap-south-1?

    • A.

      A rented virtual server that runs the page code

    • B.

      A chosen geographic area containing its own AWS data centres

    • C.

      A folder in S3 that stores product photo files

    • D.

      A single office server holding every ChaiCart web page

    Show answer
    Answer: B.

    A chosen geographic area containing its own AWS data centres

    A Region is the geographic area you choose for AWS services, and each Region has its own data centres. ap-south-1 is the Asia Pacific (Mumbai) Region. Option 1 describes an EC2 server, option 3 an S3 folder, and option 4 the old office server.

  2. 2.

    ChaiCart moves three office-server items to AWS: web page code, order records and product photo files. Which mapping is correct?

    • A.

      Page code on S3, orders on EC2, photos on RDS

    • B.

      Page code on EC2, orders on RDS, photos on S3

    • C.

      Page code on RDS, orders on S3, photos on EC2

    • D.

      Page code on RDS, orders on EC2, photos on S3

    Show answer
    Answer: B.

    Page code on EC2, orders on RDS, photos on S3

    Page code and app code run on Amazon EC2 virtual servers, order records live in Amazon RDS for MySQL, and product photo files are stored in Amazon S3. The option saying page code on RDS and orders on S3 swaps the database and storage roles. The option saying orders on EC2 treats the web servers as storage, which the lesson rules out. The option saying photos on RDS puts large image files in the database, but photos are stored as whole files in S3.

  3. 3.

    ChaiCart has two web servers behind the Application Load Balancer, with sticky sessions turned off (the default). Ravi's home page request goes to Web server 1. Where does the balancer send his next request, opening his cart?

    • A.

      To the RDS for MySQL database, because the cart is stored there

    • B.

      To one of the web servers, chosen again for this request

    • C.

      To Web server 1, because it handled Ravi's earlier request

    • D.

      To Web server 2 only, since Web server 1 is busy with the home page

    Show answer
    Answer: B.

    To one of the web servers, chosen again for this request

    With sticky sessions off, the balancer chooses a web server for each request, so the next request can go to either server. Option 2 states this. Option 3 assumes the balancer keeps a visitor on the server they first reached, which only happens when stickiness is turned on for the target group. Option 1 wrongly sends the request to the database, which the balancer never does, and option 4 assumes a fixed split by load, which the lesson does not describe.

  4. 4.

    ChaiCart's EC2 web server that handled Ravi's order fails and is replaced with a new one. Where is Ravi's order record now?

    • A.

      Held only by the Application Load Balancer

    • B.

      Still in the Amazon RDS for MySQL database

    • C.

      Deleted along with the failed web server

    • D.

      Copied into the Amazon S3 product photo storage

    Show answer
    Answer: B.

    Still in the Amazon RDS for MySQL database

    The order record is saved in the RDS for MySQL database, not on the web server that handled the visit, so replacing that web server leaves the record in place. The option claiming it is deleted with the web server assumes order data lives on the web server, which the lesson rules out. The option claiming it is copied into S3 confuses order rows with product photo files, which belong in S3 only as photos. The option claiming the load balancer holds it is wrong because the balancer only passes requests along and does not store orders.

  5. 5.

    ChaiCart's web tier runs on Amazon EC2. Which description of one EC2 virtual server is correct?

    • A.

      A rented machine in AWS data centres running app code

    • B.

      A storage area holding product photos as whole files

    • C.

      A machine ChaiCart buys and keeps in its office

    • D.

      A database holding customer accounts and orders

    Show answer
    Answer: A.

    A rented machine in AWS data centres running app code

    An EC2 virtual server is a rented machine in AWS's data centres that runs the page and application code. The option describing a machine ChaiCart buys and keeps in its office is the misconception, since that describes the old office server. The database option describes RDS for MySQL, and the storage option describes S3.

  6. 6.

    Which AWS service runs ChaiCart's web pages and app code instead of the office server?

    • A.

      Application Load Balancer

    • B.

      Amazon EC2 virtual servers

    • C.

      Amazon S3 storage

    • D.

      Amazon RDS for MySQL

    Show answer
    Answer: B.

    Amazon EC2 virtual servers

    Amazon EC2 virtual servers are the web tier: they run the web pages and application code in place of the office web server. The Application Load Balancer only spreads visitor requests across those servers, so it does not run the code. Amazon RDS for MySQL holds the products, customers and orders, and Amazon S3 holds the product photos. Neither of those runs the web pages.

  7. 7.

    A visitor opens the product list page on the ChaiCart website. Which AWS services handle the request, in order?

    • A.

      Application Load Balancer, then RDS for MySQL, then EC2 web server

    • B.

      Application Load Balancer, then EC2 web server, then RDS for MySQL

    • C.

      EC2 web server, then RDS for MySQL, with no load balancer in between

    • D.

      EC2 web server, then Application Load Balancer, then RDS for MySQL

    Show answer
    Answer: B.

    Application Load Balancer, then EC2 web server, then RDS for MySQL

    The Application Load Balancer receives the request first and forwards it to one EC2 web server. That web server then queries RDS for MySQL for the product rows. The option placing RDS before the web server reverses the flow, and the option starting with the EC2 web server skips the load balancer that receives every visitor request. The option with no load balancer assumes visitors reach a web server directly, which the load balancer prevents. The product photos are not part of this request chain, since the browser fetches them from S3 separately.

  8. 8.

    Which AWS service stores ChaiCart's customer accounts and order history?

    • A.

      Application Load Balancer: spreads visitor requests across web servers

    • B.

      Amazon S3: stores product photos as whole files

    • C.

      Amazon EC2: rented virtual servers running web pages and app code

    • D.

      Amazon RDS for MySQL: runs a MySQL database on AWS

    Show answer
    Answer: D.

    Amazon RDS for MySQL: runs a MySQL database on AWS

    Amazon RDS for MySQL is the service that holds ChaiCart's product, customer and order data in a MySQL database. Amazon S3 stores product photos, not customer or order records. Amazon EC2 runs the web pages and application code, so it is the web tier, not the data store. The Application Load Balancer only routes visitor requests to web servers and stores nothing.

  9. 9.

    ChaiCart runs three web servers behind an Application Load Balancer. Four visitors each send one request, and the balancer routes them as shown:

    Visitor requestSent to
    Priya opens the home pageWeb server 1
    Arjun searches for Assam teaWeb server 2
    Meena opens her cartWeb server 3
    Ravi opens the home pageWeb server 1

    How many of these requests does Web server 1 receive?

    • A.

      One request

    • B.

      Three requests

    • C.

      All four requests

    • D.

      Two requests

    Show answer
    Answer: D.

    Two requests

    Web server 1 receives Priya's and Ravi's requests, so two requests. 'One request' ignores the second home page visit sent there. 'Three requests' miscounts Meena's cart request, which goes to Web server 3. 'All four requests' assumes the balancer sends every visitor to the same server, which the table contradicts.

  10. 10.

    ChaiCart now runs three EC2 web servers behind a load balancer. What does a visitor's browser connect to?

    • A.

      The one shop address that reaches the load balancer

    • B.

      A separate address for each EC2 web server

    • C.

      The address of the RDS for MySQL database

    • D.

      The S3 address where product photos are stored

    Show answer
    Answer: A.

    The one shop address that reaches the load balancer

    The Application Load Balancer receives every visitor request at the one shop address and passes it to a web server, so visitors never pick a server. Choosing a separate address for each EC2 web server is the misconception the balancer removes. The S3 address holds only photo files, and the RDS address holds the database, so neither is where a visitor's browser connects to load the shop.

Take these as a timed quiz

Lessons in A Shop Moves To The Cloud

  1. One shop website moved from an office server to aws
  2. Renting capacity vs buying servers
  3. Paying only for what you use
  4. Managed vs self-managed services
  5. Cloud vs hybrid vs on-premises deployment

88 lessons across 10 topics. See the full course