Introduction
Amazon Web Services (AWS) operates a global infrastructure that is designed to provide high availability, fault tolerance, and scalability. Understanding the AWS global infrastructure is crucial for designing resilient and efficient applications.
Key Concepts
- Regions
- Definition: A Region is a physical location around the world where AWS clusters data centers.
- Purpose: Regions allow you to deploy applications and data in close proximity to your users, ensuring low latency and compliance with data residency requirements.
- Example:
us-east-1
(Northern Virginia),eu-west-1
(Ireland).
- Availability Zones (AZs)
- Definition: Availability Zones are isolated locations within a Region. Each Region consists of multiple, isolated, and physically separate AZs.
- Purpose: AZs provide redundancy and fault tolerance. By deploying applications across multiple AZs, you can ensure high availability.
- Example:
us-east-1a
,us-east-1b
,us-east-1c
.
- Edge Locations
- Definition: Edge Locations are data centers that AWS uses to cache copies of your content closer to your users.
- Purpose: Edge Locations are used by AWS services like Amazon CloudFront to deliver content with low latency.
- Example: Edge Locations are present in major cities around the world.
- Local Zones
- Definition: Local Zones are an extension of an AWS Region that places compute, storage, database, and other select services closer to large population, industry, and IT centers.
- Purpose: Local Zones help to run latency-sensitive applications closer to end-users.
- Example: Los Angeles Local Zone.
- Wavelength Zones
- Definition: Wavelength Zones are AWS infrastructure deployments that embed AWS compute and storage services within telecommunications providers' data centers at the edge of the 5G network.
- Purpose: Wavelength Zones enable developers to build applications that deliver ultra-low latencies to mobile and connected devices.
- Example: Wavelength Zones in Verizon 5G networks.
Practical Example
Deploying an Application Across Multiple AZs
-
Create an EC2 Instance in Multiple AZs:
aws ec2 run-instances --image-id ami-0abcdef1234567890 --count 1 --instance-type t2.micro --key-name MyKeyPair --subnet-id subnet-6e7f829e
-
Set Up a Load Balancer:
aws elbv2 create-load-balancer --name my-load-balancer --subnets subnet-12345678 subnet-87654321 --security-groups sg-12345678
-
Register Instances with the Load Balancer:
aws elbv2 register-targets --target-group-arn arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-targets/1234567890123456 --targets Id=i-1234567890abcdef0 Id=i-0abcdef1234567890
Explanation
- Step 1: Launch EC2 instances in different subnets (each subnet is in a different AZ).
- Step 2: Create an Elastic Load Balancer (ELB) that spans multiple subnets/AZs.
- Step 3: Register the EC2 instances with the ELB to distribute traffic across them.
Practical Exercise
Exercise: Deploy a Simple Web Application Across Multiple AZs
-
Launch Two EC2 Instances in Different AZs:
- Use the AWS Management Console to launch two EC2 instances in different AZs within the same Region.
- Install a simple web server (e.g., Apache) on each instance.
-
Create an Elastic Load Balancer:
- Create an ELB that spans the AZs where your EC2 instances are running.
- Register the EC2 instances with the ELB.
-
Test the Setup:
- Access the ELB's DNS name in your web browser.
- Verify that the web application is accessible and that traffic is distributed across both instances.
Solution
-
Launch EC2 Instances:
- Launch two EC2 instances in different AZs (e.g.,
us-east-1a
andus-east-1b
). - SSH into each instance and install Apache:
sudo apt update sudo apt install apache2 -y sudo systemctl start apache2 sudo systemctl enable apache2
- Launch two EC2 instances in different AZs (e.g.,
-
Create an ELB:
- In the AWS Management Console, navigate to the EC2 Dashboard.
- Under "Load Balancing", select "Load Balancers" and create a new ELB.
- Add the subnets corresponding to the AZs where your instances are running.
- Register your EC2 instances with the ELB.
-
Test the Setup:
- Obtain the DNS name of the ELB from the AWS Management Console.
- Open the DNS name in your web browser to verify that the web application is accessible.
Conclusion
Understanding AWS's global infrastructure is fundamental for designing highly available, fault-tolerant, and scalable applications. By leveraging Regions, Availability Zones, Edge Locations, Local Zones, and Wavelength Zones, you can optimize your applications for performance and reliability. In the next module, we will dive into core AWS services, starting with Amazon EC2.