AWSforbeginnersv2 Compressed
AWSforbeginnersv2 Compressed
Eissa Abousherif
DolfinED Founder and Lead Content Architect
Best Selling Instructor (120,000+ students, 180+ Countries)
Author of the highest rated AWS Content
Cloud Infrastructure Architect & AWS Certified Architect
Getting Organized
• Basic IT knowledge
• Laptop and Internet connectivity
• IT and TCP/IP fundamentals course on DolfinED.com
https://www.dolfined.com/courses/ITF-Cloud-DevOps-TCPIP-fundamentals
In Traditional IT, the servers and applications are hosted in client specific, purpose-
designed IT data centers (Separate physical locations or On-Premises).
• A data center is a considerable space size that is air conditioned, secured, and
manned to ensure continuous operations.
Rack-Mountable Servers
Racks are physically secured Mounted and cabled inside DC Racks
(locked and monitored)
CAPEX App
Model Data
Runtime
Middleware
Operating
System
Virtualization
Hardware
Storage
Network
Customer is 100% responsible for it : Design, Cost, Build, Operations, Optimization, Upgrades, Security…etc
A Data Center
+ =
Automation/Orchestration
A Cloud
OPEX
Model
2021 2022
Microsoft Azure and Google’s GCP are catching up. Azure is narrowing the gap to AWS
Hybrid Cloud:
Is a mix of public and on-
premises private cloud that
is orchestrated to run as
a single task.
Hybrid Multi-Cloud:
Deployment, Automation, and Orchestration
Multi Cloud:
Is the use of multiple cloud
computing and storage
services in a single
heterogeneous architecture.
App
Customer
Managed
Data
Runtime
Middleware
Operating
System
Virtualization
Hardware
Storage
Provider
Network Managed
Software as a Service (SaaS) Platform as a Service (PaaS) Infrastructure as a Service (IaaS) On-Premises
https://aws.amazon.com/about-aws/global-infrastructure/
• IAM helps create and manage identities, authentication, and authorization for AWS
account(s).
• An AWS account trusts IAM and its decisions for authentication and authorization.
• We can maintain Identity information logs for audits and compliance purposes.
• IAM is PCI DSS (Payment Card Industry Data Security Standard) compliant.
• IAM is integrated with many AWS services.
• IAM is eventually consistent.
• IAM is free to use.
• We can provide temporary access using AWS STS.
• IAM Identities are what we create to represent the entity that uses AWS resources.
• IAM Users, IAM User Groups, or IAM Role are IAM identities in AWS.
• Any identity that needs to use AWS resources must be authenticated and then
authorized to carry out the intended actions.
• One or more policies can be attached to an identity to define what permissions are
allowed for the identity, on which resources, and under what conditions.
• For any user, we can assign a username and password and/or access key ID (Access key
and Secret Access key).
• Use MFA with the root user and any other privileged users in your account.
• Lock away your AWS account root user console access credentials and lock away or
delete its access keys (an access key ID and secret access key).
• Create individual IAM users.
• Use AWS defined/managed policies to assign permissions whenever possible (AWS
ready policies).
• Use Groups to assign permissions to IAM users.
• Grant least privilege (AWS least privilege principle).
• Configure a strong password policy for users.
• Enable MFA for the root user and any privileged users.
The power of a number says how many times to use the number in a multiplication.
2
10 ^ 2 means 10 which also means 10 x 10
Exponent
2
10 10 x 10 100
Base
Any number ^ 0 = 1
© DolfinED All right reserved
Decimal Numbering System
• The base is 10
• We call each number a digit in decimal. Integer : 204
• Digits can have one of 10 values (0 to 9).
Decimal 204 can
• We have units, tens, hundreds..etc be represented as
Or in an exponent format
Computer systems and digital system all use binary numbering internally.
• Binary numbering is based on two values 0 and 1.
• When we use decimal numbering in our applications, it is transferred
internally to in computer systems to binary.
• We call each number a binary digit (bit) in binary.
x 128 x 64 x 32 x 16 x8 x4 x2 x1
7 6 5 4 3 0
Bit position in the octet (N) 2 (3rd ) 1 (2nd)
(8th - left) (7th ) (6th) (5th ) (4th ) (1st)
Binary: 00001100
0 0 0 0 8 0 0 0
Binary: 00001100
0 0 0 0 8 4 0 0
Binary: 11001100
128 64 0 0 8 4 0 0
7 6 5 4 3 0
Bit position in the octet (N) 2 (3rd ) 1 (2nd)
(8th - left) (7th ) (6th) (5th ) (4th ) (1st)
Decimal equivalent if
128 64 32 16 8 4 2 1
Binary Digit = 1
Decimal equivalent if
0 0 0 0 0 0 0 0
Binary Digit = 0
7 6 5 4 3 0
Bit position in the octet (N) 2 (3rd ) 1 (2nd)
(8th - left) (7th ) (6th) (5th ) (4th ) (1st)
Decimal equivalent if
128 64 32 16 8 4 2 1
Binary Digit = 1
Decimal equivalent if
0 0 0 0 0 0 0 0
Binary Digit = 0
IPv4 IPv6
Decimal Notation Hexadecimal notation (0-9 & A-F)
• 32 bits long • 128 bits long
• 4 bytes or octets (each is 8 bits) • 8 fields each up to 16 bits (2 Octets)
• Example: 120.130.233.12 • Example:
• Requires a subnet mask 2001:0db8:85a3:0000:0000:8a2e:0370:7334
• Can have Public or Private ranges • Requires a subnet mask
• All public
120.11.12.13 201.103.1.2
IP Routing
192.168.240.1/24
192.168.240 .1 /24
Network Part Host Subnet Mask Length
Binary equivalent : 1100 0000 . 1010 1000 . 1111 0000 . 0000 0001
CIDR Range
Classless Inter Domain Routing
Examples 192.168.1.0/24
• 10.0.0.0/8,
• 192.168.1.0/24,
• 120.100.0.0/16
10.0.0.0/9
Subnets
Any CIDR can be broken down to a smaller 10.0.0.0/8
chunks called Subnets (Subnetting).
10.128.0.0/9
CIDR : 192.168.240.0/24
IP Address Range 0 - 255
192.168.240.0/24
1100 0000 . 1010 1000 . 1111 0000 . 00 00 0000
IP Range 0 - 255
Subnet
1100 0000 . 1010 1000 . 1111 0000 . 00 00 0000
192.168.240.0
Subnet
1100 0000 . 1010 1000 . 1111 0000 . 01 00 0000
Subnet Mask 192.168.240.64
/26
Subnet
192.168.240.128 1100 0000 . 1010 1000 . 1111 0000 . 10 00 0000
Subnet
192.168.240.192 1100 0000 . 1010 1000 . 1111 0000 . 11 00 0000
192.168.240.0/24
IP Range 0 - 255
Subnet Mask Desired Bits to be No. of subnets Updated Subnet Host field No. of possible No. of useable
Length Subnets borrowed can z bits Mask length for Length hosts in the IP addresses
n i z represent each of the subnets k = 32-(n+z) network (m) (m-2)
/24 Up to 2 1 2 /25 7 128 126
/24 Up to 4 2 4 /26 6 64 62
/24 Up to 8 3 8 /27 5 32 30
/24 Up to 16 4 16 /28 4 16 14
/24 Up to 32 5 32 /29 3 8 6
/24 Up to 64 6 64 /30 2 4 2
Private IP addresses
Are meant for use within/inside the enterprise networks
• They can not be used on the internet, and they can’t be reached from the Internet
directly
10.0.0.0/8, 172.16.0.0/12 , and 192.168.0.0/16 are Private ranges that can be used
freely within private networks.
• They are defined in RFC1918 and are supported in AWS.
172.16.0.0/12 Range
CIDR 172.16.0.0/16
Subnet 1 172.16.1.0/24
Subnet 2 172.16.2.0/24
Subnet 3 172.16.3.0/24
Dubai
Router Router
UK
• Your home WiFi device has WLAN, Switch, and Router functionalities
• When two devices on the same subnet or IP network need to communicate, they do not
need to consult the routers (example printing on a WiFi-connected printer at home)
Internet
Routers
• Each router builds a routing table (database) of known destinations and how to reach them
• Routing tables can be configured statically (manually) – Static IP routing
• Routing tables can also be configured dynamically – Dynamic IP routing
Ø Requires using Dynamic routing protocols (OSPF, BGP are examples)
• The VPC’s main CIDR Block cannot be changed after it has been created.
• We can expand the VPC address pool by adding up to 4 additional secondary CIDR blocks.
Limitations can be found here:
https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html#vpc-cidr-
blocks
• The implied router is used to communicate among the subnets in a VPC and between the
VPC and the outside world (inside/outside of AWS).
• We cannot access or login to the implied router’s configuration, it is fully managed by AWS
• Routing among VPC subnets is guaranteed by default.
• Each VPC has a default route table, the main route table.
• A subnet can attach to one route table at a time.
• A route table can be used by more than one subnet at the same time.
• We can create custom route tables as required.
• Routing among VPC subnets is guaranteed by default.
Public or Internet Routable IP ranges are those assigned by internet registries and can
be used on the public Internet.
• You can not use these IP addresses on the Internet deliberately
• They get assigned based on approved requests to clients.
Private IP addresses
• For use within/inside the enterprise networks.
• They can not be used on the internet (They are filter out by all Internet routers),
and they can’t be reached from the Internet directly.
RFC1918 IP Ranges:
10.0.0.0/8, 172.16.0.0/12 , and 192.168.0.0/16 are Private IP address ranges that can
be used freely. and are supported in AWS.
Physical
Server
Examples: Hypervisors
• VMware Workstation
• Oracle VM VirtualBox Windows OS
Hardware
• Each instance is created with a virtual network interface called the Elastic Network
Interface or ENI.
• EBS volumes are persistent storage devices; their data does not get deleted unless the
volume is terminated/deleted.
• EC2 instances with EBS root volumes are called EBS-backed EC2 instances.
• EC2 Instances attach to their EBS volumes over the AWS network.
We can SSH into the EC2 instance from within the management console using EC2 Instance
Connect.
• The Instance must have a public IP address
• Have Linux 2 AMI 2.0.20190618 or later
• Or Install the EC2 connect package for earlier versions.
• We need to ensure the user(s) that will use this feature have the IAM permissions to do so.
• The instance’s security group must allow SSH inbound from AWS public IP address ranges.
SSH
More on this here:
https://docs.aws.amazon.com/AWSEC2/latest/
UserGuide/ec2-instance-connect-set-up.html
For students with Windows PCs, we can SSH using the SSH service
(Windows 10) or the Putty SSH client.
Windows Client
NAT
Whitelisting/Allowlisting Blacklisting/Blocklisting
Start with everything blocked. Start with everything allowed.
• Add permit rules as • Add deny rules as required.
required. • Example: internet web
• Example: corporate applications or web sites.
confidential information.
Other fields
TTL Protocol Checksum
Source IP Address
Destination IP Address
Other fields
Source Port Destination Port
Other Fields
Payload / Data
Source and Destination ports in a TCP/IP packet are like apartment numbers when the
sender and received of a mail reside in residential buildings.
OUTBOUND
INBOUND
security security
group group
• You can use the security group name Instance A Instance B Instance C
SSH
Instance D Instance E
Security Group 2
Security Groups
Use ICMP Ping to test reachability to the public IP address of the EC2 instance.
• Understand the source and destination IP ranges in the inbound and outbound directions.
• Demonstrate that security groups can only have allow rules.
• Demonstrate that the source / destination of the security group can be a security group ID.
VPC
VPC
Inbound means:
Traffic heading from outside the Route
subnet to inside the subnet. Implied Table
Router
Outbound means:
Traffic heading from within the subnet
to outside the subnet. Inbound Outbound
VPC
Operates at the Instance (ENI) level as the first Operates at the subnet level as a second layer of
layer of defense (from EC2 instance perspective) defense (from EC2 instance perspective)
Applies only to instances where the security Applies to all instances in the subnet(s) where
group is associated/applied the NACL is applied
Use ICMP Ping to test reachability to the public IP address of the EC2 instance.
• Understand the source and destination IP ranges in the inbound and outbound directions.
• Demonstrate that NACLs can have allow or deny rules.
• Demonstrate that the source / destination of the NACLs cannot be a security group ID.
Encryption
Decryption
!$5Wa&^ Hello
Hello @#$@$ World
World WER$@
Encrypted Data
Key Key
• Encryption in-transit
involves a key pair, a private
key and a public key.
• It requires a key generator to
create the key pair.
• The key pair owner holds the
private key and shares the
public key with clients.
• HTTPS/TLS/SSL are the most common protocols used to encrypt data in-transit.
• HTTPS/TLS/SSL are NOT used to encrypt data at rest.
KMS is an AWS managed Key Management Service that allows customers to create and
manage cryptographic keys.
• KMS controls the keys’ usage across a range of AWS services and applications.
• KMS is Federal Information Processing Standard - FIPS-140-2 compliant.
• KMS integrates with many AWS services to simplify encryption of data across
workloads.
• KMS is highly durable and highly available.
• KMS integrates with CloudTrail for audit and compliance purposes.
• It costs $1/month for each key you create, and free for keys created by AWS services.
• KMS Keys can be used to encrypt and decrypt data up to 4 KBs in size.
• If the data is larger than 4KBs, then the application needs to do the encryption tasks.
• Envelope Encryption: Encryption (Data) keys can be generated using KMS keys.
• KMS keys never leave KMS.
• KMS does not store customer data (encryption) keys.
• AWS-Managed KMS Keys are created, managed and used on a customer’s behalf by an
AWS services that integrates with KMS.
• Customer-Managed KMS keys are created and managed by customers using KMS.
Ø The customer can create, delete, rotate, control access to, enable and disable these
keys.
• KMS keys are region specific (We can create multi-region keys as well).
• Rotating keys frequently is a good security practice.
• Access Keys (Access Key ID and Secret Access Key) are required for
AWS users to make programmatic calls to AWS.
• Access Keys can be created, modified, viewed, and rotated.
• Secret access keys are accessible only at the time of creation.
• For CLI access, you need to configure your laptop or Mac with access
keys such that AWS can know you when sending requests to AWS.
The shared AWS config and credentials files are plaintext files that reside by default in a
folder named .aws that is placed in the "home" folder on your computer.
• On Linux and macOS, this is typically shown as ~/.aws.
• On Windows, it is %USERPROFILE%\.aws.
SSH
SSH
IP: 1.1.1.1
www.dolfined.com?
IP is : 23.45.36.11
IP: 23.45.36.11
IP: 1.1.1.1
IP is : 23.45.36.11
www.dolfined.com?
IP: 23.45.36.11
Scale Out
Scale In
Horizontal Scaling
(Out and In)
Vertical Scaling
(Up and Down)
120%
0%
60%
0%
60%
Introduction
• Copy AMIs and • Maintain the • Maintain a scaled • Full running version
backup data and minimal version of down version of the of the infrastructure
store in AWS in a core infrastructure environment in in AWS.
different region components active AWS.
in AWS • Active/Active
• No active DR site • Scale it up in the
until a disaster • Ongoing data event of a disaster • Failover to DR in
happens replication between case of a disaster.
the two sites. • Faster and more
• Cheapest expensive than Pilot • Most expensive and
• Faster than Backup light. fastest to recovery.
• Longest to restore and restore
Instance meta data is data about the instance that we can use to configure or manage the
instance.
• Examples are IPv4 address, IPv6 address, DNS hostnames, AMI-ID, instance-ID, instance-
Type, local-hostname, public keys, & security groups.
• You can also use instance metadata to access user data that you specified when launching
your instance.
• The IMDS also makes the AWS credentials available for any IAM role that is attached to
the instance.
• Meta data is not protected by authentication or encryption (cryptography).
Ø Anyone with access to the instance or any application running on the instance can
view the metadata
Ø Do not store any sensitive data (secrets, passwords, or long-lived encryption keys or
long-term credentials in the instance user data)
• AWS does not charge for requests to metadata.
We can access instance metadata from a running instance using one of the following
methods:
• Instance Metadata Service Version 1 (IMDSv1) – a request/response method
• Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method
• For added security, a session token can only be used directly from the EC2 instance
where that session began.
• We can configure the instance metadata service on each instance such that local code or
users must use IMDSv2 (which means IMDSv1 cannot be used then).
• We can completely disable access to instance metadata if required (ensure applications
on the instance do not need to access the metadata).
To view an EC2 Instance’s metadata, use the following URIs (using Link-local addresses)
IPv4:
http://169.254.169.254/latest/meta-data/
https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/
• User data can be changed. To do so, the instance needs to be stopped first.
(EBS-Backed EC2 Instances).
• User data is not protected by encryption, so do not include passwords or
sensitive data in the user data scripts.
• AWS does not charge for requests to read user data.
www.dolfined.com
om
d .c .2 3
)
fi n e 65
w. dol 4. 33.
r ww e s s (5
o r
IP f dd
s t he 1 IP a
at i nod
e
Wh E L B
U se
www.dolfined.com
om
d .c .2 3
)
fi n e 65
w. dol 4. 33.
r ww e s s (5
o r
IP f dd
s t he 1 IP a
at i nod
e
Wh E L B
U se
www.dolfined.com
om
d .c .2 3
)
fi n e 65
w. dol 4. 33.
r ww e s s (5
o r
IP f dd
s t he 1 IP a
at i nod
e
Wh E L B
U se
• For the Internet-facing ELB, the subnets where the ELB is enabled MUST be public subnets.
Ø This is not required for Internal ELBs
• When using Internet-facing ELBs, customer workload can be in private (recommended) or
public subnets.
Previous Generation
Frontend Backend
Frontend Backend
• All ELB types can have one Target Group 1
A Listener : A process listening
or more frontend listeners (waiting or expecting) for
(listening on different ports) connections on a specific port
• An ELB listener expects
traffic on its configured Listener HTTP
port. HTTP (80) (80)
• Each target group has a HTTP
forwarding port on which
the backend is listening HTTPS
Client
(ready to receive traffic on).
Ø The load balancer Listener
HTTPS (443)
forwards traffic to that HTTPS
port using the Target (443)
group
Target Group 2
Target Group 1
A target being a
member of multiple
target groups
Health check at
The target group
level
Free Tier:
• 750 Hours per month (ALB)
• 15 Load Balancer Capacity Units used (LCUs) for ALB
Charges:
• ALB :
Ø Per hour or partial hour while it is running.
Ø Number of LCUs used per hour.
• NLB:
Ø Per hour or partial hour while it is running.
Ø Number of Network Load Balancer Capacity Units (NLCUs)
• GWLB
Ø Per hour or partial hour while it is running.
Ø Number of GWLB Capacity Units used.
https://aws.amazon.com/elasticloadbalancing/pricing/
© DolfinED All rights reserved
Hands-on Labs (HoLs)
Objective: Demonstrate the creation of Target Groups, adding instances, and creating
and using an Application Load Balancer.
• Approach: Launch two EC2 instances with a user data script to identify the instance
and its AZ. Test public access to the instances using HTTP. Launch an Elastic Load
Balancer (ALB) and use it to load balance to two public instances.
AWS Cloud
Route 53
VPC
ALB AZ : US-East-1a Public subnet 1
• AWS Auto Scaling allows for the configuration of automatic scaling for the AWS
resources that are part of an application very quickly.
• Automatic scaling can be configured for individual resources or for applications.
• Auto Scaling can be used with EC2, EC2 Spot Instances, DynamoDB, Aurora, Amazon
ECS among other services.
Scale Out
Scale In
Auto Scaling is useful for applications that experience daily or weekly variations in
traffic flow such as:
• Cyclical (repetitive) traffic patterns (e.g., business hours).
• On and Off traffic patterns (e.g., batch processing)
• Variable traffic patterns (e.g., spiky traffic).
A Launch template
• The template for instance configurations.