ããã«ã¡ã¯ã2022å¹´7æãããµã¼ãã¼ã¯ã¼ã¯ã¹ã«ã¸ã§ã¤ã³ãã¾ããIE課ã®å°è
ã§ãã
IE課ã¯Internal Education課ã®ç¥ç§°ã§2022å¹´3æã«æ°è¨ãããä¸éæ¡ç¨ã§å
¥ç¤¾ããæ¹åãã®é¤ææã«ãªã£ã¦ãã¦ç§ããã®èª²ã®ç¬¬ä¸å·ãããã§ãã
å½ç¤¾ã¯å ¨å½ã©ãã«ä½ãã§ãã¦ãä»äºãã§ããã¨ãããã¨ããããã£ãããªã®ã§å ¥ç¤¾ã®ã¿ã¤ãã³ã°ã§æ±äº¬ããå°å å®®åã«ç§»ä½ãã¾ããã
åè·ã§ã¯ãã¼ã¿åæåºç¤ãAWSã®ããã¼ã¸ããµã¼ãã¹ã使ã£ã¦éçºãã¦ã¾ããã å½æã¯CloudFormationããã«ã«æ´»ç¨ãã¦æ§ç¯ãã¦ãããä»åã®ãã¼ãã§ãããStepfunctionsãã³ã¼ããAWS CLIã§ã®éçºã主ã§ããã
Stepfunctions workflow studioãªã便å©ãããªæ©è½ã追å ããã¦ããã®ã¯ç¥ã£ã¦ãã¾ããã触ã£ããã¨ããªããéçºã«ããã¦GUIã¨ã¯ã»ã¼ç¡ç¸ãªæè¡è ã®æ¹ãããã£ãããã¨æãã¾ãã®ã§æ¬æ¥ã¯ãã¡ãã触ã£ã¦ããããã¨æãã¾ãã
Stepfunctions workflow studioã£ã¦ãªã«ï¼
Step Functions ã¯ãAWS Lambda é¢æ°ããã³ãã®ä»ã®ãã¸ãã¹ã¯ãªãã£ã«ã«ãªã¢ããªã±ã¼ã·ã§ã³ãæ§ç¯ããããã® AWS ã®ãµã¼ãã¹ãçµã¿åããããã¨ãã§ãããµã¼ãã¼ã¬ã¹ãªã¼ã±ã¹ãã¬ã¼ã·ã§ã³ãµã¼ãã¹ã§ãã
AWS Step Functions ã¨ã¯? - AWS Step Functions
Stepfunctionsã¯ä¸»ã«ETLå¦çãæ©æ¢°å¦ç¿ã®ã¯ã¼ã¯ããã¼ãªã©ã«å©ç¨ããããã¨ãå¤ãã§ãã
ãã®Stepfunctionsã«ããã¦ã¯ã¼ã¯ããã¼ãæ§ç¯ããéã«ãè¦è¦åãã¦ãã¤çæéã§ã¯ã¼ã¯ããã¼ãä½æã§ããæ©è½ãStepfunctions workflow studioã«ãªãã¾ããå¾æ¥ã§ã¯Amazon State Languageãå¦ç¿ããå¿
è¦ãããã¾ããããã¼ã³ã¼ãã§æ§ç¯å¯è½ãªã®ã§éçºã®ãã¼ãã«ãããªãä½ããªã£ãã¨æãã¾ãã
ãã詳ãã詳細ã«ã¤ãã¾ãã¦ã¯ä»¥ä¸å
¬å¼ããã°ãåç
§ãã ããã
æ°æ©è½ â AWS Step Functions ã¯ã¼ã¯ããã¼ã¹ã¿ã¸ãª â ã¹ãã¼ããã·ã³ãæ§ç¯ããããã®ãã¼ã³ã¼ãã®ãã¸ã¥ã¢ã«ãã¼ã« | Amazon Web Services ããã°
è¨å®
ãã£ããã¹ãã¼ããã·ã³ãä½æãã¦ããã¾ãã
æ°è¦ã¨ä»ãã¦ã¾ããããã¯ã¼ã¯ããã¼ãè¦è¦çã«è¨è¨ããé¸æã
ã¿ã¤ãã¯ä»åã¯ãæ¨æºããé¸æã
workflowã®è¨è¨ã®ç»é¢ã«ãªãã¾ããã
å·¦å´ãã¹ã¯ãã¼ã«ããã¨ããããªAWSã®ãµã¼ãã¹ãã§ã¦ãã¾ãã
ä»åã¯ãAthenaã§ã¯ã¨ãªãå®è¡ããçµæãcsvå½¢å¼ã§S3ã«åºåãããã®ã§Lambdaã§tsvå½¢å¼ã«å¤æãã¦S3ã«æ ¼ç´ããã¯ã¼ã¯ããã¼ãä½æãã¦ã¿ã¾ãã
ãã£ã¦ã¯ã¼ã¯ããã¼ä¸ã§ä½¿ç¨ããAWSãµã¼ãã¹ã¯ãAthenaã¨Lambdaã«ãªãã¾ãã
â»ä»åã®æ¤è¨¼ã§ã¯ã極ãã¦å°ããªãã¼ã¿ãæ±ãããLambdaã§ã®ãã¼ã¿å¦çãæ¡ç¨ãã¾ããã
â»äºåæºåã¨ãã¦ãã¯ã¨ãªãå®è¡ããã¾ã§ã®ãã¼ãã«ç¨æãLambdaã®é¢æ°ã®ç¨æãããã¾ããæ¬ç¨¿ã§ã¯å²æããã¦ããã ãã¾ãã
ç»é¢å·¦ä¸ã«ããæ¤ç´¢ããã¯ã¹ã«ãAthenaãã¨å
¥åãã¦ãStartQueryExecutionãããã©ãã°ï¼ãããããã¾ãã
Stepfunctionsã«Athenaãçµ±åãããåã¯ãLambdaã§ãã¾ãå
·åã«å®è£
ãã¦ããã®ã§é常ã«ä¾¿å©ã«ãªãã¾ãããã
次ã«ã¹ãã¼ããã·ã³å®è¡æã«ä»»æã®SQLã®å
¥åãåãä»ããã©ã®S3ã®ãã±ã¼ã·ã§ã³ã«åºåãããããè¨å®ããå¿
è¦ãããã®ã§ç»é¢å³å´ã®è¨å®ã¿ãã®APIãã©ã¡ã¼ã¿ãä¿®æ£ãã¾ãã
å ãã¦ãã¿ã¹ã¯ãå®äºããã¾ã§å¾
æ© - çç¥å¯è½ãã«ãã§ãã¯ãå
¥ãããã¨ã§ã¯ã¨ãªãå®äºããã¾ã§å¾
æ©ããããã«ãã¾ããããã«ãã§ãã¯ããªãã¨éåæå®è¡ã«ãªãã®ã§ã¯ã¨ãªã®å®äºãå¾
æ©ãã次ã®å¦çã«é²ã¿ã¾ãã
{ "QueryString.$": "$.sql", "WorkGroup": "primary", "ResultConfiguration": { "OutputLocation": "s3://<ãã±ããå>/<ä»»æã®ãã¼>" } }
次ã«Lambdaãé
ç½®ãã¾ããç»é¢å·¦ä¸ã®æ¤ç´¢ããã¯ã¹ã§ãªã«ãå
¥åããªãã¨äººæ°ã®é«ãé ã§5ã¤AWSã®ãµã¼ãã¹ã®ã¢ã¯ã·ã§ã³ã表示ããã¾ãã
ä¸çªä¸ã«ãAWS Lambda Invokeãã¨ããã®ã§ãã¡ããç»é¢ã®éãAthenaã®å¾ç¶å¦çã¨ãªãä½ç½®ã«ãã©ãã°ï¼ãããããã¾ãã
ç»é¢å³å´ã®è¨å®ã¿ãã®APIãã©ã¡ã¼ã¿ã®Function nameã§ä»åå®è¡ããLambdaé¢æ°ãé¸æãã¾ãããã®ä»ã¯ããã©ã«ãã®ã¾ã¾ã§ãã
ãã®Lambdaã®å¦çã§ã¯ãå段ã«å®è¡ããã¯ã¨ãªIDãå¿
è¦ã¨ãªãã¾ãã®ã§å
¥åã¿ãã§ãInputPathã§å
¥åããã£ã«ã¿ãªã³ã° - çç¥å¯è½ãã«ãã§ãã¯ãå
¥ããå¾ã次ã®å¦çã«æ¸¡ããããã«çµãè¾¼ã¿ã¾ãã
ããã§ã®è¨å®ã¯å®äºãªã®ã§ç»é¢å³ä¸ã®ã次ã¸ããã¯ãªãã¯ã
ãã®ç»é¢ã§ã¯workflow studioã«ããçæãããã³ã¼ãã®ç¢ºèªã«ãªãã¾ããããã§ãã³ã¼ãã§è¨å®ã®è¿½å /ä¿®æ£ãå¯è½ã§ããä»åã¯ãã®ã¾ã¾ã次ã¸ããã¯ãªãã¯ã
ã¹ãã¼ããã·ã³åã¯ä»åã¯ããããããããã«ãathena-result-convert-csv-to-tsvãã¨ãã¾ãã
ã¢ã¯ã»ã¹è¨±å¯ã§ãã®ã¹ãã¼ããã·ã³ã®å®è¡ãã¼ã«ãå®ç¾©ãã¾ãããä»åã¯ãæ°ãããã¼ã«ã®ä½æãã¨ãã¾ããè¨å®è©³ç´°ã«åºã¥ãã¦ãå¿
è¦ãªæ¨©éãç¨æãã¦ããã¾ãã
ãã以å¤ã¯ããã©ã«ãã®ã¾ã¾ã§ãã¼ã¸æä¸é¨ã®ãã¹ãã¼ããã·ã³ã®ä½æããã¯ãªãã¯ã
å®è¡
ã¹ãã¼ããã·ã³ãæ£å¸¸ã«ä½æãããã®ã§æ©éãå®è¡ã®éå§ãããå®è¡ãã¦ã¿ã¾ãã
äºåã«å®ç¾©ããéãã«SQLãå
¥åãããå®è¡ã®éå§ããã¯ãªãã¯ã
å®è¡ä¸ã«ãªãã¾ããã
ç¡äºæåãã¾ãããtsvå½¢å¼ã®ãªãã¸ã§ã¯ããç¡äºçæããã¦ã¾ããã
ãããã«
è¦è¦çã«ã¯ã¼ã¯ããã¼ãä½æã§ããã®ã¯é常ã«ããããããã¦ä¾¿å©ã ãªã¨æãã¾ããã Stepfunctionsåå¿è ã®æ¹ããããã使ããããµã¯ãã¨ç¢ºèªãããï¼ãã¨ããçµé¨è ã®æ¹ã¾ã§ã·ã¹ãã éçºæ¥åã®å©ãã«ãªãã¨æãã¾ãã
ç§ã®ããã«åå¨ã¯ç¥ã£ã¦ãããã©ããªæãã ããã¨æã£ã¦ããæ¹ã«ããã®è¨äºãå°ãã§ãåèã«ãªãã°å¹¸ãã§ãã
å°è 信幸(å·çè¨äºã®ä¸è¦§)
ä»å°å¨ä½/ãµã¦ãããããªãæããã¨ã³ã¸ãã¢
2024 Japan AWS All Certifications Engineers