ကျွန်တော် sharing လုပ်ချင်တာက Amazon Web Service ကို Python Programming Language သုံးပြီး ဘယ်လို Automate လုပ်ရမလဲကို sharing လုပ်ချင်ပါတယ်.
အရင်ဆုံး ကျွန်တော်တို့ High Level Design ကို အရင်ကြည့်ရအောင်.
*Prerequisites*
- AWS Root Account or IAM Account
- AWS Programmatic Access ( access key and secret access key id )
- Linux, Mac, or WSL Terminal ( Bash or Z Shell )
- AWS CLI V2
- Configure AWS Programmatic Access
- Python SDK for AWS ( botocore, boto3 )
- Microsoft VSCode or Other IDE
- Python Sample Script For AWS
*AWS Root Account or IAM Account*
အရင်ဆုံး ကျွန်တော်တို့ AWS Root Account or IAM Account တစ်ခု create လုပ်ပါ.
IAM Account ကို Admin Policy attach လုပ်ပါ.
*AWS Programmatic Access*
ကျွန်တော်တို့ access key & secret access key id ကို Download ယူထားပါ.
*Linux,Mac or WSL Terminal*
ကျွန်တော်က ubuntu 20.04 နဲ့ Z Shell ကို သုံးထားပါတယ်. Bash Shell သုံးလဲအဆင်ပြေပါတယ်.
*AWS CLI V2*
AWS CLI V2 ကို အောက်ပါ links များက install လုပ်ပါ.
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
*Configure AWS Programmatic Access*
aws configure command ကိုသုံးပြီး AWS Programmatic Access အတွက် access key & secret access key id ကိုထည့်ပါ.
# aws configure
# aws sts get-caller-identity
aws sts get-caller-identity ကိုသုံးပြီး AWS Programmatic Access ကို Test လုပ်ပါ.
*Python SDK for AWS ( botocore, boto3 )*
AWS ကို Automate လုပ်ဖို့ လိုအပ်တဲ့ Python SDK ကို Install လုပ်ပါ. pip ကို သုံးပြီး install လုပ်ပါ.
% sudo apt install python3-pip
% pip3 install botocore boto3
% pip3 list | grep -i 'boto'
boto3 version 1.15 ရှိဖို့ လိုအပ်ပါတယ်.
botocore က AWS CLI နဲ့ Low Level Access လုပ်ဖိုလိုအပ်ပါတယ်. တစ်ကယ်လို့ pip dependency error ဖြစ်ရင် boto ကိုပါ install လုပ်ပါ.
% pip3 install boto
*Microsoft VSCode or Other IDE*
Python Script File ရေးဖို့နဲ့ github ပေါ်တင်ထားတဲ့ project တွေကို manage လုပ်ဖို့ ပါ. ကိုယ်ကြိုက်ရာ IDE ကိုသုံးပါ.
MS VSCode မှာ Python Extension ကို Install လုပ်ပါ.
*Python Sample Script For AWS*
AWS ကို Python SDK သုံးပြီး Automate လုပ်ဖို့ အဆင်ပြေပါပြီး.
Python ကို Interactive နဲ့ အရင်စမ်းကြည့်ပါ.
Script File အနေနဲ့ Run ကြည့်ပါ.
*Python Script Sample File*
boto3 docs links
https://boto3.amazonaws.com/v1/documentation/api/latest/index.html
Python ကို ဆက်လေ့လာလိုလျှင်.
“Thanks For Your Time, Mate”