AWS User Group Myanmar
  • AWS User Group Myanmar
  • AWS User Group Myanmar Events History
  • AWS User Group Myanmar Upcoming Events
  • Call for Meetup Speakers
  • FAQ
  • Fundamental
    • AWS Global Infrastructure
    • A brief History of AWS
    • Cloud Computing 101
  • Compute
    • Elastic Compute Cloud (or) EC2 - Episode (1)
    • Reduce cloud compute cost with EC2 Spot Instance
    • Deploying Wordpress Website with Amazon Lightsail
    • Feel the power of Auto Scaling and Spot Instances with auto assign EIP
  • Tutorials
    • Gain free, hands-on experience with the AWS platform, products, and services
    • Using AWS Systems Manager to login EC2 instance without SSH
    • Managing private EC2 instance with Bastion Host
    • How to complete setup Kubernetes Cluster on AWS using Kops
    • Amazon EKS Cluster Provisioning
    • Infrastructure as Code with AWS CodePipeline
    • Using AWS Lambda to monitor websites
  • Internet of Things
    • IoT Rules Engine
  • Storage
    • S3 Encryption အကြောင်း တစေ့တစောင်း
    • Cloud Object Storage (aka) Amazon Simple storage service (S3)
  • Cost and Billing
    • Cost Optimization on AWS Cloud - Part 1
    • Cost Optimization on AWS Cloud - Part 2
    • Optimizing cost with AWS Graviton-based services
  • Database
    • DynamoDB - Fast and Flexible NoSQL Managed Service -Part 1
  • Security, Identity, & Compliance
  • Learn From Home
    • AWS Essentials
  • Import
Powered by GitBook
On this page

Was this helpful?

  1. Tutorials

Using AWS Systems Manager to login EC2 instance without SSH

PreviousGain free, hands-on experience with the AWS platform, products, and servicesNextManaging private EC2 instance with Bastion Host

Last updated 5 years ago

Was this helpful?

AWS Ec2 instance တစ်လုံး စဆောက်လိုက်ပီးတာနဲ.အဓိကပထမဆုံးလုပ်တာက ဆောက်ထားတဲ့ instance ထဲLogin ဝင်ပီး Manage လုပ်တာပါပဲ။ ဆိုတော့ Login ဝင်မယ်ဆို အဓိက Windows ဆို RDP Protocol , Linux ဆို SSH နဲ့ဝင်ကြရပါတယ်။ခုtutorialလေးက Linux instance ကို လုပ်ပြမှာဆိုတော့ SSH ပေါ့။

AWS Ec2 Linux instance တစ်လုံးကို စတင်ဝင်ရောက်ဖို.ဆိုရင် 1. Pem Key (Private Key) တစ်ခု 2. AWS Security Group ကနေ SSH Port 22 ကို Allow လုပ်ပေးဖို.လိုအပ်ပါတယ်။

ခုလုပ်ပြမှာလေးက AWS Ec2 instance တစ်လုံးကို Login ဝင်တဲ့အခါ SSH မလိုပဲ AWS ရဲ့ Service တစ်ခုဖြစ်တဲ့ Systems Manager, Session Manager ကနေ Login ဝင်တဲ့ နည်းလမ်းလေးဖြစ်ပါတယ်။SSH မသုံးပဲ ဘာလို. AWS Systems Manager, Session Manager ကိုသုံးလဲ မေးစရာရှိလာပါတယ် ဘာလိုု.သုံးလဲ ဘာကြောင့်လဲဆိုရင် အဓိက အားဖြင့် ကျနော်အမြင်အရကော Blogs တွေမှာပြောထားတာက -

  • SSH bastion Host မလိုတော့ဘူး။ (စျေးသက်သာတာပေါ့နော်)

  • SSH Key မလိုတော့ဘူး။

  • No need to allow SSH in AWS Security Group (AWS Security Group မှာ SSH Allow ဖို.မလိုတော့ဘူး)(အဲ့တာလေးတော့ကြိုက်တယ်)

  • နောက်ဆုံးတစ်ခုကတော့ Logs တွေကို AWS Cloudwatch Log groups ကနေ Default ကြည့်လို.ရတာပါပဲ။

အိုကေ စကြည့်လိုက်ရအောင် ...

ပထမဆုံးဘာမှ မစခင် ကျနော်တို. Systems Manager, Session Manager တွက် IAM Ec2 Role တစ်ခုဆောက်ပေးဖို.လိုပါတယ် (Systems Manager ကနေ instance ကို access ရဖို.တွက်)

ကျနော်တို.အောက်ကပုံမှာပြထားတဲ့အတိုင်း IAM Console ကနေ Role တစ်ခု create လုပ်ပါမယ်။

ထို.နောက် IAM Role Create လုပ်ပီးပီ ဆိုတာနဲ့ ကျနော်တို. Ec2 instance ဆောက်ကြရအောင်.မဆောက်ခင် Ec2 Linux Instance မှာ SSM Agent Install လုပ်ထားဖို.လိုပါတယ်.Amazon Linux AMI တွေမှာ တော့ Default install လုပ်ပြီးသားပါ တခြား Linux AMI တွေမှာ တော့ သွင်းပေးရပါမယ်.အောက်မှာဖော်ပြထားတဲ့ link မှာကြည့်ရှုနိုင်ပါတယ်။

အခုကျွန်တော်က Amazon Linux AMI နဲ့ဆောက်ပြမှာဆိုတော့ ssm agent က default သွင်းပြီးသားပါလာပါလိမ့်မယ်။

ကျွန်တော်တို. IAM Role နေရာမှာခုနက create လုပ်ထားတဲ့ Role ကိုရွေးချယ်ပေးရပါမယ်။

ထို.နောက်အပေါ်မှာ ပြောထားသလို Security Group မှာ ဘာကိုမှ Allow မလုပ်ထားပါဘူး..SSH Key Pair နေရာမှာလဲ ဘာ Key မှ မထည့်ထားပါဘူး။

နောက်ဆုံးကျနော်တို. Ec2 instance တစ်ခုကို အောင်မြင်စွာဆောက်လို.ရပါပီဗျာ။

ထို.နောက် ကျွန်တော်တို. AWS Systems Manager ကိုသွားပါမယ်။ကျနော်တို.Ec2 instance ပေါ်နေပီလားသိရအောင် ...

Instance ကို မြင်နေရပါပီဗျာ ...

အိုကေ ကျနော်တို. Session open ပီး instance ထဲ Login ကြည့်ကြရအောင် ...

Systems Manager ကနေဝင်လို.ရပါတယ်။ဘာ Pem Key မှမလိုသလို ဘာ Security Group မှာမှ Allow ပေးထားစရာမလိုပါဘူး။ဆိုတော့ကျွန်တော်တို.လုပ်တာ အကုန်မှန်တယ်ပေါ့.. ဒါပေမဲ့ ကျနော်တို.နောက်ဆုံးအနေနဲ့ Logs လုပ်ကြည့်ဖို.လိုပါသေးတယ် AWS CloudWatch ကနေကျွန်တော်ကတော့ ဘာတွေလုပ်သွားလည်းသိဖို.တွက် Logs ကိုလုပ်တာပါ။

Logs တွေကိုထုတ်မယ်ဆို ကျွန်တော်တို. AWS Cloudwatch ကို သွားပါမယ်။ CloudWatch Console ကိုရောက်ရင် log groups မှာ လိုချင်တဲ့ နာမည်နဲ့ log group တစ်ခုကို create လုပ်ပါမယ်။ကျွန်တော်ကတော့ SSM-Logs ဆိုပီး နာမည်နဲ့တစ်ခုဆောက်လိုက်ပါမယ်။

ထို.နောက် Systems Manager Console ကိုပြန်သွားပီး Log group ကို Setting ချပါမယ်။

အထက်ပါပုံအတိုင်း setting ချပီးရင် Save မှတ်ပါမယ်။နောက်ဆုံးအနေနဲ့ Session Login ပြန်ဝင်ပီး Linux မှာ Yum Update နဲ့ တခြား action လုပ်ကြည့်ကြရအောင်..

ပထမဆုံးအနေနဲ့ ကျွန်တော်တို. Yum Update နဲ. Stress Application လေးကိုသွင့်ကြည့်ရအောင်

ဘာညာနည်းနည်းပါးပါ လျောက် Run ကြည့်မယ်။

ထို.နောက် AWS Cloudwatch Log မှာပေါ်ဖို.စောင့်ရပါလိမ့်မယ်။ချက်ချင်းကြီးတော့မရောက်သေးပါဘူး ခဏတော့စောင့်ပေးရပါတယ်။

ငါးမိနစ်လောက်စောင့်လိုက်ရင် log တွေ Cloudwatch log group ထဲဝင်လာပီး Session event logs များကိုုကြည့်လို.ရပါပီ။

နိဂုံးချုပ်ရမယ်ဆိုရင်တော့ဖြင့် မိမိ Ec2 Instance ကို SSH နဲ့သာမက AWS Systems Manager ရဲ့ Session Manager နဲ့လဲ access and management လုပ်နိုင်ပါတယ်၊တစ်ခုနဲ့တစ်ခုမတူတာလေးတွေ အားသာချက်အားနည်းချက်လေးတွေလိုက်ပီး ကိုယ့် usecase အပေါ်မူတည်ပြီးအသုံးပြုနိုင်ပါတယ်။ အခု tutorial လေးကိုနောက်နေ့မှာ ကျွန်တော်တို. Video Record လေးနဲ့ လုပ်နည်းလေးတင်ပေးပါဦးမယ်။

လေးစားလျက်

https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-install-ssm-agent.html
AWS User Group Myanmar