AWS for DevOps — Introduction Exercises

3 minute read

Practice Exercises — Introduction

Test your understanding of AWS fundamentals.


Exercise 1 — Regions and Availability Zones

Your company has users in India and Europe. You need to deploy a web application close to both user bases. Which two AWS Regions would you choose, and why would you deploy in at least two Availability Zones per Region?

Show Answer

Regions:

  • ap-south-1 (Mumbai) — close to Indian users for low latency
  • eu-west-1 (Ireland) — close to European users and the most service-rich EU Region

Why multi-AZ: Each Availability Zone is a physically separate data centre. If one AZ has a power failure or network issue, the application continues running in the other AZ. Multi-AZ deployment provides fault tolerance — your application survives AZ-level failures without downtime.


Exercise 2 — Shared Responsibility Model

A developer on your team says: “We don’t need to worry about patching — AWS handles all of that.” Is this correct? Explain what changes if they run their app on EC2 vs Lambda.

Show Answer

The developer is partially wrong.

On EC2 (IaaS):

  • AWS patches the hardware and hypervisor.
  • You are responsible for patching the operating system (Amazon Linux, Ubuntu, etc.), the application runtime, and the application itself.
  • You should use SSM Patch Manager to automate OS patching.

On Lambda (Serverless):

  • AWS patches everything — hardware, OS, and runtime.
  • You are only responsible for your function code and IAM permissions.

The shared responsibility boundary shifts based on the service type. The developer’s statement is true for Lambda but wrong for EC2.


Exercise 3 — Free Tier Limits

You plan to run a t2.micro EC2 instance 24/7 for two months. How many free tier hours will you use, and will you be charged?

Show Answer

Calculation:

  • 24 hours × 30 days = 720 hours per month
  • Free tier allows 750 hours per month for t2.micro
  • Month 1: 720 hours used, 30 hours remaining — no charge
  • Month 2: 720 hours used, 30 hours remaining — no charge

You are within the free tier limit as long as you only run one t2.micro instance. If you run two instances simultaneously, you consume 1,440 hours/month, exceeding the 750-hour limit by 690 hours — those extra hours will be charged.

Important: The 12-month free tier clock starts from the day you create your AWS account, not from when you first launch an instance.


Exercise 4 — CLI Configuration

You have three AWS accounts — dev, staging, and production. Set up the AWS CLI so you can run commands against any account without re-running aws configure each time.

Show Answer

Use named profiles:

$ aws configure --profile dev
$ aws configure --profile staging
$ aws configure --profile prod

Then use the --profile flag:

$ aws s3 ls --profile dev
$ aws ec2 describe-instances --profile prod

Or set a default for the terminal session:

$ export AWS_PROFILE=staging
$ aws s3 ls    # uses staging profile

Your ~/.aws/credentials file will have:

[dev]
aws_access_key_id = AKIADEV...
aws_secret_access_key = ...

[staging]
aws_access_key_id = AKIASTG...
aws_secret_access_key = ...

[prod]
aws_access_key_id = AKIAPROD...
aws_secret_access_key = ...

Exercise 5 — Service Categories

Categorise the following AWS services into their primary function: EC2, S3, Lambda, CloudWatch, IAM, CodePipeline, VPC, CloudFormation.

Show Answer
Service Category Function
EC2 Compute Virtual servers
S3 Storage Object storage
Lambda Serverless / Compute Event-driven functions
CloudWatch Monitoring Metrics, alarms, logs
IAM Security Identity and access management
CodePipeline CI/CD Deployment pipeline orchestration
VPC Networking Isolated virtual network
CloudFormation Infrastructure as Code Automate resource provisioning

A DevOps engineer works with all of these categories. Understanding which category a service belongs to helps you quickly identify the right tool for the job.


Next Chapter → IAM & Security

Updated: