📦 Amazon S3 – Key Components:
1. S3 Bucket:
A bucket is a container for storing objects in Amazon S3. Each bucket name must be globally
unique and is tied to a specific AWS region. You can configure access, encryption, and lifecycle
settings at the bucket level.
2. Object:
An object is the actual data stored inside a bucket, such as files, images, or backups. It consists of
the data, key (name), and metadata. Objects are referenced using a combination of the bucket
name and key.
3. Storage Classes:
S3 supports various classes like Standard, Intelligent-Tiering, Infrequent Access, Glacier, and
Deep Archive. These help optimize cost based on access frequency and data retrieval needs. Data
can be moved between classes using lifecycle rules.
4. Versioning:
S3 versioning allows you to keep multiple versions of an object in the same bucket. It helps
restore deleted or overwritten files by retrieving older versions. You must enable it at the bucket
level.
5. Permissions:
Access control in S3 is managed using Bucket Policies, IAM Policies, and ACLs. Bucket
Policies are attached to the bucket, while IAM Policies are user-based. ACLs are legacy and not
preferred for fine-grained control.
6. Encryption:
S3 supports SSE-S3 (default), SSE-KMS (user-managed keys), and SSE-C (customer-provided
keys) for server-side encryption. You can also use client-side encryption before uploading.
Encryption helps protect sensitive data at rest.
7. Pre-Signed URLs:
These URLs grant temporary access to private objects without making them public. You define
the expiration time and permissions. Pre-signed URLs are useful for secure sharing or controlled
uploads.
8. Lifecycle Policies:
They automate transitions between storage classes or schedule deletions. For example, move logs
to Glacier after 30 days and delete them after 90. Lifecycle policies help reduce storage costs.
9. Static Website Hosting:
S3 can serve static websites (HTML, CSS, JS) directly from a bucket. You must enable website
hosting and make objects public. Set an index and error document to complete the configuration.
10. Replication:
S3 supports cross-region (CRR) and same-region (SRR) replication for backup or compliance.
You must enable versioning for replication. It ensures data redundancy and disaster recovery.
11. Amazon S3 Event Notifications
S3 Event Notifications let you automatically trigger actions when specific events occur in your
S3 bucket—like when an object is created, deleted, or updated. These events can invoke AWS
Lambda, send messages to Amazon SNS topics, or push to SQS queues. You can filter events
by prefix (folder) or suffix (file type) for fine-grained control. This is ideal for use cases like
image processing, log analysis, or triggering downstream workflows in real-time.
12. Amazon S3 Object Lock
S3 Object Lock protects objects from being deleted or overwritten for a specified time, ensuring
compliance and data integrity. It supports two modes: Governance (can be bypassed with
special permissions) and Compliance (cannot be changed by anyone). This is commonly used
for legal holds, financial records, and ransomware protection. Object Lock must be enabled
at the bucket level when creating the bucket.
13. Amazon S3 Multi-Region Access Points
S3 Multi-Region Access Points let you create a global endpoint that routes requests to the
nearest AWS Region where your data is replicated. This improves performance and
availability for globally distributed applications by reducing latency and automatically routing
around failures. You can use it with S3 Cross-Region Replication to sync data between buckets.
It’s ideal for content delivery, backup, and disaster recovery across regions.
14. Amazon S3 Transfer Acceleration
S3 Transfer Acceleration speeds up uploads and downloads by routing traffic through Amazon
CloudFront edge locations. Instead of sending data directly to an S3 bucket, it first goes to the
nearest edge location and then over Amazon’s high-speed internal network to the bucket. This
greatly reduces latency for global users, especially those far from the target AWS region. It must
be enabled on the bucket and comes with additional cost.
15. Amazon S3 Select
S3 Select allows you to query and retrieve only a subset of data from within an object (like a
CSV, JSON, or Apache Parquet file) using simple SQL expressions. Instead of downloading the
entire file, it returns just the needed rows or columns, reducing data transfer and processing time.
It’s ideal for analytics workloads or filtering large datasets stored in S3. This feature is available
via SDK, CLI, and REST API.
🖥️ Amazon EC2, EBS, and EFS – Key Components
🖥️ Amazon EC2 (Elastic Compute Cloud)
1. EC2 Instance:
An EC2 instance is a virtual server in the AWS cloud. You can choose instance types based on
CPU, memory, storage, and network needs. It supports OS-level control for running apps,
services, and databases.
2. AMI (Amazon Machine Image):
AMI is a template that contains a preconfigured OS, app server, and software packages. You use
it to launch new EC2 instances. You can create custom AMIs for repeatable setups.
3. Instance Type:
Instance types (e.g., [Link], [Link]) define compute, memory, and storage capacity. They're
categorized into families like general purpose, compute optimized, and memory optimized.
Choosing the right type affects performance and cost.
4. Security Groups:
Security groups act like virtual firewalls for EC2, controlling inbound and outbound traffic.
Rules are stateful and defined using protocols, ports, and IP ranges. They are attached at the
instance level.
5. Elastic IP:
Elastic IPs are static IPv4 addresses that you can associate with EC2 instances. They persist
across reboots and can be reassigned. Useful for consistent DNS mapping and failover setups.
6. EC2 User Data
EC2 User Data allows you to run custom scripts or commands when an instance launches for
the first time. It’s commonly used to install software, update packages, configure applications, or
run bootstrap tasks. You can provide User Data in the form of shell scripts (Linux) or
PowerShell (Windows), and it runs only during the initial boot unless explicitly configured
otherwise
7. AMI Backup
An Amazon Machine Image (AMI) is a snapshot of an EC2 instance that includes its OS,
configuration, software, and attached volumes. You can create an AMI from a running or
stopped EC2 instance to back it up and launch identical instances later. This is commonly used
for versioned application deployments, rollbacks, and disaster recovery.
💽 Amazon EBS (Elastic Block Store)
1. EBS Volume:
EBS provides persistent block storage for EC2 instances. Volumes are automatically replicated
in the same AZ to protect against failures. They're ideal for databases and file systems.
2. EBS Snapshot:
Snapshots are point-in-time backups of EBS volumes stored in S3. You can restore from them or
create new volumes. Snapshots support incremental backups and cross-region copy.
3. Volume Types:
EBS offers multiple volume types: gp3 (general purpose SSD), io2 (high-performance SSD), st1
(HDD throughput optimized), and sc1 (HDD cold). Each type is optimized for different
workloads.
gp3 provides up to 16,000 IOPS and 1,000 MB/s, ideal for general-purpose applications with
cost efficiency. io2 delivers up to 256,000 IOPS and 4,000 MB/s, suited for high-performance
databases and latency-sensitive workloads. For large, sequential access needs, st1 gives 500
MB/s throughput, while sc1 offers 250 MB/s for cold data archives with the lowest cost.
4. Encryption:
EBS supports encryption at rest using AWS KMS. Encrypted volumes and snapshots are
protected automatically. Encryption ensures data confidentiality and compliance.
5. EBS Volume Backup (Snapshots)
Amazon EBS backups are created using snapshots, which are point-in-time copies of your EBS
volumes stored in S3. Snapshots are incremental, meaning only the changed blocks are saved
after the first full backup, reducing cost and time. These snapshots can be restored anytime to
create new volumes in the same or different region.
6. EBS Fast Snapshot Restore (FSR)
EBS Fast Snapshot Restore allows you to instantly use EBS volumes restored from snapshots
without waiting for full data initialization. Normally, volumes created from snapshots show
sluggish performance initially due to lazy loading, but FSR removes this delay. You enable FSR
per Availability Zone, and it incurs extra cost. It’s ideal for rapid scale-out scenarios like
disaster recovery or auto-scaling fleets.
7. EBS Multi-Attach
EBS Multi-Attach enables a single io1 or io2 volume to be attached to multiple EC2 instances
simultaneously within the same AZ. This allows for shared read/write access, commonly used
in clustered or HA applications (e.g., Oracle RAC). It requires the application to handle
concurrent access safely. Not all volume types support this, and it must be explicitly enabled at
volume creation.
8. EBS Volume Attachments
An EBS volume can be attached to a running or stopped EC2 instance as a block device,
usually for persistent data storage. It supports hot attach/detach for Linux and most modern
OSs, meaning you don’t have to reboot the instance. Each volume can be attached to one
instance at a time (except when using Multi-Attach), and appears as /dev/xvdf, /dev/sdf, etc.,
inside the instance.
6. Resize an Existing EBS Volume (Increase Size)
✅ Step-by-step:
1. Go to EC2 Console → Volumes → Select your EBS volume.
2. Click Actions → Modify Volume.
3. Increase the size (in GiB) → Click Modify → Yes to confirm.
4. Now connect to your EC2 instance and run:
lsblk # To verify volume is attached
sudo growpart /dev/xvda 1 # For root disk, grow partition
sudo resize2fs /dev/xvda1 # For ext4 filesystem
7. Add a New EBS Volume to EC2
✅ Step-by-step:
1. Go to EC2 Console → Volumes → Click Create Volume.
2. Choose the size, type, and same Availability Zone as your instance.
3. Once created, select the volume → Actions → Attach Volume → Choose the instance
and device name (e.g., /dev/xvdf).
4. On your EC2 instance, format and mount the volume:
sudo mkfs -t ext4 /dev/xvdf # Format the new disk
sudo mkdir /mnt/newdisk # Create a mount point
sudo mount /dev/xvdf /mnt/newdisk # Mount the volume
📁 Amazon EFS (Elastic File System)
1. EFS File System:
EFS is a fully managed NFS file system that scales automatically. It can be mounted to multiple
EC2 instances across AZs. It’s suitable for shared file storage in Linux environments.
2. Performance Modes:
EFS has two performance modes: General Purpose (default) and Max I/O. General Purpose is for
latency-sensitive workloads, while Max I/O is for high-throughput needs. Choose based on app
performance requirements.
3. Lifecycle Management:
EFS lifecycle policies automatically move infrequently accessed files to an infrequent access
storage class. This helps reduce costs without affecting performance for frequently accessed data.
4. Access Points:
EFS Access Points simplify managing application access. They create application-specific entry
points with custom user/group permissions. Useful for multi-tenant environments and container
workloads.
5. EFS Backup
Amazon EFS supports automatic and manual backups through AWS Backup, allowing you to
create point-in-time backups of your file system data. Backups are stored in a durable, encrypted
vault, and you can schedule them using backup plans. This ensures data protection and
compliance for shared file systems. Recovery is simple—you can restore to a new file system in
minutes.
6. EFS Mount Targets
EFS uses mount targets to provide network access to the file system within a VPC. Each mount
target is created in a specific subnet and is tied to an Availability Zone, enabling multi-AZ
access. EC2 instances connect using NFS to the mount target, and for HA, you should create one
mount target per AZ where your instances run.
7. Encryption in Transit (EFS)
Amazon EFS supports encryption in transit using TLS, ensuring data is securely transferred
between clients and the file system. When enabled, it protects against man-in-the-middle attacks
during network transmission. Clients must use the amazon-efs-utils package or stunnel to
mount the file system securely. This complements encryption at rest, which is enabled by
default in EFS.
📦 S3 Scenarios (15 Questions)
1. You need to securely share a private S3 object with a third-party user for 15 minutes.
What would you use?
2. Your S3 bucket is experiencing unexpected public access. How will you identify and fix
this?
3. A file in S3 was accidentally overwritten. How can you recover the original?
4. How do you reduce storage cost for logs that are 30 days old and rarely accessed?
5. Your analytics team wants to filter 2 rows out of a 5GB CSV file stored in S3. What's the
most efficient method?
6. A static website hosted on S3 isn't loading properly. What steps would you take to
troubleshoot it?
7. You want to replicate objects to another AWS region for DR. What configurations are
needed?
8. An uploaded object must trigger a Lambda function for image processing. How do you
configure this?
9. You need to protect certain S3 objects from being deleted for 7 years due to compliance.
What feature will you use?
10. Your users across the globe experience slow S3 uploads. How can you optimize this?
11. You want a global endpoint that routes requests to the closest S3 region automatically.
How do you achieve this?
12. How would you make sure that S3 objects are encrypted using customer-managed keys?
13. You want to restrict access to an S3 bucket only from a specific VPC. How will you
enforce this?
14. You want to delete old versions of files in a version-enabled bucket to save cost. How
can you automate this?
15. Users must be able to query only specific columns of a large JSON file in S3. What
solution would you choose?
🖥️ EC2 Scenarios (10 Questions)
16. You want to automatically install Apache and start the service when a new EC2 launches.
What will you use?
17. Your EC2 root disk is running out of space. How do you resize the attached volume
without downtime?
18. You need to launch 10 EC2 instances with identical configuration and software. What’s
the best approach?
19. You want to assign a consistent public IP to an EC2 instance, even after reboot. What
AWS feature will you use?
20. You need to allow only SSH and HTTP traffic to your EC2 instance. What configuration
is required?
21. Your EC2 instance is not receiving traffic despite being healthy. What networking or
security misconfigurations might cause this?
22. You want to backup an EC2 instance before applying system changes. What is the
simplest method?
23. A user launches an EC2 instance but forgot to add a key pair. How can they recover
access?
24. How do you configure multiple EC2 instances in a private subnet to share a file system?
25. You need to attach and mount a new volume to an EC2 instance. What steps do you
follow?
💽 EBS Scenarios (10 Questions)
26. You want to back up an EBS volume regularly. How would you automate it?
27. You restored a volume from a snapshot, but it is performing slowly at first. What feature
helps avoid this?
28. How do you share a single io2 EBS volume between two EC2 instances running a
clustered database?
29. You want to move EBS snapshots to another region for DR purposes. How do you do
this?
30. Your EBS volume is encrypted, and you want to ensure all backups maintain encryption.
What should you verify?
31. A volume was resized in the console. What steps are required on the instance to use the
full space?
32. You want to tag volumes automatically at creation for billing visibility. How would you
enforce this?
33. Your application demands 100,000+ IOPS for a volume. What volume type and EC2
instance will support it?
34. How do you enable near-instant restore for volumes used in Auto Scaling?
35. A developer needs temporary storage for high-speed processing, but cost must be low.
Which EBS type will you recommend?
📁 EFS Scenarios (5 Questions)
36. You want multiple EC2 instances across different AZs to share a file system. What AWS
service fits best?
37. How do you mount an EFS file system securely using encryption in transit?
38. Your application generates large inactive files. How can you optimize EFS storage costs?
39. A multi-tenant application needs isolated file access per user. What EFS feature will
help?
40. You want to schedule nightly backups of your EFS file system. How would you do it?