AWS IaC/CaC with Ansible

ကျွန်တော်ဒီနေ့ sharing လုပ်ချင်တာက AWS ပေါ်မှာ Infrastructure as Code (IaC) & Configuration as Code (CAC) practice ကိုဘယ်လို့ Implement လုပ်မလဲကို sharing လုပ်ချင်ပါတယ်.

အရင်ဆုံး ကျွန်တော်တို့ High Level Design (HLD) ကိုကြည့်ရအောင်.

*Prerequisite*

  • AWS Root Account or IAM Account with ( Admin Policy )
  • AWS Programmatic Access (access key and secret access key id )
  • AWS CLI V2
  • Linux, Mac, or WSL Terminal ( Bash or Z Shell )
  • Microsoft VSCode
  • Python Library for AWS ( boto, boto3 )
  • Ansible Packages ( must be installed on Linux, Mac, or WSL )

*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

aws configure command ကိုသုံးပြီး AWS Programmatic Access အတွက် access key & secret access key id ကိုထည့်ပါ.

aws sts get-caller-identity ကိုသုံးပြီး AWS Programmatic Access ကို Test လုပ်ပါ.

*Python Library For AWS*

AWS အတွက်လိုအပ်တဲ python Library တွေကို pip နဲ့ install လုပ်လို့ ရပါတယ်.

>sudo apt install python3-pip

>pip3 install boto boto3 botocore

>pip3 install awscli

>pip3 install ansible

# ansible ကို pip3 နဲ့ install မလုပ်ချင်ရင် apt နဲ့ install လုပ်လို့ရပါတယ်.

> sudo apt install ansible

ကျွန်တော်က ansible version 2.10.2 ကိုသုံးထားပါတယ်.

ကျွန်တော်တို့ ansible sample playbook တစ်ခုကို run ကြည့်ရအောင်.

Ansible sample playbook

ansible ကိုဆက်လက်လေ့လာလိုလျှင်

https://www.ansiblefordevops.com/

“Thanks for your time, mate”

Leave a Reply

Your email address will not be published. Required fields are marked *