Skip to content

Project · Cloud Computing (AWS, Azure, Google Cloud)

Project: a serverless GST calculator API

Projectintermediate· about 5 hours· 8 steps

The brief

Build a small API that works out GST for an invoice: CGST and SGST for a sale inside one state, IGST for a sale to another state. Write and test the Lambda handler in the browser, estimate the monthly bill, deploy it to AWS Lambda in Mumbai, call it from the CLI, add a CloudWatch alarm for errors, and remove it all.

Why it matters

Billing apps, e-commerce sellers and accounting software for Indian shops all need GST worked out the same way, and many teams run small jobs like this as serverless functions because they cost nothing when idle. Writing a handler that rejects bad input, knowing what it will cost at scale and watching it with an alarm is everyday work for a cloud or backend developer.

Skills you practise

  • Lambda handlers (event, context)
  • API responses with statusCode and a JSON body
  • input validation and 400 errors
  • CGST, SGST and IGST
  • Lambda pricing: requests and GB-seconds
  • aws lambda invoke
  • CloudWatch alarms
  • cleaning up a function, its logs and role

You need

  • A free AWS account with a budget alert set (lab cc-lab-safe-account)
  • AWS CLI v2 configured with an IAM Identity Center or IAM user profile, not root, region ap-south-1; AWS CloudShell in Mumbai is easiest for the JSON quoting

What you will have at the end

lambda_function.py (a tested GST API handler) and cost.py (a Lambda cost calculator), pasted proof that the function ran in Mumbai with an alarm on its errors, and proof that everything was removed.

How it is marked (rubric, 100 points)
Correct handlerEvery browser check passes: CGST/SGST/IGST, input checks, 200 and 400 answers with a JSON string body.35
Ran in the cloudThe deployed function returned the same total, and a bad request came back as 400, not a crash.25
Cost and monitoringThe cost calculator passes, and you can say at what traffic the bill stops being zero; the alarm watched Errors.20
Cleaned upThe function, alarm, log group and role were all deleted.20

0/8 steps done

Step 1 of 8

Split the GST

gst_split(amount, rate, inter_state) returns the taxable amount, rate, CGST, SGST, IGST and total.

GST in India is split by where the sale happens. Inside one state (a Pune shop selling to a Pune customer), half the tax is CGST for the centre and half is SGST for the state. Between states (a Pune seller shipping to Bengaluru), the whole tax is IGST.

So for ₹1,000 at 18%: inside a state CGST ₹90 + SGST ₹90; between states IGST ₹180; the total is ₹1,180 either way. Work out CGST and SGST as amount × rate ÷ 200 each and round every money value to 2 decimals.

Run shows what your code prints. Check runs the step's tests. Ctrl+Enter checks too.