Tech Talk
by Engineers of Acroquest Myanmar Technology
Build workflow quickly with AWS Step Functions
Go to English summary >>
အားလုံးပဲ မင်္ဂလာပါ။
ကျွန်မနာမည်ကတော့ နှင်းနှင်းတိုးပါ။ Acroquest Myanmar Technologyမှာ Senior Software Engineerတစ်ယောက်အနေနဲ့ အလုပ်လုပ်ကိုင်နေပါတယ်။ ကျွန်မ အခု AWSရဲ့ service တစ်ခုဖြစ်တဲ့ Step Functionsအကြောင်းကို ကျွန်မရဲ့ အတွေ့အကြုံပေါ်မူတည်ပြီး ပြောပြပေးမှာဖြစ်ပါတယ်။

ပထမဆုံး Step Functions ဆိုတာ ဘာလဲ?
Step Functionsဆိုတာက AWSရဲ့ serviceတစ်ခုဖြစ်ပါတယ်။ Lambda functionsတွေအများကြီးကို ချိတ်ဆက်ပေးပြီး systemတစ်ခုကို ပြုလုပ်ပေးတယ်။ ပုံမှန်အားဖြင့် Lambda functionတစ်ခုကနေ အခြားတစ်ခုကိုခေါ်မယ်ဆိုရင် codingထဲမှာ ခေါ်ချင်တဲ့ function name ဒါမှမဟုတ် တစ်ခြား လိုအပ်တာတွေ ရေးဖို့လိုလာတယ်။ အဲ့အတွက်ကြောင့် တစ်ခုနဲ့တစ်ခု ချိတ်ဆက်ချင်ပြီဆိုရင် functionကိုပြင်ဖို့လိုလာတယ်။ ဒါပေမယ့် Step Functionsကိုသာသုံးမယ်ဆိုရင် အဲ့တာတွေလုပ်ဖို့ မလိုအပ်တော့ပဲ အလွယ်တကူ ချိတ်ဆက်နိုင်တယ်။
https://aws.amazon.com/step-functions/
အခုဆိုရင် Step Functionsအကြောင်းလေးသိသွားလောက်ပြီထင်ပါတယ်။ နောက်တစ်ခုကတော့ Step Functionsသုံးပြီး ဘာအကျိုးကျေးဇူးတွေရနိုင်မလဲ?
အဓိက ဇယားမှာပြထားတဲ့ အကျိုးကျေးဇူးသုံးခုရနိုင်ပါတယ်။
Benefits Summary Appsတွေကို လွယ်ကူလျင်မြန်စွာတည်ဆောက်ခြင်း Resiliencyကောင်းမွန်ခြင်း Code နည်းနည်းသာရေးရခြင်း
Step functionsဟာဆိုရင် တစ်ခြား Serverless workflow တွေနဲ့ယှဉ်ရင် application တွေကို မြန်မြန် တည်ဆောက်နိုင်ပြီး Business flowအရ လိုအပ်သလို applicationကို updateလုပ်ပေးနိုင်တယ်။ ပြီးတော့ လိုအပ်တဲ့ orderအတိုင်း executeလုပ်နိုင်ဖို့ state တွေကိုလည်း manageလုပ်ပေးနိုင်တယ်။
အဲ့တာကြောင့် စိုက်ပျိုးရေးအတွက်ထုတ်လုပ်ခဲ့တဲ့ ကျွန်မတို့ရဲ့ projectမှာလည်း အသုံးပြုခဲ့တယ်။ ကျွန်မတို့ projectမှာ ရိတ်သိမ်းနှုန်းတွေကို ခန့်မှန်းပေးတဲ့functionပါ၀င်ပါတယ်။ အဲ့မှာဆိုရင် dataတွေကို manipulateလုပ်နိုင်ဖို့ အမျိုးမျိုးသော pre-processingတွေလုပ်ရပါတယ်။ အဲ့ဒီ pre-processingအတွက် ချုံ့ထားတဲ့flowတည်ဆောက်ဖို့လိုလာပါတယ်။ အဲ့အတွက်ကြောင့် Step Functionsက အကောင်းဆုံးသော toolတစ်ခုဖြစ်လာပါတယ်။
အခုဆိုရင် ကျွန်မတို့ရဲ့ Business use case လေးကိုလည်းသိရပြီဆိုတော့ နောက်ဆုံးအနေနဲ့ လွယ်ကူရိုးရှင်းတဲ့ state machine(workflow)လေး လုပ်ကြည့်ရအောင်။
မစခင် လိုအပ်တဲ့ အရာလေးတွေကတော့
- AWS account
- IAM user and group
- Access key for IAM user
လိုတာတွေပြင်ပြီးရင် စလိုက်ကြရအောင်။
၁၊ Step Functions consoleကို accessလုပ်ပါ။
https://console.aws.amazon.com/states/home?region=us-east-1#/statemachines
၂၊ ပုံမှာပြထားသလို state machine အသစ်ပြုလုပ်ပါ။ သိထားရမှာကတော့ workflowက Amazon State Languageကိုသုံးပြီးရေးပါတယ်။
Amazon State Languageဆိုတာက J-SONကိုအခြေခံထားတဲ့ structured languageဖြစ်ပြီး state machineကို ဖော်ပြဖို့ အသုံးပြုပါတယ်။


ဒီstate machineမှာဆိုရင် “Hello” နဲ့ “world” ဆိုတဲ့ stateနှစ်ခုရှိပြီး “Type”အနေနဲ့လည်း”Pass” ကိုသာ သုံးထားပါတယ်။ ဆိုလိုချင်တာက stateတစ်ခုကနေ တစ်ခုကိုသွားမယ်။

ဒီဥပမာက ရိုးရှင်းတဲ့ state machine(workflow) လေးဖြစ်ပါတယ်။ Step Functionsအကြောင်း ပိုသိချင်တယ် tutorialတွေ၊ sample projectတွေလုပ်ချင်တယ်ဆို အောက်မှာပြထားတဲ့ linkတွေကနေ လေ့လာနိုင်ပါတယ်။
- https://docs.aws.amazon.com/step-functions/latest/dg/tutorials.html
- https://docs.aws.amazon.com/step-functions/latest/dg/create-sample-projects.html
စာဖတ်သူတို့လည်း ကိုယ့်projectရဲ့ လိုအပ်ချက်ပေါ်မူတည်ပြီး ပြန်အသုံးချနိုင်မယ်လို့ မျှော်လင့်ပါတယ်။ နောက်လာမယ့်sharing တွေအတွက်လည်း STAY TUNEDပါ။ ^^)
[ English Summary ]
Hello, everyone. I am Hnin Hnin Toe. I am working as the Senior Software Engineer in Acroquest Myanmar Technology. Now, I would like to share about AWS Step Functions based on my experience.
Step Functions is an AWS service that allows you to easily connect multiple Lambda functions to create a single system. Normally, when calling another function from a Lambda function, it was necessary to write the function name in the code or insert some action. When you want to connect, you need to modify the function. With AWS Step Functions, you don’t have to. https://aws.amazon.com/step-functions/
There are three main benefits of AWS Step Functions
Benefits | Summary |
Build and update apps quickly |
|
Improve resilience |
|
Write less code |
|
By comparing with other Serverless workflows, we can build more quickly and update the apps according to our required Business flow. And also it can manages state and execute according to our required order.
I hope you can also apply in your project according to the requirements. STAY TUNED for future post ^^)
★★★We are hiring the staff who are interested in latest technologies.★★★
If you are interested in our company, please see the available job descriptions in the following links.
Senior Frontend/ Backend Developer : https://www.acromyanmar.com/senior-frontend-backend-developer/