AWS Q&a
VPC Architecture
It is a logically isolated area within the space, where depending on the size of VPC we can launch our resources & these resource will not interfere with the resources in the public cloud
After you create a VPC, you can add subnets.
Subnet
It is an isolated small space within the VPC
A subnet is a range of IP addresses in your VPC.
A subnet must reside in a single Availability Zone
After you add subnets, you can deploy AWS resources in your VPC.
Public subnet --> If a subnet is associated with a route table that has a route to an internet gateway, it's known as a public subnet
Privat subnet --> If a subnet is associated with a route table that does not have a route to an internet gateway, it's known as a private subnet.
IP addressing
IP addresses enable resources in your VPC to communicate with each other, and with resources over the internet.
You can assign IP addresses, both IPv4 and IPv6, to your VPCs and subnets.
You can also bring your public IPv4 addresses and IPv6 GUA addresses to AWS and allocate them to resources in your VPC, such as EC2 instances, NAT gateways, and Network Load Balancers.
Internet Gateway
allows communication between your VPC and the internet.
so resources in your public subnets can connect to the internet if the resource has a public IPv4 address or an IPv6 address. Similarly, resources on the internet can initiate a connection to resources in your subnet using the public IPv4 address or IPv6 address.
It supports IPv4 and IPv6 traffic.
NAT Gateway [Network Address Translation]
- (You can use a NAT device to allow resources in private subnets to connect to the internet. These instances can communicate with services outside the VPC, but they cannot receive unsolicited connection requests.)
Rout Table
Rout table determines the network traffic flow in out VPC
we have Pub & Pri RT
igw will be routed in Pub RT and in Pri RT it wont be routed
Security Group
NACL
ENDPOINT
Peering connections
Transit gateways
VPC Flow Logs
- it keeps track of the IP traffic going in and out of the VPC
VPN connections
- connecting your VPC to the on-premises network is done by AWS VPN
Instance Types
General Purpose
Instance family : T,M
General purpose instances provide a balance of compute, memory and networking resources, and can be used for a variety of diverse workloads.
t- development & testing env, automation works ; m - prod env
These instances are ideal for applications that use these resources in equal proportions such as web servers and code repositories.
Use cases : Applications built on open-source software such as application servers, microservices, gaming servers, midsize data stores, and caching fleets.
Compute Optimized
Instance family : C
(it has more Core than RAM)
they are ideal for compute bound applications that benefit from high performance processors
media processing, machine learning, gaming, scientific modeling
Use Cases : High performance computing (HPC), batch processing, ad serving, video encoding, gaming, scientific modelling, distributed analytics, and CPU-based machine learning inference.
Memory Optimized
Instance family : R,X,Z
Memory optimized instances are designed to deliver fast performance for workloads that process large data sets in memory.
Use cases : Memory-intensive workloads such as open source databases, in-memory caches, and real-time big data analytics
Accelerated Computing
Instance family : P,G,T,I,D,F,V
it has more compute & GPU (Graphical Process Unit)
Accelerated computing instances use hardware accelerators, or co-processors, to perform functions, such as floating point number calculations, graphics processing, or data pattern matching, more efficiently than is possible in software running on CPUs
Use Cases : Generative AI applications, including question answering, code generation, video and image generation, speech recognition, and more. HPC applications at scale in pharmaceutical discovery, seismic analysis, weather forecasting, and financial modeling.
Storage Optimized
Instance family : I,D,H
it has more IOPS (Input Output Per Second)
Storage optimized instances are designed for workloads that require high, sequential read and write access to very large data sets on local storage. They are optimized to deliver tens of thousands of low-latency, random I/O operations per second (IOPS) to applications.
data warehouse [centralized location of all d databases], seeding [copying data from 1 data bases to warehouse]
Use Cases : Amazon EC2 I4g instances are optimized for I/O intensive applications and are targeted to customers using transactional databases (Amazon DynamoDB, MySQL, and PostgreSQL), Amazon OpenSearch Service, and real-time analytics such as Apache Spark.
HPC Optimized
Instance family : H
High performance computing (HPC) instances are purpose built to offer the best price performance for running HPC workloads at scale on AWS. HPC instances are ideal for applications that benefit from high-performance processors such as large, complex simulations and deep learning workloads.
EBS (Elastic Block Storage) types
It provides block level storage volumes for use with EC2 instances
EBS volumes behave like raw, unformatted block devices
You can mount these volumes as devices on your instances.
You can dynamically change the configuration of a volume attached to an instance.
SSD (Solid State Drive)
it is fast as it has no moving parts & it uses memory chips
General Purpose
GP2
GP3
Provisioned IOPS
io2
io2 block express
HDD (Hard Disk Drive)
it is slow as it uses spring disk to store data. it is cost effective
Through put optimized (ST1)
Storage optimized (SC1)
In 2 tire & 3 tire, what is suitable to static & dynamic web pages
In a two-tier and three-tier architecture, both static and dynamic web pages can be accommodated. Here's how each type of page fits into these architectures:
Two-Tier Architecture:
In a two-tier architecture, there are typically two layers: the client layer and the server layer.
Static Web Pages: Two-tier architectures can serve static web pages efficiently. The client (browser) requests a static page, and the server, which often includes a web server like Apache or Nginx, retrieves and serves the requested page directly to the client.
Dynamic Web Pages: While two-tier architectures can handle dynamic content, they may face scalability and performance challenges, especially as the complexity and demand for dynamic content increase. For more complex dynamic pages, a three-tier architecture is often preferred.
Three-Tier Architecture:
In a three-tier architecture, there are three layers: the presentation layer (client), the application layer (middle tier), and the data layer (database).
Static Web Pages: Three-tier architectures can also efficiently serve static web pages. The client requests a static page, which is handled by the presentation layer (client) directly. The server-side components in the application layer may still be involved in processing requests or providing additional functionality.
Dynamic Web Pages: Three-tier architectures are well-suited for handling dynamic web pages. The client interacts with the presentation layer, which then communicates with the application layer for dynamic content generation. This separation of concerns and modularization of functionality make it easier to manage and scale dynamic web applications.
In conclusion, both two-tier and three-tier architectures can handle static and dynamic web pages, but the choice between them often depends on factors like scalability, performance requirements, and the complexity of the web application. For more complex dynamic applications with higher scalability needs, a three-tier architecture is generally more suitable.
*] Instance purchasing options
On-Demand Instances- Pay, by the second, u launch an instances & u should make payment at the end of the month using Pay-as-you-go model
Savings Plans- u can reduce your Amazon EC2 costs by making a commitment to a consistent amount of usage, for a term of 1 or 3 years.
Reserved Instances – Reduce your Amazon EC2 costs by making a commitment to a consistent instance configuration, including instance type and Region, for a term of 1 or 3 years. Payment options -- no-upfront, partial-upfront, full-upfront
Spot Instances – Request unused EC2 instances, which can reduce your Amazon EC2 costs significantly. Bidding happens here & spot price will be fixed. Not recommended for production bcz interruption will be there from AWS side
Dedicated Hosts – Pay for a physical host that is fully dedicated to running your instances, and bring your existing per-socket, per-core, or per-VM software licenses to reduce costs.
Dedicated Instances – Pay, by the hour, for instances that run on single-tenant hardware. (it's d next version of dedicated hosts | allocation of resources will be taken care by AWS)
Capacity Reservations – Reserve capacity for your EC2 instances in a specific Availability Zone.
If you can't make a commitment to a specific instance configuration, but you can commit to a usage amount, purchase Savings Plans to reduce your On-Demand Instance costs.
If you require a capacity reservation, purchase Reserved Instances or Capacity Reservations for a specific Availability Zone.
Capacity Blocks can be used to reserve a cluster of GPU instances.
Spot Instances are a cost-effective choice if you can be flexible about when your applications run and if they can be interrupted.
Dedicated Hosts or Dedicated Instances can help you address compliance requirements and reduce costs by using your existing server-bound software licenses.
*] S3 storage classes
Storage classes for frequently accessed objects
S3 Standard
S3 Express One Zone
Reduced Redundancy
https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html
*] Auto Scaling
AWS Auto Scaling enables you to quickly discover all of the scalable resources underlying your application and set up application scaling in minutes
Auto Scaling groups are collections of Amazon EC2 instances that enable automatic scaling and fleet management features. These features help you maintain the health and availability of your applications.
CONFIGURATION ;
name of ASG
Choose a launch template (we can have different versions of our launch temp)
[u can also create it by giving name, AMI, inst type, key pair, network configuration, storage & create launch template]
Choose instance launch options -- here we specify VPC & subnets specifying where our instances should be launched
Configure advanced options -- here we can choose LB, VPC lattice, health checks (Health check grace period - 300 seconds), monitoring (Enable group metrics collection within CloudWatch)
(VPC Lattice integration options
To improve networking capabilities and scalability, integrate your Auto Scaling group with VPC Lattice. VPC Lattice facilitates communications between AWS services and helps you connect and manage your applications across compute services in AWS.)
Configure group size and scaling -- Desired capacity, Min desired capacity, Max desired capacity, Choose whether to use a target tracking policy (You can set up other metric-based scaling policies and scheduled scaling after creating your Auto Scaling group.)
Add notifications -- Send notifications to SNS topics whenever Amazon EC2 Auto Scaling launches or terminates the EC2 instances in your Auto Scaling group
Review & create it
*] Load Balancer
Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones.
It monitors the health of its registered targets, and routes traffic only to the healthy targets
types of LB mechanisms;
round robin -- if there r 10 servers & 100 requests, then 1 inst will get 10 req
nginx
F5
envoy
A listener is a process that checks for connection requests, using the protocol and port that you configure.
The rules that you define for your listeners determine how the load balancer routes requests to the targets that you register, such as EC2 instances.
Listeners support HTTP, HTTPS protocols. Ports: 1-65535