Thuta Learning
ရှာဖွေရန်
BasicDevOpsbeginner

ပထမဆုံး EC2 Instance

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • ပထမဆုံး EC2 Instance ကို ကြောက်စရာမလိုအောင် နားလည်မယ်
  • ကိုယ်တိုင် AWS CLI/Console ကို run ကြည့်တတ်မယ်
  • Real project ထဲမှာ ဒီ concept ကို ချက်ချင်း အသုံးချတတ်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

EC2 Instance က virtual server တစ်လုံးကို ကိုယ်စားပြုပါတယ် — launch လုပ်ဖို့ AMI (Amazon Machine Image, operating system + pre-installed software ပါတဲ့ template) ကို ရွေးချယ်ရပါတယ် (Ubuntu, Amazon Linux, Windows Server စတာ)။ Instance Type (t2.micro, t3.large) က CPU/memory size ကို သတ်မှတ်ပါတယ် — t2.micro က Free Tier eligible ဖြစ်ပြီး learning အတွက် သင့်တော်ပါတယ်။ Key Pair ကတော့ instance ထဲကို SSH ချိတ်ဆက်ဖို့ authentication method ပါ (public/private key encryption) — launch ချိန်မှာ key pair create/select မလုပ်ရင် instance ထဲ ဝင်လို့ မရနိုင်ပါဘူး.

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

EC2 launch wizard ထဲမှာ AMI (Amazon Linux 2023 လိုမျိုး), Instance Type (t2.micro), Key Pair (အသစ် create), Security Group (SSH port 22 ကို ကိုယ့် IP ကနေပဲ ဝင်ခွင့်ပြု) ကို configure လုပ်ပြီး Launch ချလိုက်ရင် minute အနည်းငယ်အတွင်း server run ချက်ချင်း ရလာပါလိမ့်မယ် — `ssh -i my-key.pem ec2-user@<public-ip>` နဲ့ ချိတ်ဆက်လို့ရပါတယ်.

အတူတူ ကြည့်မယ်

bash
# Launch an EC2 instance via CLI (t2.micro, Amazon Linux)
aws ec2 run-instances \
  --image-id ami-0abcdef1234567890 \
  --instance-type t2.micro \
  --key-name my-key \
  --security-group-ids sg-0123456789abcdef0

# SSH into it once running
ssh -i my-key.pem ec2-user@<public-ip>
You should see
$ aws ec2 describe-instances --query 'Reservations[].Instances[].State.Name'
["running"]

၅ မိနစ် စမ်းကြည့်

AWS Console (ဒါမှမဟုတ် CLI) ကနေ t2.micro EC2 instance တစ်လုံး launch လုပ်ကြည့်ပါ — SSH ချိတ်ဆက်ကြည့်ပြီး, practice ပြီးရင် instance ကို terminate (ဖျက်) ကြည့်ပါ (cost ကာကွယ်ဖို့)။

သတိလေးတစ်ချက်

Practice ပြီးရင် EC2 instance ကို terminate မလုပ်ဘဲ run ထားခဲ့ရင် (Free Tier limit ကျော်သွားရင်) hourly cost ဖြစ်ပေါ်နေပါလိမ့်မယ် — lesson ပြီးတိုင်း instance status ကို double-check လုပ်ပါ။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Key Pair ကို launch ချိန် download လုပ်ဖို့ မေ့ခြင်း — key pair ကို တစ်ကြိမ်ပဲ download လို့ရပြီး, ပျောက်သွားရင် instance ထဲ SSH ဝင်လို့ မရနိုင်တော့ပါ
  • Security Group ကို SSH port ၂၂ ကို 'anywhere' (0.0.0.0/0) ဖွင့်ချထားခြင်း — ကိုယ့် IP address ကနေပဲ ဝင်ခွင့်ပြုသင့်ပါတယ်

အခု ကိုယ်တိုင် စမ်းကြည့်

AWS Console (ဒါမှမဟုတ် CLI) ကနေ t2.micro EC2 instance တစ်လုံး launch လုပ်ကြည့်ပါ — SSH ချိတ်ဆက်ကြည့်ပြီး, practice ပြီးရင် instance ကို terminate (ဖျက်) ကြည့်ပါ (cost ကာကွယ်ဖို့)။

You'll know it worked when: $ aws ec2 describe-instances --query 'Reservations[].Instances[].State.Name' ["running"]

ပထမဆုံး EC2 Instance | Thuta Learning