AWS Services · 01

AWS Fundamentals

☁️ ap-south-1 · Python boto3 · AWS CLI
🗂️

1

Read the notes for this step ↓

🗒️ Step-by-step notes

🎯 Student AIM read this first · what you will learn on this page

Aim: By the end of this page you can explain what the AWS cloud is and use it safely from Python: pick a region, talk to AWS with the console, the CLI and boto3, know who secures what, keep the bill under control, and read ARNs and tags, the base for every other AWS page.

Description: Before S3, Glue or Athena, a data engineer needs the ground rules of AWS. On this page you compare on-premises servers with the cloud, learn regions and availability zones, open the three doors into AWS (console, AWS CLI and boto3), understand the shared responsibility model and pay-as-you-go pricing, and read ARNs and tags, using RegularMart’s account 123456789012 in ap-south-1 and code you can run yourself.

🤔 Why learn AWS fundamentals?

  • Buying servers means paying up front, waiting weeks and crashing in the big sale.
  • Every AWS service you learn next uses the same regions, roles, ARNs and tags.
  • Most AWS mistakes by beginners are fundamentals: wrong region, keys in code, no budget.
  • “Region vs AZ” and “shared responsibility” are classic first interview questions.

🌍 Where is it used?

  • 🛒 Online shops: scale up for a sale, scale down after.
  • 🏦 Banks and fintech: secure, audited, data kept in an Indian region.
  • 📺 Streaming apps: content for people across the country.
  • 🚀 Startups: start small, pay as they grow.
  • 🛠️ Data engineers: every pipeline runs in an account, a region, with IAM roles.

📘 What you will learn

  • Why AWS? The problem, where it is used, the road map.
  • With vs without AWS: on-premises servers vs the cloud, side by side.
  • Regions & AZs: cities and buildings, choosing a region, global vs regional vs zonal.
  • Console, CLI & boto3: three doors, aws configure, sessions, the credential chain.
  • Shared duty & cost: who secures what, pay-as-you-go, budgets and alarms.
  • ARNs & tags: full names of resources and name stickers for cost.
  • Pros / Cons: the strengths of AWS and its real limits (surprise bills, many choices, security, data-out cost, region trouble, lock-in).
  • Not a fit: when own servers, a laptop or an edge computer is the better choice.
  • Compare: Amazon EC2 vs AWS Lambda vs AWS Glue vs Amazon S3 vs Amazon RDS (who manages what).
  • Clouds: AWS vs Azure vs Google Cloud: accounts, tools, names, identity and budgets.
  • Where it fits: regions and AZs, IAM roles and the cost guard in the RegularMart architecture.

✅ After this page you can

  • Check who you are and which region you are in, from the CLI and boto3.
  • Explain regions, AZs and why a resource “disappears” in another region.
  • Give jobs IAM roles instead of keys, and keep keys out of code.
  • Create a budget and a billing alarm, and tag resources by project.
  • Answer the top 5 AWS fundamentals interview questions below.

Before you start: basic Python (variables, loops, functions, dictionaries), a terminal, and an AWS account (Free Tier) for the hands-on part.

🧠 All memory tricks

🧪 Practice Lab code + real-time scenarios · Python boto3 · AWS CLI · region ap-south-1

Step 1 · Setup

Install the AWS library for Python and the AWS CLI, then tell them your keys and region once:

Terminal
pip install boto3 awscli
aws configure
#   AWS Access Key ID     : AKIA...EXAMPLE
#   AWS Secret Access Key : ****************
#   Default region name   : ap-south-1
#   Default output format : json

🔑 Never paste real keys into code, chats or GitHub. aws configure asks for them once and stores them in ~/.aws/credentials. Keys on this page are fake placeholders like AKIA...EXAMPLE.

💸 AWS Free Tier covers most of these labs. When you finish, delete what you made: aws s3 rb s3://regularmart-raw --force (repeat for each regularmart-… bucket), aws sns delete-topic --topic-arn <arn>, aws budgets delete-budget --account-id <id> --budget-name rm-monthly

Create the resources (run once · python setup_regularmart.py):

Python · boto3 · setup_regularmart.py
# setup_regularmart.py · creates the RegularMart buckets (region ap-south-1)
import boto3

REGION = "ap-south-1"
s3 = boto3.client("s3", region_name=REGION)

for name in ["regularmart-raw", "regularmart-processed",
             "regularmart-curated", "regularmart-athena-results"]:
    s3.create_bucket(Bucket=name,
                     CreateBucketConfiguration={"LocationConstraint": REGION})
    print("created bucket", name)

Bucket names are global across all AWS accounts. If “regularmart-raw” is taken, add your initials (for example regularmart-raw-sd) and use that name everywhere. Real output of this script: created bucket regularmart-raw · created bucket regularmart-processed · created bucket regularmart-curated · created bucket regularmart-athena-results

Step 2 · Sample data

Save these files next to your scripts. orders.csv is the same 5 RegularMart orders as the whole series. usage_example.csv uses round practice prices, NOT real AWS prices (use the AWS Pricing Calculator for real numbers).

orders.csv

CSV · the RegularMart orders
order_id,customer_id,product,amount,order_date
5001,1,Mobile,15000,2024-01-05
5002,2,Laptop,55000,2024-01-07
5003,1,Headphones,2000,2024-01-09
5004,4,Watch,3500,2024-01-10
5005,6,Shoes,2500,2024-01-11

usage_example.csv

CSV · practice prices · Task 8
service,meter,quantity,price_per_unit_usd
S3,GB-month stored,50,0.025
S3,1000 GET requests,200,0.0004
Glue,DPU-hour,10,0.44
Athena,TB scanned,0.2,5.0
Lambda,1M requests,3,0.2

student_policy.json

JSON · IAM policy · Task 5
{"Version": "2012-10-17",
 "Statement": [{
   "Effect": "Allow",
   "Action": ["s3:ListBucket", "s3:GetObject", "s3:PutObject"],
   "Resource": ["arn:aws:s3:::regularmart-*",
                "arn:aws:s3:::regularmart-*/*"]
 }]}

usage_example.csv 5 rows

servicemeterquantityprice_per_unit_usd
S3GB-month stored500.025
S31000 GET requests2000.0004
GlueDPU-hour100.44
AthenaTB scanned0.25.0
Lambda1M requests30.2

Step 3 · Real-time scenario tasks easy → hard · try first, then click

EasyCLI · who am I?

Task 1 🪪 First day at RegularMart. Before you touch anything, prove which AWS account your terminal is using.

💭 Hint: aws sts get-caller-identity answers “who am I?”. --query picks one field; --output text removes the quotes.

EasyRegions · AZs

Task 2 🏙️ Your lead asks: “Which AWS regions are in India, and which availability zones does Mumbai (ap-south-1) have?”

💭 Hint: aws ec2 describe-availability-zones --region … --query "AvailabilityZones[].ZoneName"; boto3 ec2.describe_regions() lists regions.

Easyboto3 · session

Task 3 🔑 Write the first boto3 script of the project: a session for ap-south-1 that prints the account and the buckets, and shows WHERE boto3 found the keys, without any key in the code.

💭 Hint: boto3.Session(region_name=...) → .client("sts") / .client("s3"); session.get_credentials().method tells the source.

MediumRegional resources

Task 4 🔍 Suresh created rm-orders-queue in Mumbai, but his script says it “does not exist”. His script uses us-east-1. Show the problem and the fix.

💭 Hint: Create the queue with an ap-south-1 client, then list queues with a us-east-1 client and with an ap-south-1 client.

MediumShared responsibility · IAM

Task 5 🛡️ Security is YOUR side of the shared responsibility model. Stop using the root user: create a data-engineers group that may only read and write regularmart-* buckets, and add Suresh to it.

💭 Hint: iam.create_group → put_group_policy with student_policy.json (Step 2) → create_user → add_user_to_group.

MediumARNs

Task 6 🪪 The team keeps pasting ARNs with the wrong region. Create the alerts topic, the orders queue and the Glue job role, then split each ARN into its parts so everyone can read them.

💭 Hint: Every ARN is arn:partition:service:region:account:resource → arn.split(":", 5).

MediumTags

Task 7 🏷️ Finance wants the AWS bill split by project. Tag the raw bucket, the orders queue and the alerts topic with project=regularmart, env=dev, owner=suresh, then find every RegularMart resource with ONE call.

💭 Hint: Each service has its own tag call; the Resource Groups Tagging API (get_resources with TagFilters) searches across services.

MediumPay as you go

Task 8 💰 Before go-live, the manager asks: “Roughly what will one month cost, and which service costs the most?” Use the practice usage file (round example prices) and SQL.

💭 Hint: cost = quantity × price_per_unit; GROUP BY service; ORDER BY cost DESC. Real prices: the AWS Pricing Calculator.

HardBudgets

Task 9 📧 You are learning on your own card. Create a 10 USD monthly cost budget that emails suresh@example.com when actual spend passes 80 %.

💭 Hint: budgets.create_budget(AccountId, Budget, NotificationsWithSubscribers=[...]); the Budgets API lives in us-east-1.

HardBilling alarm

Task 10 ⏰ Also add a CloudWatch billing alarm: when estimated charges go above 10 USD, notify an SNS topic. Remember: billing metrics live only in us-east-1.

💭 Hint: Create the topic in us-east-1, then put-metric-alarm on namespace AWS/Billing, metric EstimatedCharges, dimension Currency=USD. In a real account, first turn on “Receive Billing Alerts” in the Billing preferences.

Step 4 · Top 5 interview questions easy → tricky · click to reveal

Step 5 · Mini challenge: 🧭 RegularMart’s day-1 account health check

Your first task as the data engineer: one script that prints the account and region, the Mumbai AZs, tags all four regularmart-* buckets with project=regularmart, creates the rm-pipeline-alerts topic (tagged), creates a 10 USD monthly budget, and finally lists every resource tagged project=regularmart with its service and region read from the ARN.

💭 Hint: Reuse Tasks 2, 3, 6, 7 and 9. The tagging API returns ARNs; split them with arn.split(":", 5).