Exploring AWS Global Infrastructure and EC2 Services - Week Nine

Shubham Murti - Oct 2 - - Dev Community

Hello Community!

This week, I delved into the fascinating world of AWS global infrastructure and explored Amazon EC2 services. Understanding the architecture behind AWS’s global network and learning how to leverage EC2 for scalable computing has been an enlightening experience. In this post, I’ll share detailed insights on AWS regions, availability zones, local zones, and the process of setting up and managing EC2 instances.

Global Infrastructure

Region and Availability Zone:

  • Region: An AWS region is a geographical area that contains multiple availability zones (AZs). Each region operates independently to ensure maximum fault tolerance and stability. For example, the US East (N. Virginia) region has six AZs.

  • Availability Zone (AZ): AZs consist of one or more discrete data centers with redundant power, networking, and connectivity. By distributing applications across multiple AZs, AWS provides high availability and fault tolerance. For instance, deploying your application across three AZs ensures that if one AZ fails, the application remains operational in the other two.

Importance of Region Setup:

  • Latency Reduction: Deploying resources closer to your end-users improves response times. For example, a user in Tokyo accessing services hosted in the Tokyo region will experience lower latency compared to accessing services in the US.

  • Disaster Recovery: Setting up resources in different regions ensures data redundancy and resilience against regional failures. For instance, you can back up data from the US West (Oregon) region to the Asia Pacific (Sydney) region.

  • Compliance: Some industries have regulatory requirements that mandate data storage within specific geographical boundaries. For example, healthcare data might need to be stored within the same country to comply with data protection laws.

Local Zones

Local Zones extend AWS regions to provide low-latency access to applications closer to end-users. They are ideal for latency-sensitive applications such as gaming, media streaming, and real-time communications. For example, AWS Local Zones in Los Angeles provide single-digit millisecond latency for applications used by end-users in Southern California.

EC2 Services

Amazon Elastic Compute Cloud (EC2)

EC2 provides scalable computing capacity in the cloud, allowing you to rent virtual servers with customizable specifications. Here’s a detailed look at the process:

Getting Server on Rent:

With EC2, you can rent virtual servers (instances) and select specifications according to your needs:

  • CPUs: Choose the number of virtual CPUs. For example, a t3.micro instance has 2 vCPUs.
  • Storage: Select storage type (e.g., SSD) and size. For example, you can choose a 20 GB General Purpose SSD.
  • Internet Speed: Configure network performance based on instance type.
  • Operating System (OS): Choose from various OS options like Linux, Windows, etc. For example, Amazon Linux 2 or Windows Server 2019.
  • RAM: Allocate memory based on application requirements. For example, a m5.large instance has 8 GB of RAM.
  • Firewall Rules: Set up security groups to control inbound and outbound traffic. For example, allowing HTTP (port 80) and SSH (port 22) traffic.
  • Bootstrap Script: Use user data scripts to automate configuration tasks at instance launch. For example, installing and starting Apache on instance launch.

Creating EC2 Services

Accessing EC2 Remotely:

Windows 10:

  1. Open the AWS Management Console.
  2. Navigate to the EC2 Dashboard and click “Launch Instance.”
  3. Select an Amazon Machine Image (AMI).
  4. Choose an instance type and configure instance details.
  5. Add storage, configure security groups, and review the instance launch.
  6. Download the key pair (.pem file) for SSH access.
  7. Connect to the instance using an SSH client like PuTTY (convert .pem to .ppk using PuTTYgen).
  8. Enter the public IP and username (e.g., ec2-user for Amazon Linux) to access the instance.

Kali Linux:

  1. Follow steps 1–6 as above.
  2. Open the terminal in Kali Linux.
  3. Use the SSH command to connect: ssh -i /path/to/key-pair.pem ec2-user@public-ip.

Deploying a Simple Application in EC2:

Connecting EC2 Service through Web Browser:

  • Ensure the instance has a public IP and appropriate security group rules (allowing port 80 for HTTP).
  • Install a web server (e.g., Apache) and deploy the application.
  • Access the application via the public IP in a web browser.

User Data Script and Shell Script:

  • User Data Script: Automate instance configuration tasks at launch. For example, to install Apache and start the web server:
  #!/bin/bash
  yum update -y
  yum install -y httpd
  systemctl start httpd
  systemctl enable httpd
  echo "Hello from EC2" > /var/www/html/index.html
Enter fullscreen mode Exit fullscreen mode

- Shell Script: Automate repetitive tasks and deployments. For example, a script to update the server and deploy an application:

#!/bin/bash
apt-get update -y
apt-get install -y apache2
systemctl start apache2
systemctl enable apache2
echo "Hello from EC2" > /var/www/html/index.html
Enter fullscreen mode Exit fullscreen mode

Closure

This week’s journey into AWS global infrastructure and EC2 services has been incredibly insightful. Understanding the significance of regions and availability zones, and how to effectively deploy and manage EC2 instances, is crucial for leveraging AWS’s powerful cloud platform. I hope this detailed overview helps you in your cloud computing endeavors. If you have any insights or additional resources, feel free to share them. 😊

Stay tuned for more updates next week!

Shubham Murti — Aspiring Cloud Security Engineer | Weekly Cloud Learning !!

Let’s connect: Linkdin, Twitter, Github

. . . . . . . . . . . . . . . . .
Terabox Video Player