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

AWS CLI Basics

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

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

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

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

AWS Console က browser-based UI ပါ — visual ကြည့်ရလွယ်ပေမယ့် repetitive task (server ၁၀ ခု create) အတွက် manual click ခက်ခဲပါတယ်။ AWS CLI ကို install/configure ပြီးရင် `aws <service> <command>` ဆိုတဲ့ pattern နဲ့ command line ကနေ AWS resource ကို manage လုပ်လို့ရပါတယ် — script ထဲ ထည့်ရေးပြီး automate လုပ်လို့ရပါတယ်။ `aws configure` command ကို run ရင် Access Key ID, Secret Access Key, default Region, output format ကို setup လုပ်ရပါတယ် (IAM User ကနေ ရရှိထားတဲ့ credential).

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

`aws s3 ls` run ရင် account ထဲက S3 bucket အားလုံးကို list ပြပေးပါတယ် — Console ဖွင့်ပြီး click ချစရာ မလိုတော့ပါ။ Terraform (တခြား tutorial) ကလည်း background မှာ AWS CLI/SDK ကို အသုံးပြုပြီး AWS API ကို ခေါ်တာပါ — CLI ကို ကိုယ်တိုင် ရင်းနှီးထားရင် Terraform ရဲ့ error message တွေကိုပါ ပိုနားလည်ပါလိမ့်မယ်.

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

bash
# Configure the CLI with your IAM user's credentials
aws configure

# List S3 buckets
aws s3 ls

# List EC2 instances
aws ec2 describe-instances

# Check which identity the CLI is using
aws sts get-caller-identity
You should see
$ aws sts get-caller-identity
{
    "UserId": "AIDAEXAMPLE123",
    "Account": "123456789012",
    "Arn": "arn:aws:iam::123456789012:user/developer-1"
}

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

AWS CLI ကို install လုပ်ပြီး `aws configure` run ကာ IAM User credential ဖြင့် setup ကြည့်ပါ — `aws sts get-caller-identity` run ပြီး correct identity ဖြစ်နေတာ confirm လုပ်ကြည့်ပါ။

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

`~/.aws/credentials` file ထဲမှာ access key ရှိနေတာကို သတိထားပါ — laptop shared/public ဖြစ်နေရင် ဒီ file ကို access ခံနိုင်ပါတယ်, disk encryption ကို ဖွင့်ထားသင့်ပါတယ်။

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

  • Root User access key ကို CLI ထဲ configure လုပ်ခြင်း — IAM User (least privilege) ကိုသာ သုံးသင့်ပါတယ်
  • `aws configure` credential ကို team member အများနဲ့ share ခြင်း — user တစ်ယောက်ချင်းစီအတွက် IAM User သီးသန့် ရှိသင့်ပါတယ်

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

AWS CLI ကို install လုပ်ပြီး `aws configure` run ကာ IAM User credential ဖြင့် setup ကြည့်ပါ — `aws sts get-caller-identity` run ပြီး correct identity ဖြစ်နေတာ confirm လုပ်ကြည့်ပါ။

You'll know it worked when: $ aws sts get-caller-identity { "UserId": "AIDAEXAMPLE123", "Account": "123456789012", "Arn": "arn:aws:iam::123456789012:user/developer-1" }

AWS CLI Basics | Thuta Learning