Skip to main content

Command Palette

Search for a command to run...

AWS: Zero To Hero --> part:-01

Updated
β€’12 min read

Basic knowledge of AWS services, storage, security, and AWS CLI, with hands-on experience in creating projects.

πŸ”ΉHistory of Servers

🌐 What are Servers?

A server is a computer system that provides services, resources, or data to other computers (clients) over a network. It can host websites, store files, run applications, manage databases, and more.


πŸ•°οΈ Before (Traditional Servers)

πŸ”§ 1. Physical Servers (On-Premises)

  • Setup: Organizations had to buy, install, and maintain physical hardware.

  • Location: Kept in local server rooms or data centers.

  • Examples: Dell PowerEdge, HP ProLiant servers.

  • Management:

    • Manual installation & configuration.

    • Required dedicated IT staff.

    • Downtime during hardware failure.

🧱 Technologies Used:

FunctionTools/Tech
Operating SystemWindows Server, Linux (CentOS, Ubuntu Server)
VirtualizationVMware, Hyper-V
BackupLocal drives, NAS, tape drives
MonitoringNagios, Zabbix

🧾 Limitations:

  • High cost of hardware and maintenance.

  • Scaling was slow and expensive.

  • Risk of data loss (if no proper backup).

  • Limited by physical space and power.


πŸš€ Now (Modern Servers)

☁️ 1. Cloud Servers

  • Setup: Virtual machines hosted on cloud platforms (no physical hardware needed).

  • Location: Managed by cloud providers like AWS, Azure, GCP.

  • Examples:

    • AWS EC2, Azure VMs, Google Compute Engine
  • Management:

    • Managed via web dashboards or APIs.

    • Auto-scaling, backups, and load balancing available.

βš™οΈ Technologies Used:

FunctionTools/Tech
InfrastructureAWS, Azure, Google Cloud
AutomationTerraform, Ansible
MonitoringCloudWatch, Prometheus
ContainersDocker, Kubernetes
CI/CDJenkins, GitHub Actions

βœ… Benefits:

  • Pay-as-you-go pricing (no upfront hardware cost).

  • Highly scalable and flexible.

  • Automatic backup and recovery.

  • Can be deployed globally within minutes.

  • Better security and compliance tools.


πŸ†š Comparison: Old vs New Servers

FeatureTraditional ServersCloud/Modern Servers
Setup TimeDays to WeeksMinutes
CostHigh upfront costPay-per-use
ScalingManual & slowAuto & fast
Backup & RecoveryManualAutomated
LocationLocal/on-siteAnywhere (Cloud DCs)
MaintenanceManual (needs IT staff)Managed by provider

πŸ”ΉIntroduction to AWS and Cloud Essentials

βœ… 1. What is Cloud and Why do you need it?

Cloud Computing means using remote servers on the internet to store, manage, and process data instead of using your local computer or physical servers.

πŸ”Έ Why you need it:

  • Reduces hardware costs

  • Scalable and flexible

  • Accessible from anywhere

  • Pay only for what you use

πŸ’‘ Example: Instead of buying a personal hard drive, you use Google Drive or AWS S3 to store your files.


βœ… 2. How does Cloud work?

Cloud works through a network of data centers located worldwide. You interact with these using:

  • Web interfaces (like AWS Console)

  • APIs

  • CLI/SDKs

πŸ”Ή These data centers provide:

  • Virtual servers (EC2)

  • Databases (RDS, DynamoDB)

  • Storage (S3)

  • And more, on-demand

🟒 You just select what you need, configure it, and it's ready in minutes.


βœ… 3. Why AWS?

AWS (Amazon Web Services) is the most used cloud platform in the world because:

  • Largest cloud market share (~30%)

  • Offers 200+ services

  • Reliable, secure, and scalable

  • Free Tier for learning

  • Strong global support and certifications


βœ… 4. Terminologies like IaaS, PaaS, SaaS

These are cloud service models that define how much control you have:

ModelWhat You ManageExample
IaaS (Infrastructure as a Service)Full control over OS, storage, VMAWS EC2
PaaS (Platform as a Service)Just deploy code, platform managed by providerAWS Elastic Beanstalk
SaaS (Software as a Service)Only use the applicationGmail, Google Docs, Zoom

βœ… 5. What Services to Learn and Get Started?

Start with core AWS services:

AreaAWS ServicePurpose
ComputeEC2, LambdaRun apps or serverless code
StorageS3Store files or backups
DatabaseRDS, DynamoDBSQL & NoSQL database services
NetworkingVPCSecure and isolate your apps
IAMIdentity and Access ManagementManage users and permissions
MonitoringCloudWatchMonitor logs and usage

πŸ’‘ Tip: Use AWS Free Tier to practice these services hands-on.

🌍 AWS Global Infrastructure

πŸ”Ή What is it?

AWS (Amazon Web Services) Global Infrastructure refers to the worldwide network of data centers and resources that power AWS services. It ensures high availability, performance, and fault tolerance for users around the globe.


🧱 Key Components

1. Regions

  • A Region is a geographic location (like Mumbai, London, Ohio) that contains multiple data centers.

  • Each region is isolated to ensure data sovereignty and fault tolerance.

  • βœ… As of 2025, AWS has 30+ regions worldwide.

Example: Asia Pacific (Mumbai) is one AWS region.


2. Availability Zones (AZs)

  • Each Region contains 2 to 6 Availability Zones.

  • An AZ is essentially a data center with independent power, networking, and cooling.

  • AZs are connected with low-latency links to form a reliable region-wide system.

  • Using multiple AZs = high fault tolerance and uptime.


3. Edge Locations

  • Edge locations are used for content delivery (CDN) via Amazon CloudFront.

  • Located in over 400+ cities globally.

  • They cache content closer to users for faster load times and reduced latency.


4. Local Zones

  • Extension of AWS Regions that brings services closer to end-users in metro areas.

  • Low-latency performance for apps like gaming, video editing, and ML.


5. Wavelength Zones

  • Used to bring AWS services closer to 5G networks, ideal for mobile apps needing ultra-low latency.

πŸ“Œ AWS Infrastructure Hierarchy Diagram

Global
 └── Regions (e.g., Mumbai)
       └── Availability Zones (e.g., ap-south-1a, ap-south-1b)
             └── Data Centers
 └── Edge Locations
 └── Local Zones
 └── Wavelength Zones

βœ… Benefits of AWS Global Infrastructure

FeatureBenefit
Global ReachServe users anywhere in the world
High AvailabilityUse multiple AZs to prevent downtime
ScalabilityEasily scale apps and services
SecurityBuilt-in physical & network security
Low LatencyEdge and Local Zones ensure faster response times

πŸš€ 3 Best Ways to Access AWS

1. πŸ–₯️ Console

  • What it is:
    The AWS Management Console is a web-based user interface.

  • Use case:
    Beginners and non-developers often use this to manually create/manage services like EC2, S3, Lambda, etc.

  • Advantage:
    No coding knowledge needed – just click and configure.


2. πŸ’» CLI (Command Line Interface)

  • What it is:
    A tool to interact with AWS using commands in a terminal (e.g., Bash, CMD, PowerShell).

  • Use case:
    Useful for DevOps tasks, automation, and scripting (e.g., aws s3 ls).

  • Advantage:
    Faster and more efficient than the console for repetitive or bulk operations.


3. πŸ§‘β€πŸ’» SDK (Software Development Kit)

  • What it is:
    A set of libraries for programming languages (like Python, Java, etc.) to integrate AWS into your application code.

  • Example in image: Python SDK = Boto3

  • Use case:
    Developers use SDKs to programmatically create/manage AWS resources within their apps.

  • Advantage:
    Deep integration with your application logic.

πŸš€ Mastering IAM (Identity and Access Management)

πŸ”° 1. Introduction to IAM

What is IAM?
IAM (Identity and Access Management) is a service in AWS that lets you securely manage access to AWS services and resources. It allows you to create users, groups, and roles and define permissions using policies.

Why is IAM important in AWS?

  • Prevents unauthorized access

  • Enables fine-grained control over who can access what

  • Essential for managing access in multi-user environments

  • Supports compliance and auditing


πŸ‘€ 2. Creating IAM Users

Steps to create a new IAM user:

  1. Go to AWS Console > IAM

  2. Select β€œUsers” > β€œAdd user”

  3. Enter username

  4. Select access type (console access, programmatic access)

  5. Attach permissions (direct or via group)

  6. Review & create

Access Types: Console vs Programmatic:

  • Console access: Allows user to log in via AWS Management Console (GUI)

  • Programmatic access: Allows use of AWS CLI/SDK for scripting and development

Best Practices for User Creation:

  • Avoid giving full access unless necessary

  • Use groups to manage permissions

  • Assign unique usernames

  • Enable MFA (Multi-Factor Authentication)


🧩 3. IAM Policies & Permissions

What are policies?
Policies are JSON documents that define permissions. They control what actions are allowed or denied on which AWS resources.

Managed vs Inline policies:

  • Managed Policies: Predefined by AWS or created and reused across users, groups, roles.

  • Inline Policies: Embedded directly into a single user, group, or role. Used for specific one-off permissions.

Attaching Policies:

  • Attach to Users (if individual permission is needed)

  • Attach to Groups (for centralized permission control)

  • Attach to Roles (for temporary access by services or users)

Examples:

  • AmazonS3FullAccess β€” grants full access to S3

  • AdministratorAccess β€” full AWS access (use with caution)


πŸ§‘β€πŸ€β€πŸ§‘ 4. IAM Groups

Why use groups?

  • Easier permission management

  • Reduces errors and redundancy

  • Apply policies to multiple users at once

How to Create & Use:

  1. Create group (e.g., "DevOpsTeam")

  2. Attach policies to group

  3. Add users to the group


πŸ§™ 5. IAM Roles

What is an IAM Role?
A role is a temporary set of permissions that AWS services or users can assume to perform actions. Roles are not tied to specific users.

Example:- "Instead of giving the developer direct access to the RDS database, we attach a role to the EC2 instance (such as a DB access role). This allows the EC2 instance to securely access the RDS database without exposing credentials or giving direct access to the developer."

also give this for other aws account

Role vs User:

FeatureIAM UserIAM Role
PermanentYesNo (temporary)
LoginYesNo (usually assumed)
Use caseReal peopleServices or external users

Creating and Assigning Roles:

  1. Go to IAM > Roles

  2. Choose use case (e.g., EC2)

  3. Attach policy (e.g., S3 read-only)

  4. Assign to resource (e.g., EC2 instance)


🌐 6. Identity Providers (IdP) in IAM

🌍 What is an Identity Provider?

An IdP (Identity Provider) is a trusted external service that authenticates users and lets them access AWS resources without IAM user creation.

πŸ”‘ Use Case:

  • Single Sign-On (SSO) via Google, Facebook, Active Directory, etc.

  • Federated users from corporate systems or web identity services

πŸ“Œ Types of Identity Providers in AWS:

TypeDescriptionExample
SAML 2.0-basedUsed for enterprise/corporate federationMicrosoft AD, Okta
OIDC-basedWeb/app identity federationGoogle, Auth0
CognitoAWS-managed IdP for apps & usersSign up/Login portals

🧾 How it Works:

  1. Authenticate via IdP (e.g., Google)

  2. IdP issues token/assertion

  3. AWS STS (Security Token Service) validates it

  4. Temporary AWS credentials are granted via a role

πŸ” 7. IAM Best Practices

βœ… Enable MFA (Multi-Factor Authentication)
MFA adds an extra layer of security by requiring a one-time code from a registered device/app after entering a password.


πŸ“² MFA Device Options:

MFA TypeDescriptionExample
Virtual MFA DeviceMost common; uses a mobile appGoogle Authenticator, Authy
U2F Security KeyPhysical USB key for MFAYubiKey, Titan Security Key
Hardware MFA DeviceDedicated physical token (from AWS)Gemalto token, etc.

Steps to Enable MFA:

  1. Go to IAM > Users > [username]

  2. Click β€œSecurity credentials” tab

  3. Choose β€œAssign MFA device”

  4. Select Virtual MFA (recommended)

  5. Scan the QR code using Google Authenticator or similar

  6. Enter two consecutive codes

  7. Confirm and save

πŸ” 8. IAM Best Practices

  • βœ… Enable MFA: For all users, especially the root user

  • βœ… Use least privilege: Only give permissions that are absolutely required

  • ❌ Don’t use the root user for everyday tasks

  • πŸ”„ Rotate access keys periodically

  • πŸ‘οΈ Monitor IAM activity using AWS CloudTrail


Project: - IAM Role-Based Access for EC2 to Access S3 via CLI (Not Console)


πŸ§‘β€πŸ’» 1. User β†’ EC2 Access Flow

  • A developer/user uses their local system (laptop or desktop) to interact with AWS EC2.

  • EC2 is an instance (a virtual server in the cloud).


🧠 2. IAM Role Integration

  • Instead of using static credentials (username/password or access keys), an IAM Role is attached to the EC2 instance.

  • This IAM Role contains permissions to access S3 (Simple Storage Service).


πŸ—‚οΈ 3. S3 Data Access

  • The EC2 instance (with the IAM Role) can securely read/write data in S3 buckets.

  • This method ensures no credentials are exposed.


πŸ›‘ 4. Restricted Console Access

  • The user cannot access S3 from the AWS Console.

  • Console access is blocked or not granted to follow principle of least privilege.


πŸ’» 5. Access Only via CLI

  • The user is allowed to access S3 data using AWS CLI from the EC2 instance only.

  • Other access methods like:

    • Console ❌

    • SQL or direct S3 GUI ❌
      are disabled or not allowed.

then create a new key pair if you want

now instance is completed.

Now we will create IAM user

then create user

we will give it to s3 and ec2 full access permission

now we take a s3 bucket . and in it store something

now create bucket

ACL:- Access control list

Now lets upload something in this

also we create a folder in this

we create EC2, IAM user, S3 bucket. all done

now we access it through CLI. Not a console

so for it,follow below steps

step:1 :-first we require a access key/token

in this go to security credential. and in this create a token

create access key.

Now we connect our EC2 instance

copy it and paste it into your terminal

step:2 :- now install AWS CLI Version 2 on ubuntu

link:- https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

Here we install for a linux.

before install AWS CLI we install unzip.

here we are completely installed CLI V2

Here you only Access s3 and EC2. becaus we have not give any permission .