DevOps & Cloud

AWS untuk Pemula: Memulai Cloud Computing

TOKEN

Panduan lengkap memulai Amazon Web Services dari nol โ€” EC2, S3, RDS, Lambda, IAM, VPC, pricing, free tier, dan arsitektur cloud yang umum digunakan

1. Pengenalan AWS

Amazon Web Services (AWS) adalah platform cloud computing terbesar di dunia, diluncurkan oleh Amazon pada tahun 2006. AWS menyediakan lebih dari 200 layanan cloud yang mencakup compute, storage, database, networking, machine learning, dan banyak lagi โ€” semuanya tersedia secara on-demand melalui internet.

AWS mendominasi pasar cloud global dengan pangsa pasar sekitar 31%, diikuti Microsoft Azure (25%) dan Google Cloud (11%). Jutaan pelanggan โ€” dari startup hingga enterprise besar seperti Netflix, Airbnb, dan NASA โ€” menggunakan AWS untuk menjalankan infrastruktur IT mereka.

Layanan Utama AWS

Kategori Layanan Fungsi
ComputeEC2, Lambda, ECS, EKSMenjalankan aplikasi dan container
StorageS3, EBS, EFS, GlacierMenyimpan data dan file
DatabaseRDS, DynamoDB, ElastiCacheManaged database service
NetworkingVPC, Route 53, CloudFront, ELBJaringan, DNS, CDN, load balancing
SecurityIAM, KMS, WAF, ShieldKeamanan dan kontrol akses
DevOpsCodePipeline, CodeBuild, CloudFormationCI/CD dan Infrastructure as Code
MonitoringCloudWatch, CloudTrail, X-RayMonitoring, logging, tracing
AI/MLSageMaker, Bedrock, RekognitionMachine learning dan AI

AWS Global Infrastructure

Komponen Jumlah (2026) Penjelasan
Regions33+Lokasi geografis (misal: ap-southeast-1 = Singapore)
Availability Zones (AZ)105+Data center terisolasi dalam satu region
Edge Locations600+Titik cache untuk CloudFront CDN
๐Ÿ’ก Tips untuk Indonesia

Untuk latensi terbaik dari Indonesia, pilih region ap-southeast-1 (Singapore) atau ap-southeast-3 (Jakarta โ€” tersedia sejak 2022). Region Jakarta (ap-southeast-3) memberikan latensi paling rendah untuk pengguna di Indonesia.

Diagram: AWS Global Infrastructure
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    AWS GLOBAL INFRASTRUCTURE                  โ”‚
โ”‚                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚  โ”‚   Region      โ”‚  โ”‚   Region      โ”‚  โ”‚   Region      โ”‚       โ”‚
โ”‚  โ”‚   us-east-1   โ”‚  โ”‚  ap-se-1      โ”‚  โ”‚  ap-se-3      โ”‚       โ”‚
โ”‚  โ”‚   (Virginia)  โ”‚  โ”‚ (Singapore)   โ”‚  โ”‚ (Jakarta)     โ”‚       โ”‚
โ”‚  โ”‚               โ”‚  โ”‚               โ”‚  โ”‚               โ”‚       โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ” โ”Œโ”€โ”€โ”   โ”‚  โ”‚  โ”Œโ”€โ”€โ” โ”Œโ”€โ”€โ”   โ”‚  โ”‚  โ”Œโ”€โ”€โ” โ”Œโ”€โ”€โ”   โ”‚       โ”‚
โ”‚  โ”‚  โ”‚AZโ”‚ โ”‚AZโ”‚   โ”‚  โ”‚  โ”‚AZโ”‚ โ”‚AZโ”‚   โ”‚  โ”‚  โ”‚AZโ”‚ โ”‚AZโ”‚   โ”‚       โ”‚
โ”‚  โ”‚  โ”‚a โ”‚ โ”‚b โ”‚   โ”‚  โ”‚  โ”‚a โ”‚ โ”‚b โ”‚   โ”‚  โ”‚  โ”‚a โ”‚ โ”‚b โ”‚   โ”‚       โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”˜ โ””โ”€โ”€โ”˜   โ”‚  โ”‚  โ””โ”€โ”€โ”˜ โ””โ”€โ”€โ”˜   โ”‚  โ”‚  โ””โ”€โ”€โ”˜ โ””โ”€โ”€โ”˜   โ”‚       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”‚                                                               โ”‚
โ”‚  Edge Locations (CDN): 600+ titik worldwide                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”          โ”‚
โ”‚  โ”‚Edge โ”‚ โ”‚Edge โ”‚ โ”‚Edge โ”‚ โ”‚Edge โ”‚ โ”‚Edge โ”‚ โ”‚Edge โ”‚  ...       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

2. EC2: Virtual Server di Cloud

Amazon EC2 (Elastic Compute Cloud) adalah layanan compute utama AWS yang menyediakan virtual server (disebut instances) di cloud. EC2 memungkinkan Anda menjalankan aplikasi di atas infrastruktur Amazon tanpa perlu membeli atau mengelola server fisik.

Tipe Instance EC2

Tipe Kode Cocok Untuk Contoh
General Purposet3, m5, m6iWeb server, aplikasi umumt3.micro (Free Tier)
Compute Optimizedc5, c6iBatch processing, game serverc5.large
Memory Optimizedr5, r6iDatabase, cachingr5.large
Storage Optimizedi3, d2Data warehouse, big datai3.large
GPU Instancesp4, g5Machine learning, renderingg5.xlarge

Membuat EC2 Instance

AWS CLI โ€” Launch EC2
# Pastikan AWS CLI sudah dikonfigurasi
aws configure
# Masukkan: AWS Access Key ID, Secret, Region, Output format

# Buat key pair untuk SSH
aws ec2 create-key-pair \
  --key-name my-key \
  --query 'KeyMaterial' \
  --output text > my-key.pem
chmod 400 my-key.pem

# Buat security group (firewall)
aws ec2 create-security-group \
  --group-name web-sg \
  --description "Allow HTTP and SSH"

# Tambah aturan firewall
aws ec2 authorize-security-group-ingress \
  --group-name web-sg \
  --protocol tcp --port 22 --cidr 0.0.0.0/0

aws ec2 authorize-security-group-ingress \
  --group-name web-sg \
  --protocol tcp --port 80 --cidr 0.0.0.0/0

# Launch EC2 instance (Free Tier eligible)
aws ec2 run-instances \
  --image-id ami-0123456789abcdef0 \
  --instance-type t3.micro \
  --key-name my-key \
  --security-groups web-sg \
  --count 1

# Cek status instance
aws ec2 describe-instances \
  --query 'Reservations[*].Instances[*].[InstanceId,State.Name,PublicIpAddress]' \
  --output table

# SSH ke instance
ssh -i my-key.pem ec2-user@

# Stop instance (hemat biaya saat tidak digunakan)
aws ec2 stop-instances --instance-ids i-1234567890abcdef0

# Hapus instance
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0

Lifecycle EC2 Instance

Diagram: EC2 Instance Lifecycle
Pending โ”€โ”€โ–บ Running โ”€โ”€โ–บ Stopping โ”€โ”€โ–บ Stopped
                โ”‚                      โ”‚
                โ”‚                      โ–ผ
                โ”‚              Terminated (hapus)
                โ–ผ
          Shutting-down โ”€โ”€โ–บ Terminated

  Start / Stop / Reboot / Terminate / Hibernate
โš ๏ธ Peringatan

Selalu hentikan (stop) atau terminate instance EC2 yang tidak digunakan! Instance yang berjalan terus dikenakan biaya per jam โ€” bahkan jika tidak ada traffic. Gunakan Auto Scaling untuk mengatur jumlah instance berdasarkan beban.

3. S3: Object Storage

Amazon S3 (Simple Storage Service) adalah layanan object storage yang menyediakan penyimpanan data dengan durability 99.999999999% (11 nines). S3 digunakan untuk menyimpan file, backup, static website hosting, dan banyak lagi.

Konsep Dasar S3

Konsep Penjelasan
BucketContainer utama untuk menyimpan objects (seperti folder root). Nama bucket harus unik secara global
ObjectFile yang disimpan di S3 โ€” terdiri dari data dan metadata. Ukuran max 5 TB per object
KeyPath unik untuk setiap object (misal: images/photo.jpg)
PrefixVirtual folder menggunakan "/" dalam key (misal: uploads/2026/)
VersioningMenyimpan versi history setiap object

S3 Storage Classes

Storage Class Akses Biaya Cocok Untuk
S3 StandardSering (milisecond)$$Data aktif, website, aplikasi
S3 IntelligentAdaptif$$Pola akses berubah-ubah
S3 Standard-IAJarang (milisecond)$Backup, data lama
S3 One Zone-IAJarang (satu AZ)ยขBackup yang bisa dibuat ulang
S3 GlacierMenit - JamยขArsip compliance
S3 Glacier Deep12+ jamยขยขArsip jangka sangat panjang

Menggunakan S3

AWS CLI โ€” S3 Operations
# === BUCKET OPERATIONS ===
# Buat bucket
aws s3 mb s3://my-unique-bucket-name-2026

# Daftar semua bucket
aws s3 ls

# Daftar isi bucket
aws s3 ls s3://my-unique-bucket-name-2026/

# === FILE OPERATIONS ===
# Upload file
aws s3 cp photo.jpg s3://my-bucket/images/photo.jpg

# Upload direktori (recursive)
aws s3 sync ./dist s3://my-bucket/website/

# Download file
aws s3 cp s3://my-bucket/images/photo.jpg ./downloaded.jpg

# Hapus file
aws s3 rm s3://my-bucket/images/photo.jpg

# Pindah / rename
aws s3 mv s3://my-bucket/old.txt s3://my-bucket/new.txt

# === STATIC WEBSITE HOSTING ===
aws s3 website s3://my-bucket \
  --index-document index.html \
  --error-document error.html

# Set bucket public
aws s3api put-bucket-policy \
  --bucket my-bucket \
  --policy '{
    "Version": "2012-10-17",
    "Statement": [{
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/*"
    }]
  }'

4. RDS: Managed Database

Amazon RDS (Relational Database Service) adalah layanan database relational yang dikelola oleh AWS. RDS menangani tugas administrasi database seperti provisioning, patching, backup, recovery, dan scaling โ€” sehingga Anda bisa fokus pada aplikasi.

Database Engine yang Didukung

Engine Keunggulan Free Tier
MySQLOpen-source, populer, komunitas besarโœ… db.t3.micro 750 jam/bulan
PostgreSQLFitur lengkap, standar SQL tinggiโœ… db.t3.micro 750 jam/bulan
MariaDBFork MySQL dengan fitur tambahanโœ… db.t3.micro 750 jam/bulan
OracleEnterprise, fitur canggihโš ๏ธ Terbatas
SQL ServerEkosistem Microsoftโš ๏ธ Terbatas
Aurora5x lebih cepat dari MySQL, 3x dari PostgreSQLโœ… db.t3.micro

Membuat Database RDS

AWS CLI โ€” RDS
# Buat RDS PostgreSQL instance (Free Tier)
aws rds create-db-instance \
  --db-instance-identifier my-database \
  --db-instance-class db.t3.micro \
  --engine postgres \
  --engine-version 16.3 \
  --master-username admin \
  --master-user-password MySecurePassword123! \
  --allocated-storage 20 \
  --storage-type gp3 \
  --backup-retention-period 7 \
  --multi-az false \
  --publicly-accessible false

# Cek status database
aws rds describe-db-instances \
  --db-instance-identifier my-database \
  --query 'DBInstances[0].DBInstanceStatus'

# Dapatkan endpoint database
aws rds describe-db-instances \
  --db-instance-identifier my-database \
  --query 'DBInstances[0].Endpoint.Address'

# Connect dari EC2 di VPC yang sama
psql -h  -U admin -d mydb

# Snapshot manual (backup)
aws rds create-db-snapshot \
  --db-instance-identifier my-database \
  --db-snapshot-identifier my-snapshot-2026

# Hapus database (HATI-HATI!)
aws rds delete-db-instance \
  --db-instance-identifier my-database \
  --skip-final-snapshot
๐Ÿ’ก Tips

Untuk development, gunakan db.t3.micro (Free Tier) dengan --no-multi-az untuk menghemat biaya. Untuk production, selalu aktifkan Multi-AZ untuk high availability dan Read Replicas untuk performa baca yang lebih baik.

5. Lambda: Serverless Computing

AWS Lambda adalah layanan serverless yang memungkinkan Anda menjalankan kode tanpa perlu mengelola server. Anda cukup upload kode, dan Lambda akan mengeksekusinya secara otomatis โ€” baik saat dipicu oleh event (HTTP request, file upload, database change) maupun secara terjadwal.

Keunggulan Lambda

Keunggulan Penjelasan
Tanpa ServerTidak perlu provisioning, patching, atau mengelola server
Auto ScalingOtomatis menskalakan dari 0 hingga ribuan concurrent executions
Pay per UseBayar hanya untuk waktu eksekusi โ€” tidak ada biaya saat idle
Event-DrivenDipicu oleh 200+ event sources dari layanan AWS lain
Multi BahasaNode.js, Python, Java, Go, .NET, Ruby, Rust (custom runtime)

Contoh Lambda Function

Python โ€” Lambda Function
"""
AWS Lambda Function โ€” API Handler
BeebaneLabs - AWS Tutorial
"""

import json
from datetime import datetime


def handler(event, context):
    """
    Lambda handler โ€” entry point saat function dipanggil.
    
    Args:
        event: Data trigger (API Gateway, S3, dll)
        context: Info tentang runtime environment
    """
    
    # Parse request dari API Gateway
    http_method = event.get('httpMethod', 'GET')
    path = event.get('path', '/')
    query_params = event.get('queryStringParameters') or {}
    
    # Log untuk CloudWatch
    print(f"Request: {http_method} {path}")
    print(f"Query: {query_params}")
    
    # Response berdasarkan path
    if path == '/health':
        body = {
            'status': 'healthy',
            'timestamp': datetime.utcnow().isoformat(),
            'function_name': context.function_name,
            'memory_limit': context.memory_limit_in_mb,
            'remaining_time': context.get_remaining_time_in_millis()
        }
    elif path == '/hello':
        name = query_params.get('name', 'World')
        body = {
            'message': f'Hello, {name}!',
            'timestamp': datetime.utcnow().isoformat()
        }
    else:
        body = {
            'error': 'Not Found',
            'path': path
        }
        return {
            'statusCode': 404,
            'headers': {
                'Content-Type': 'application/json',
                'Access-Control-Allow-Origin': '*'
            },
            'body': json.dumps(body)
        }
    
    return {
        'statusCode': 200,
        'headers': {
            'Content-Type': 'application/json',
            'Access-Control-Allow-Origin': '*'
        },
        'body': json.dumps(body, default=str)
    }

Deploy Lambda dengan AWS CLI

Bash โ€” Deploy Lambda
# Buat deployment package
zip function.zip lambda_function.py

# Buat IAM role untuk Lambda
aws iam create-role \
  --role-name lambda-role \
  --assume-role-policy-document '{
    "Version": "2012-10-17",
    "Statement": [{
      "Effect": "Allow",
      "Principal": {"Service": "lambda.amazonaws.com"},
      "Action": "sts:AssumeRole"
    }]
  }'

# Attach policy
aws iam attach-role-policy \
  --role-name lambda-role \
  --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

# Deploy Lambda function
aws lambda create-function \
  --function-name my-api \
  --runtime python3.12 \
  --role arn:aws:iam::123456789012:role/lambda-role \
  --handler lambda_function.handler \
  --zip-file fileb://function.zip \
  --timeout 30 \
  --memory-size 128

# Test invoke
aws lambda invoke \
  --function-name my-api \
  --payload '{"httpMethod":"GET","path":"/hello","queryStringParameters":{"name":"BeebaneLabs"}}' \
  --cli-binary-format raw-in-base64-out \
  response.json

cat response.json

6. IAM: Identity & Access Management

AWS IAM (Identity and Access Management) adalah layanan yang mengatur siapa (identity) yang bisa mengakses apa (resource) dan bagaimana caranya (permission). IAM adalah fondasi keamanan AWS โ€” setiap interaksi dengan AWS harus melewati IAM.

Komponen IAM

Komponen Fungsi Contoh
IAM UserIdentitas individu dengan credentials sendirideveloper@perusahaan.com
IAM GroupKumpulan users dengan permission yang samaDevelopers, Admins, ReadOnly
IAM RoleIdentitas yang bisa "dipinjam" oleh user/serviceEC2-Role, Lambda-Role
IAM PolicyDokumen JSON yang mendefinisikan permissionS3ReadOnlyAccess, EC2FullAccess

Best Practices IAM

JSON โ€” IAM Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowS3ReadOnly",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::my-bucket",
        "arn:aws:s3:::my-bucket/*"
      ]
    },
    {
      "Sid": "DenyDeleteAll",
      "Effect": "Deny",
      "Action": [
        "s3:DeleteBucket",
        "iam:DeleteUser"
      ],
      "Resource": "*"
    }
  ]
}

Best Practices IAM

Praktik Alasan
Jangan gunakan root accountBuat IAM user baru untuk aktivitas harian
Aktifkan MFAMulti-Factor Authentication untuk keamanan tambahan
Principle of Least PrivilegeBerikan hanya permission yang benar-benar dibutuhkan
Gunakan IAM RolesUntuk layanan AWS (EC2, Lambda) โ€” hindari hardcoded credentials
Rotate credentialsGanti access keys secara berkala
Gunakan IAM GroupsKelola permission via groups, bukan per user
Audit dengan IAM Access AnalyzerDeteksi permission yang terlalu luas

7. VPC: Virtual Private Cloud

Amazon VPC (Virtual Private Cloud) memungkinkan Anda membuat jaringan virtual terisolasi di AWS. Di dalam VPC, Anda memiliki kontrol penuh atas IP address, subnet, routing, dan firewall โ€” mirip dengan jaringan data center tradisional, tetapi di cloud.

Komponen VPC

Komponen Fungsi
VPCJaringan virtual terisolasi (CIDR range: misal 10.0.0.0/16)
SubnetPembagian VPC per Availability Zone โ€” public (internet) atau private
Internet GatewayKoneksi dari VPC ke internet
NAT GatewayInstance di private subnet bisa akses internet tanpa bisa diakses dari luar
Route TableAturan routing untuk menentukan arah traffic
Security GroupFirewall instance-level โ€” stateful
Network ACLFirewall subnet-level โ€” stateless
Diagram: VPC Architecture
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ VPC (10.0.0.0/16) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€ AZ-a (ap-southeast-1a) โ”€โ”€โ”  โ”Œโ”€โ”€โ”€ AZ-b โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚                              โ”‚  โ”‚                   โ”‚โ”‚
โ”‚  โ”‚  Public Subnet               โ”‚  โ”‚  Public Subnet    โ”‚โ”‚
โ”‚  โ”‚  (10.0.1.0/24)              โ”‚  โ”‚  (10.0.2.0/24)   โ”‚โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚โ”‚
โ”‚  โ”‚  โ”‚ EC2 Web โ”‚ โ—„โ”€โ”€ Internet   โ”‚  โ”‚  โ”‚ EC2 Web โ”‚     โ”‚โ”‚
โ”‚  โ”‚  โ”‚ Server  โ”‚    Gateway     โ”‚  โ”‚  โ”‚ Server  โ”‚     โ”‚โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚โ”‚
โ”‚  โ”‚                              โ”‚  โ”‚                   โ”‚โ”‚
โ”‚  โ”‚  Private Subnet              โ”‚  โ”‚  Private Subnet   โ”‚โ”‚
โ”‚  โ”‚  (10.0.10.0/24)             โ”‚  โ”‚  (10.0.20.0/24)  โ”‚โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚โ”‚
โ”‚  โ”‚  โ”‚ RDS     โ”‚  โ”‚ App      โ”‚  โ”‚  โ”‚  โ”‚ RDS      โ”‚    โ”‚โ”‚
โ”‚  โ”‚  โ”‚ Primary โ”‚  โ”‚ Server   โ”‚  โ”‚  โ”‚  โ”‚ Standby  โ”‚    โ”‚โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚โ”‚
โ”‚  โ”‚          โ–ฒ                   โ”‚  โ”‚       โ–ฒ           โ”‚โ”‚
โ”‚  โ”‚          โ”‚ NAT Gateway       โ”‚  โ”‚       โ”‚           โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ”‚             โ”‚                               โ”‚            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                               โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€ Internet โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Membuat VPC dengan AWS CLI

Bash โ€” VPC Setup
# Buat VPC
VPC_ID=$(aws ec2 create-vpc \
  --cidr-block 10.0.0.0/16 \
  --query 'Vpc.VpcId' --output text)
echo "VPC: $VPC_ID"

# Aktifkan DNS hostname
aws ec2 modify-vpc-attribute \
  --vpc-id $VPC_ID \
  --enable-dns-hostnames

# Buat public subnet
PUB_SUBNET=$(aws ec2 create-subnet \
  --vpc-id $VPC_ID \
  --cidr-block 10.0.1.0/24 \
  --availability-zone ap-southeast-1a \
  --query 'Subnet.SubnetId' --output text)

# Buat private subnet
PRIV_SUBNET=$(aws ec2 create-subnet \
  --vpc-id $VPC_ID \
  --cidr-block 10.0.10.0/24 \
  --availability-zone ap-southeast-1a \
  --query 'Subnet.SubnetId' --output text)

# Buat Internet Gateway
IGW_ID=$(aws ec2 create-internet-gateway \
  --query 'InternetGateway.InternetGatewayId' --output text)
aws ec2 attach-internet-gateway \
  --internet-gateway-id $IGW_ID --vpc-id $VPC_ID

# Route table untuk public subnet
RT_ID=$(aws ec2 create-route-table \
  --vpc-id $VPC_ID \
  --query 'RouteTable.RouteTableId' --output text)
aws ec2 create-route \
  --route-table-id $RT_ID \
  --destination-cidr-block 0.0.0.0/0 \
  --gateway-id $IGW_ID
aws ec2 associate-route-table \
  --route-table-id $RT_ID --subnet-id $PUB_SUBNET

8. Pricing & Free Tier

AWS menggunakan model pay-as-you-go โ€” Anda membayar hanya untuk resource yang digunakan. Ini menghilangkan kebutuhan investasi infrastruktur di muka dan memungkinkan skalabilitas yang fleksibel.

AWS Free Tier

AWS menyediakan Free Tier selama 12 bulan untuk akun baru, plus beberapa layanan yang selalu gratis:

Layanan Free Tier Batas
EC2t2.micro / t3.micro750 jam/bulan selama 12 bulan
S3Standard5 GB storage, 20K GET, 2K PUT/bulan
RDSdb.t3.micro750 jam/bulan + 20 GB storage selama 12 bulan
Lambda1 juta request/bulan400.000 detik compute/bulan โ€” SELALU gratis
DynamoDB25 GB25 GB storage + 25 RCU/WCU โ€” SELALU gratis
CloudFront1 TB transfer10 juta request/bulan selama 12 bulan
SNS1 juta publish/bulanSELALU gratis
CloudWatch10 metrics10 alarm, 1 GB log โ€” SELALU gratis
โš ๏ธ Peringatan Billing

Set billing alert di AWS Budgets! Banyak pemula terkejut dengan tagihan besar karena lupa mematikan resource. Buat alarm CloudWatch untuk notifikasi saat pengeluaran melebihi batas tertentu (misal: $10/bulan).

Tips Menghemat Biaya AWS

Strategi Penghematan
Stop instance saat tidak digunakanHingga 70% untuk dev/test
Gunakan Reserved Instances (1-3 tahun)Hingga 72% untuk production
Gunakan Spot InstancesHingga 90% untuk workload fault-tolerant
Right-sizingPilih instance type sesuai beban aktual
S3 Lifecycle policiesPindahkan data jarang diakses ke Glacier
AWS Savings PlansKomitmen penggunaan untuk diskon fleksibel

9. Arsitektur Umum di AWS

Berikut beberapa arsitektur AWS yang umum digunakan oleh berbagai skala aplikasi:

Arsitektur Web App Sederhana

Diagram: Simple Web App Architecture
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  CloudFront  โ”‚  โ† CDN (cache static files)
                    โ”‚  (CDN)       โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚     ALB      โ”‚  โ† Load Balancer
                    โ”‚  (App LB)    โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ–ผ      โ–ผ       โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚ EC2  โ”‚โ”‚ EC2  โ”‚โ”‚ EC2  โ”‚  โ† Auto Scaling Group
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚      โ”‚       โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚     RDS      โ”‚  โ† Database (Multi-AZ)
                    โ”‚ (PostgreSQL) โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    Static files โ†’ S3
    Logs โ†’ CloudWatch
    DNS โ†’ Route 53

Arsitektur Serverless

Diagram: Serverless Architecture
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  API Gateway โ”‚  โ† HTTP endpoint
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   Lambda     โ”‚  โ† Business logic (serverless)
         โ”‚  Functions   โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”
           โ–ผ         โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ DynamoDB  โ”‚ โ”‚   S3      โ”‚  โ† Database & Storage
    โ”‚ (NoSQL)   โ”‚ โ”‚ (files)   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    Frontend: S3 + CloudFront (static hosting)
    Auth: Amazon Cognito
    Monitoring: CloudWatch

Tips Memilih Layanan AWS

Kebutuhan Layanan AWS Kapan
Web serverEC2 + ALBAplikasi tradisional, full control
API backendAPI Gateway + LambdaTraffic tidak menentu, hemat biaya
Static websiteS3 + CloudFrontSPA, blog, landing page
DatabaseRDS (SQL) / DynamoDB (NoSQL)Relational vs key-value
File storageS3Upload, backup, media
ContainerECS / EKSMicroservices, Docker apps
Machine LearningSageMakerTraining dan inference model ML

10. Quiz: Uji Pemahamanmu!

Setelah membaca tutorial di atas, jawablah 5 pertanyaan berikut untuk menguji pemahamanmu tentang AWS:

Pertanyaan 1: Apa perbedaan utama antara S3 Standard dan S3 Glacier?

a) S3 Standard untuk data kecil, Glacier untuk data besar
b) S3 Standard untuk akses sering, Glacier untuk arsip jangka panjang dengan biaya rendah
c) S3 Standard lebih aman dari Glacier
d) Tidak ada perbedaan, hanya nama berbeda

Pertanyaan 2: Apa fungsi utama AWS IAM?

a) Mengelola billing AWS
b) Mengatur siapa yang bisa mengakses apa di AWS
c) Menyimpan data di cloud
d) Menjalankan virtual machine

Pertanyaan 3: Keunggulan utama AWS Lambda dibanding EC2 adalah?

a) Lambda lebih aman dari EC2
b) Lambda tidak memerlukan server management dan bayar per eksekusi
c) Lambda bisa menjalankan semua bahasa pemrograman
d) Lambda memiliki performa 10x lebih cepat

Pertanyaan 4: Komponen apa yang menghubungkan VPC ke internet?

a) NAT Gateway
b) Security Group
c) Internet Gateway
d) Route Table

Pertanyaan 5: Strategi apa yang bisa menghemat biaya EC2 hingga 90%?

a) Reserved Instances
b) On-Demand Instances
c) Spot Instances
d) Savings Plans