Simple Storage Service (S3)

Amazon S3 (Simple Storage Service) 101

Amazon S3 – Core Concepts
S3 Objects
S3 Buckets

S3 Security (Bucket Policies & ACLs)

Providing Access to S3
S3 Bucket Policies

When to Use Identity vs Resource Policies

S3 Access Control Lists (ACLs)
S3 Block Public Access Setting

S3 Static Website Hosting & Billing

S3 Static HTTP Website Hosting
S3 Static Website Hosting – Use Cases
  1. Content Offloading
    • Move large static files (e.g., images, videos) from compute services to S3
    • Reduces load on services like EC2 and lowers costs
    • Example: store images in S3 and return their URLs from an application
  2. Out-of-Band Failover Pages
    • Host backup or maintenance pages separately from the main application
    • Ensures availability even if the primary compute service fails
    • Example: redirect traffic to an S3-hosted status page during downtime
  3. Static Website Hosting
    • Ideal for simple, non-dynamic websites such as blogs or portfolio pages
S3 Billing

S3 Object Versioning & MFA Delete

S3 Object Versioning
S3 Operations With and Without Versioning
S3 Object Versioning → // S3 Operation ↓DISABLEDENABLEDSUSPENDED
Standard GETReturns the objectReturns the most recent versionReturns the most recent version
Version GETNot supportedRetrieves the specified versionRetrieves the specified version
Standard PUT (update object)Replaces the existing objectCreates a new version and marks it as currentReplaces the current version
Standard DELETEPermanently removes the objectAdds a delete marker, older versions remainAdds a delete marker, older versions remain
Version DELETENot supportedDeletes a specific versionDeletes a specific version
MFA Delete

S3 Performance Optimization

Default S3 Single-Stream Uploads
S3 Multipart Upload
S3 Transfer Acceleration

Encryption 101

Encryption – Key Concepts
Encryption Approaches

Encryption at Rest

Encryption in Transit

Encryption Types

Symmetric Encryption

Asymmetric Encryption and PKI

Digital Signing
Steganography

Envelope Encryption

Envelope Encryption – Key Concepts
Envelope Encryption – Encrypt/Decrypt Processes

Scenario: Many cat pictures are stored in Amazon S3, and we want to encrypt them securely using AWS KMS.

Encryption Process

  1. Customer creates a KMS key for use with S3
  2. S3 requests KMS to generate a DEK for a cat picture
  3. KMS generates a DEK and returns:
    • Plaintext DEK → used immediately by S3 to encrypt data
    • Wrapped DEK (ciphertext version) → stored alongside encrypted object
  4. S3 encrypts the cat picture using the plaintext DEK, then discards the plaintext DEK
  5. Encrypted cat picture and wrapped DEK are stored together
  6. Repeat for all pictures

Why envelope encryption?

Decryption Process

  1. Customer requests access to an encrypted cat picture
    • If the customer lacks KMS permissions, S3 cannot decrypt the object
  2. S3 sends the wrapped DEK to KMS to unwrap (decrypt) it
  3. KMS verifies permissions and identifies which KMS key (KEK) was used
  4. KMS decrypts the DEK and returns the plaintext DEK to S3
  5. S3 decrypts the cat picture using the plaintext DEK, then discards the DEK
  6. S3 returns the decrypted cat picture to the customer

This approach ensures security, efficiency, and granular access control.

AWS Key Management Service (KMS)

AWS KMS – Overview & Key Concepts

What KMS Does

Security & Isolation

Cryptographic Operations
OperationDescription
CreateKeyCreates a KMS key and stores it encrypted in HSMs
EncryptEncrypts plaintext using a KMS key → returns ciphertext
DecryptDecrypts ciphertext → returns plaintext (KMS key info embedded in ciphertext)
GenerateDataKeyGenerates a Data Encryption Key (DEK) for bulk encryption (>4 KB)

KMS permissions are very granular → allows strict role separation

KMS Keys

Types of KMS keys

  1. AWS-owned (default, free)
    • Used automatically by AWS services (S3, SQS, DynamoDB)
    • Shared across accounts → low admin overhead, but limited security controls
  2. Customer-owned
    • AWS-managed (free) → AWS creates/manages, rotates automatically yearly
    • Customer-managed ($1/month) → customer creates and manages manually
      • Supports aliases (unique per region)
      • Supports automatic rotation (yearly) or on-demand rotation
      • Can be used by AWS services or custom apps

Billing

KMS Key Policies & Permissions

Data Encryption Keys (DEKs)
Demo: Shell Commands
echo "find all the doggos, distract them with the yumz" > battleplans.txt# Encrypt file
aws kms encrypt \
--key-id alias/catrobot \
--plaintext fileb://battleplans.txt \
--output text \
--query CiphertextBlob \
| base64 --decode > not_battleplans.enc # Decrypt file
aws kms decrypt \
--ciphertext-blob fileb://not_battleplans.enc \
--output text \
--query Plaintext | base64 --decode > decryptedplans.txt

S3 Encryption

S3 Encryption In Transit
S3 Object Encryption (Encryption At Rest)
S3 Server-Side Encryption (SSE)

SSE-S3 (AES-256)

SSE-KMS

SSE-C

Summary Table for S3 Encryption At Rest
S3 Encryption MethodKey ManagementCryptographic ProcessingNotes / Extras
SSE-S3Managed by S3Encryption/decryption handled by S3– No control over keys
– No role separation
SSE-KMSManaged by KMS (AWS or customer)S3 performs crypto operations using KMS keys– Key rotation control
– Supports role separation and auditing
SSE-CProvided by customerS3 uses customer key for crypto ops– Keys never stored in AWS
– Supports role separation
CSE (Client-Side Encryption)CustomerEncryption/decryption handled by client– S3 only stores ciphertext
– AWS never sees plaintext

S3 Bucket Keys

Scaling Challenges with S3 SSE-KMS
S3 Bucket Keys for SSE-KMS

S3 Object Storage Classes

Overview of S3 Storage and Classes

Key S3 characteristics:

Billing overview:

S3 storage classes:

  1. “Warm” storage (frequent or infrequent access):
    • Standard, Standard-IA, One-Zone-IA
  2. “Cold” storage (archival):
    • Glacier Instant Retrieval (IR), Glacier Flexible Retrieval (FR), Glacier Deep Archive (DA)
  3. Intelligent-Tiering:
    • Automatically moves objects between tiers based on access patterns.
S3 Standard (Default)
S3 Standard-Infrequent Access (IA)
S3 One Zone-Infrequent Access (1Z-IA)
S3 Glacier Instant Retrieval (IR)
S3 Glacier Flexible Retrieval (FR)
S3 Glacier Deep Archive (DA)

S3 Intelligent-Tiering

S3 Lifecycle Configuration

S3 Lifecycle Management, Configuration, and Rules

Action Types

  1. Transition Actions
    • Move objects to a different storage class after a specified time.
    • Example: Move objects to Glacier-IR 30 days after creation.
  2. Expiration Actions
    • Automatically delete objects or previous versions.
    • Example: Delete previous versions on the first of each month.

Important: Conditions are not based on object access or usage.

Transition Flow

Std → Std-IA → Intelligent-Tiering → 1Z-IA → Glacier-IR → Glacier-FR → Glacier-DA

Exceptions:

Key Considerations

S3 Replication

S3 Replication – Overview

Replication Types:

Use Cases:

S3 Replication – Architecture

S3 Replication – Features

S3 Replication – Considerations & Limitations

S3 Presigned URLs

Limitations of Anonymous S3 Access to Private Resources
S3 Presigned URL – Architecture

How it works:

  1. An IAM user or role calls generatePreSignedURL and provides:
    • Credentials
    • Expiration time
    • Object key
    • Operation type (GET for download or PUT for upload)
  2. S3 returns a presigned URL, which can be shared with external users.

Common Use Cases of Presigned URLs

Presigned URL – Important Behaviors

S3 Select and Glacier Select

S3/Glacier Select – Overview

Key Features

S3 Events

S3 Events – Architecture

Configuration Components

Key Consideration

S3 Access Logs

S3 Server Access Logging – Architecture

Log Structure

Logging Process

Configuration

1. Source Bucket

2. Target Bucket

Important Considerations

Common Use Cases

S3 Object Lock

S3 Object Lock – Key Concepts

Important Considerations

S3 Object Lock – Legal Hold

Use Cases

S3 Object Lock – Retention Period

Retention Modes

1. Governance Mode

Use Cases:

2. Compliance Mode

Use Cases:

S3 Access Points

Scaling Limitations for Granular Configurations in S3 Buckets
S3 Access Points – Architecture

Access Point Policies

Network Access Control

LAB: S3 Multi-Region Access Point (MRAP)

S3 Multi-Region Access Point (MRAP) – Overview
Stage 1 – Create an MRAP
Stage 2 – Configure Replication
Stage 3 – Test the MRAP

Preparation

Test Process

  1. Create a test file: dd if=/dev/urandom of=<file_name> bs=1M count=10
  2. Upload to MRAP: aws s3 cp <file_name> s3://<MRAP_ARN>
  3. Observe which bucket receives the file first

Test Scenarios

Key Insight

Stage 4 – Cleanup

Network Storage and Data Lifecycle

Amazon EFS (Elastic File System)

Amazon EFS (Elastic File System) – Architecture
EFS Performance Settings

Throughput Modes

  1. Bursting (Default)
    • Throughput increases as the file system grows in size.
    • Uses a burst credit model similar to GP2 EBS volumes.
  2. Enhanced Throughput Modes
    • Elastic Throughput
      • Automatically adjusts based on workload demand.
      • Suitable for unpredictable or variable access patterns.
    • Provisioned Throughput
      • Allows specifying throughput independently of storage size.
      • Useful for consistent, high-performance requirements.

Performance Modes

  1. General Purpose (Default)
    • Optimized for low latency.
    • Suitable for web applications, CMS platforms, and general file sharing.
  2. Max I/O
    • Designed for high throughput and parallel workloads.
    • Trades lower latency for increased scalability.
    • Common in analytics or large-scale processing workloads.

EFS Storage Settings

Storage Classes

  1. Standard
    • Intended for frequently accessed data.
  2. Infrequent Access (IA)
    • Lower cost for less frequently used files.
  3. Archive
    • Lowest-cost tier for rarely accessed data.

Additional EFS Features

DEMO: Using EFS with EC2 WordPress Instances

Demo: Implementing a Basic EFS

Configuring an EC2 Instance to Use EFS

  1. df -k
    • Displays all currently mounted file systems and available disk space.
    • Initially confirms that no EFS file system is mounted.
  2. sudo mkdir -p /efs/wp-content
    • Creates the directory structure for mounting EFS.
    • The -p option ensures intermediate directories are created if needed.
  3. sudo dnf -y install amazon-efs-utils
    • Installs required utilities for interacting with EFS.
    • The -y flag automatically approves installation prompts.
  4. sudo nano /etc/fstab
    • Opens the file that defines file systems to mount at boot.
    • Add the following entry at the end: <file-system-id>:/ /efs/wp-content efs _netdev,tls,iam 0 0
    • Replace <file-system-id> with the actual EFS ID.
  5. sudo mount /efs/wp-content
    • Mounts the file system based on the fstab configuration.
  6. df -k
    • Verifies that the EFS file system is now mounted.
WordPress Architecture with EFS

AWS Backup 101

AWS Backup – Basic Concepts
AWS Backup – Key Components

Backup Plans

Backup Resources

Backup Vault

On-Demand Backups

Point-In-Time Recovery (PITR)

Key Takeaways

SQL Databases & RDS

Database Models

Databases – Basic Concepts

Core Concepts

Relational Databases (SQL / RDBMS)
SQL Databases: Row vs Column Design

Row-Based Databases (OLTP)

Column-Based Databases (OLAP)

Non-Relational (NoSQL) Databases

Key-Value Stores

Wide Column Stores

Document Databases

Graph Databases

Database Models – Summary
ModelStructureTypical Use Cases
Relational (SQL)Fixed schema, tables with rows and columnsStructured data with defined relationships
Row-based (OLTP)Rows stored togetherTransactional systems
Column-based (OLAP)Columns stored togetherAnalytics and reporting
Key-valueSimple key-value pairsCaching, simple lookups
Wide columnFlexible attributes with structured keysLarge-scale applications
DocumentJSON/XML documentsCMS, user data, catalogs
GraphNodes and relationshipsRelationship-driven systems

Databases: ACID vs BASE

CAP Theorem
  1. Consistency (C)
    • Every read returns the most recent write, or an error if that’s not possible.
    • If you write a new value and read immediately, you either get the new value or an error.
  2. Availability (A)
    • Every request receives a response, but it may not be the latest data.
  3. Partition Tolerance (P)
    • DB continues to operate even if network partitions or node failures occur.
    • Messages between nodes may fail, but the system keeps running.

Trade-off Example:

ACID Transaction Model (SQL / RDBMS)
  1. Atomic
    • Transaction succeeds entirely or not at all.
    • $10 transfer example: money must leave Account A and arrive in Account B.
  2. Consistent
    • DB moves from one valid state to another.
    • Invalid states are never allowed.
  3. Isolated
    • Parallel transactions do not interfere; end result is as if transactions were sequential.
  4. Durable
    • Committed transactions persist even after crashes.
    • Once the DB reports success, data is stored safely on non-volatile memory.
BASE Transaction Model (NoSQL / DynamoDB)
  1. Basically Available
    • R/W operations available as much as possible, without strict consistency guarantees.
  2. Soft State
    • Consistency is not enforced in DB; handled by the application.
    • Data returned may not be the latest.
  3. Eventually Consistent
    • Given enough time, the DB will converge to the latest state.
    • Immediate consistency is not guaranteed by default.
Exam Power Notes (AWS)

Databases in EC2

Monolith vs DB-Split Architecture
Why Databases on EC2 Are Bad Practice

1. Administrative Overhead

2. Single Availability Zone Limitation

3. Fewer Features Compared to Managed Services

4. Poor Scalability and No Serverless Options

When a Database on EC2 Might Be Justified

These scenarios should be carefully validated:

1. OS-Level Access Required

2. Advanced Database Customization

3. AWS Does Not Support the Requirement

4. Business Decision

Key AWS Exam Takeaways

Amazon RDS (Relational Database Service) 101

Amazon RDS – Key Concepts
RDS Architecture
RDS Billing Overview
  1. Instance fee:
    • Billed hourly (per-second granularity)
    • Cost depends on instance size & type
  2. Multi-AZ mode: extra cost (extra instance + storage)
  3. Storage fee: per GB/month
    • Storage type affects price (e.g., Provisioned IOPS more expensive)
  4. Data transfer fee: per GB in/out of instance
    • Free within the same region
  5. Backups & snapshots: per GB/month
    • Free backup storage = size of your DB storage
  6. Licensing fee: if using commercial DB engines

DEMO: Migration of WordPress DB to a Different DB Tier

Migration of MariaDB to a Different EC2 Instance
Migration of MariaDB to RDS (Free Tier)

Part 1: Creation of an RDS Instance

Part 2: Migration from EC2 DB Instance to RDS

RDS Multi-AZ Deployments

RDS Multi-AZ – Instance Deployment
RDS Multi-AZ – Cluster Deployment

RDS Snapshots, Automatic Backups, and Restore

Backing Up Data in RDS

RDS Manual Snapshots

RDS Automated Backups

Restoring Data in RDS

RDS Read-Replicas (RRs)

RDS Read-Replicas (RRs) – Architecture
Promotion of RDS Read-Replicas & Disaster Recovery

DEMO: RDS Multi-AZ & Snapshot Restore

When taking a snapshot, it is a good idea to include the DB engine and DB version in the snapshot name. Multi-AZ deployment and creation of a standby replica are recommended for PROD usage:

Backup windows are defined when creating the instance and can be adjusted later in the instance settings. When creating a standby replica (Multi-AZ), it can be created immediately or in the next backup window:

An RDS instance can be rebooted with failover if a standby replica is configured:

After restoring a snapshot, the new instance will take some time to become available.

RDS Data Security

RDS Encryption

RDS Encryption in Transit

RDS Encryption at Rest

  1. EBS Volume Encryption with KMS
    • Default option, handled by the host and underlying EBS storage.
    • DEKs generated from AWS-managed or customer-managed KEKs/CMKs.
    • DEKs are loaded on hosts as required for encryption/decryption operations.
    • Cannot be removed once enabled.
    • Transparent to the DB engine; DB sees unencrypted data.
  2. Transparent Data Encryption (TDE)
    • Native DB engine encryption (supported by RDS MSSQL and RDS Oracle).
    • Data encrypted by DB engine before being written to disk.
    • RDS Oracle can integrate with AWS CloudHSM, giving stronger key controls.
    • CloudHSM is secured by the customer, keeping AWS out of the trust chain.

RDS Authentication and Authorization

Local DB Users

IAM Authentication for RDS

RDS Custom

RDS Custom – Key Facts

Amazon Aurora 101

Amazon Aurora – Overview
Aurora Provisioned Architecture

Cluster (DB Instances)

Storage (Cluster Volume)

Access (Endpoints)

Aurora Billing (Provisioned)
Aurora Features

Aurora Global Database

Aurora Global DB – Overview

Replication Architecture

Benefits

  1. Cross-region disaster recovery & business continuity
    • Failover possible if primary region fails.
    • Very low downtime (low RTO) and minimal data loss (low RPO).
  2. Global read scaling
    • Secondary regions serve read traffic → reduces latency internationally.
    • Ideal for applications with global users needing fast reads.

Aurora Multi-Master Writes

Aurora Single-Master Mode (Default)

Key point: Single-Master clusters have a single write target; reads can be scaled via replicas.

Aurora Multi-Master Mode

Key point: Multi-Master allows multiple writers simultaneously, enabling high availability and potential FT applications, but app complexity increases.

Quick comparison table:

FeatureSingle-MasterMulti-Master
Write Instances11–16
Read ScalingReader replicasApp handles reads
FailoverReplica promoted, cluster endpoint updatedInstant via app, no promotion needed
App ComplexityLowHigh (must manage reads/writes & failover)
Use CaseStandard HAHigh availability, FT applications

Aurora Serverless

Aurora Serverless – Key Concepts
Aurora Serverless v1 – Architecture
Aurora Serverless – Benefits
  1. Simpler management model with reduced administrative overhead for database capacity
  2. Automatic and seamless scaling of compute and memory resources without interrupting connections
  3. Cost efficiency through usage-based pricing

Aurora Serverless – Use Cases

Demo: Migrating WordPress DB to Aurora Serverless v1

RDS Proxy

Database Proxies – Overview
RDS Proxy – Architecture
Good-Fit Scenarios for RDS Proxy

RDS & Aurora – Summary Table

AWS Relational DB modelArchitecture & AZ coverageStorageScalability & Failover
RDS Single-AZSingle database instance deployed in one Availability ZoneEBS– No support for scaling

AWS Database Migration Service (DMS) & AWS Schema Conversion Tool (SCT)

Database Migrations
AWS Database Migration Service (DMS) – Architecture
AWS Schema Conversion Tool (SCT)
Large Database Migrations with DMS and AWS Snowball

NoSQL Databases & DynamoDB

Amazon DynamoDB (DDB) 101

DDB Concepts
DDB Tables
DDB Backups

On-Demand Backups

Point-in-Time Recovery (PITR)

DynamoDB – Operations, Consistency & Performance

DDB Capacity and R/W Operations
DDB Common Read Operations

DDB Query Operation

DDB Scan Operation

DDB Consistency Model for Read Operations
DDB Performance Calculations (Provisioned Capacity)

DynamoDB Indexes (LSIs and GSIs)

DynamoDB Indexes
Local Secondary Index (LSI)
Global Secondary Index (GSI)

DynamoDB Streams & Triggers

DynamoDB Streams

DynamoDB Triggers

DynamoDB Global Tables

DynamoDB Global Tables

DynamoDB Accelerator (DAX)

Using a Traditional Cache with DynamoDB

DynamoDB Accelerator (DAX) – Overview

DAX Architecture

DAX Features

DynamoDB TTL

DynamoDB Time-to-Live (TTL)

Amazon Athena 101

Amazon Athena – Core Concepts

Athena Architecture

Athena Use Cases

Demo: Querying OpenStreetMap’s Planet OSM with Athena

Objective: Retrieve locations of all veterinary facilities in a specific geographic region.

  1. Determine coordinates of the area using Google Earth
  2. Source data in S3 bucket s3://osm-pds/planet/ contains Planet OSM data:
    • node – individual points with metadata
    • way – boundaries or areas
    • relationship – relationships between nodes/ways
  3. Create an S3 bucket to store query results

Querying in Athena

  1. Create a database:
CREATE DATABASE A4L;
  1. Create a planet table:
CREATE EXTERNAL TABLE planet (
id BIGINT,
type STRING,
tags MAP<STRING,STRING>,
lat DECIMAL(9,7),
lon DECIMAL(10,7),
nds ARRAY<STRUCT<ref: BIGINT>>,
members ARRAY<STRUCT<type: STRING, ref: BIGINT, role: STRING>>,
changeset BIGINT,
timestamp TIMESTAMP,
uid BIGINT,
user STRING,
version BIGINT
)
STORED AS ORCFILE
LOCATION 's3://osm-pds/planet/';
  1. Test query – retrieve 100 rows:
SELECT * FROM planet LIMIT 100;
  1. Query all veterinary amenities in a region (e.g., Brisbane, AUS):
SELECT * FROM planet
WHERE type = 'node'
AND tags['amenity'] IN ('veterinary')
AND lat BETWEEN -27.8 AND -27.3
AND lon BETWEEN 152.2 AND 153.5;

Screenshot of Demo inside Athena:

Amazon ElastiCache

ElastiCache Overview
ElastiCache Architectures

Caching Architecture

Session State Architecture

ElastiCache Engines

Redis vs Memcached Comparison

FeatureRedisMemcached
Data structuresAdvanced (lists, sets, sorted sets, hashes, bit arrays)Simple (strings only)
Multi-AZ / HASupports replication across AZs → regionally resilientNo replication; sharding possible but no regional resilience
BackupsSupportedNot supported
Multi-threadingSingle-threadedMulti-threaded → can leverage multi-core CPUs for higher performance
TransactionsSupported → multiple operations treated atomicallyNot supported

Amazon Redshift 101

Redshift Overview
Redshift Architecture

Redshift Resilience and Recovery