AWS cho người mới bắt đầu: Tổng quan toàn diện

Hiểu về Cloud Computing, các khái niệm cơ bản và kiến trúc của AWS. Bước đầu tiên để trở thành AWS Developer.

Cloud Computing là gì?

Cloud Computing là mô hình cung cấp tài nguyên IT qua internet với mô hình pay-as-you-go. Thay vì mua và quản lý data center vật lý, bạn thuê tài nguyên từ AWS.

Lợi ích chính

Lợi íchMô tả
Chi phíKhông đầu tư cơ sở hạ tầng ban đầu
ScalabilityMở rộng/thu hẹp theo nhu cầu
Tốc độKhởi tạo servers trong vài phút
GlobalDeploy ứng dụng toàn cầu

3 Mô hình Cloud Service

  • IaaS (Infrastructure): EC2, VPC, EBS - Bạn kiểm soát hoàn toàn OS
  • PaaS (Platform): Elastic Beanstalk, Lambda - Chỉ focus vào code
  • SaaS (Software): Gmail, Office 365 - Phần mềm hoàn chỉnh

AWS Global Infrastructure

Regions và Availability Zones

Region (ví dụ: ap-southeast-1 - Singapore)
├── AZ-1 (Data center cluster 1)
├── AZ-2 (Data center cluster 2)  
└── AZ-3 (Data center cluster 3)

Chọn Region dựa trên:

  • Latency đến users
  • Compliance requirements
  • Giá cả (khác nhau giữa regions)

Thiết lập môi trường Infrastructure as Code

💡 Quan trọng: Từ đây, tất cả thao tác AWS sẽ được thực hiện qua code thay vì click trên Console.

1. Cài đặt AWS CLI

# macOS
brew install awscli

# Linux
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

# Kiểm tra
aws --version

2. Cấu hình AWS Credentials

# Configure với Access Key
aws configure

# Nhập thông tin:
# AWS Access Key ID: AKIA...
# AWS Secret Access Key: ...
# Default region name: ap-southeast-1
# Default output format: json

3. Cài đặt Terraform

# macOS
brew tap hashicorp/tap
brew install hashicorp/tap/terraform

# Linux
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform

# Kiểm tra
terraform version

4. Project Structure chuẩn

my-aws-project/
├── main.tf           # Resources chính
├── variables.tf      # Input variables
├── outputs.tf        # Output values  
├── providers.tf      # AWS provider config
├── terraform.tfvars  # Variable values (không commit!)
└── .gitignore

5. Terraform Provider Configuration

# providers.tf
terraform {
  required_version = ">= 1.0"
  
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

provider "aws" {
  region = var.aws_region
  
  default_tags {
    tags = {
      Environment = var.environment
      ManagedBy   = "terraform"
      Project     = var.project_name
    }
  }
}
# variables.tf
variable "aws_region" {
  description = "AWS region to deploy resources"
  type        = string
  default     = "ap-southeast-1"
}

variable "environment" {
  description = "Environment name"
  type        = string
  default     = "dev"
}

variable "project_name" {
  description = "Project name for tagging"
  type        = string
}

6. Terraform Workflow cơ bản

# Khởi tạo project (download providers)
terraform init

# Xem những gì sẽ được tạo/thay đổi
terraform plan

# Áp dụng changes
terraform apply

# Xóa tất cả resources
terraform destroy

AWS Free Tier

LoạiVí dụGiới hạn
Always FreeLambda, DynamoDB1M requests/tháng
12 Months FreeEC2 t2.micro750 giờ/tháng

⚠️ Luôn bật Billing Alerts ngay khi tạo account!

Bước tiếp theo

  1. ✅ Cài đặt AWS CLI và Terraform
  2. ✅ Cấu hình credentials
  3. 📖 Học IAM để quản lý permissions
  4. 🚀 Tạo EC2 instance đầu tiên với Terraform

Bài tiếp theo: EC2 & Compute Services - Tạo virtual servers với Infrastructure as Code.