aws-lambda-perl5-layer æ¸ãã
[2018-12-05 追è¨]
ãã«ãæ¸ã¿ã®Layerãå
¬éãã¾ããã®ã§ï¼ãã¡ãã使ãã¨ä¾¿å©ã§ãï¼
See also: http://moznion.hatenablog.jp/entry/2018/12/05/211523
[追è¨ããã¾ã§]
å æ¥ã®re:Inventã§Custom AWS Lambda Runtimesãçºè¡¨ãã*1ï¼ããã¯ã¤ã¾ãä»»æã®è¨èªã§AWS Lambdaãå®è¡ãããã¨ãå¯è½ã¨ããæ©è½ãªãã§ããï¼ã¨ãããã¨ã¯Perl5ãåãã¨ãããã¨ã§ãã¦ï¼ããªãã¡åãã¨å¬ããã¯ãï¼ãããã£ã¦åããããã®Layerãæ¸ããã¨ãã話ã§ãï¼
ãã®å ´åã®Layerã¨ããã®ã¯Perl5ãåããããã®åºç¤ã ã¨æã£ã¦ãã ããï¼åºæ¬çã«ã¯bootstrapãå®éã«ããããåã£ã¦perlã®é¢æ°ãå®è¡ããã¨ããæãã«ãªã£ã¦ããã¾ãï¼
ã©ã®ããã«ãã¦åãã¦ãããã¯å
¬å¼ã®Tutorialã詳ããã®ã§åèãããã: https://docs.aws.amazon.com/lambda/latest/dg/runtimes-walkthrough.html
ãã¦å®éãã£ã¦ã¿ãææ³ã¨ãã¦ã¯bootstrapãæ¸ãã®ã¯é常ã«ç°¡åã§ï¼ãã£ããæåã説æããã¨Over HTTPã§Lambdaã®ã¤ãã³ããåã£ã¦ãã¦ãã®å 容ã«å¾ã£ã¦é¢æ°ãå®è¡ãã¦ï¼çµæãPOST backããã¨ããé常ã«ç´ æ´ãªæãã§ãï¼ã©ããªè¨èªã§ãæ¯è¼ç容æã«æ¸ããã§ãããï¼
åé¡ã¯å®è¡åºç¤ãæ´åããã¨ããã§ï¼ãã㯠scripts/build.sh
ã«æ§ã
éç´ããã¦ããããã§ããï¼ã¨ãã»ã³ã¹ã¨ãã¦ã¯
- ããã©ã«ãã ã¨PATHã¯
/usr/local/bin:/usr/bin/:/bin:/opt/bin
以ä¸ã«éã£ã¦ããã®ã§ããã«ã©ã³ã¿ã¤ã ãçªã£è¾¼ãå¿ è¦ããã - Layerã®zip archiveã®ã«ã¼ãã¯
/opt
ã« ã¢ã¿ãããããã£ã½ã- ãªã®ã§
bin/
ããlib/
ãããzipã®ã«ã¼ãã«å ¥ãã¦ããã°è¯ãæãã«ãªã - ããã«perlã®ã©ã³ã¿ã¤ã ãçªã£è¾¼ãã¨ããä½æ¦
- bootstrapãå¿ è¦ã¨ããã©ã¤ãã©ãªç¾¤ããããããããã«å ¥ãã¦ãã
- ãªã®ã§
- Layer zipã®ã«ã¼ãã«
bootstrap
ãç½®ãã¦ããã°ãã®ãã¡ã¤ã«ãbootstrapã¨ãã¦èªèããã (ã¤ã¾ãå®è¡ããã)- å®è¡å¯è½ãªpermissionãå½ãã£ã¦ãªãã¨åããªã
- ã©ã³ã¿ã¤ã ããã¼ã«ã®ã¤ã³ã¹ãã¼ã« (ã¤ã¾ãzipping) ããéã«ã¯å®ç°å¢ã¨æããå¿
è¦ããã
- é©åãªDockerã³ã³ããã使ã£ã¦å¦çããå¿ è¦ããã
- lambciã®æä¾ãã¦ãããã®ã使ã£ã
ã¨ããæãã§ãï¼çµæ§é£ããã¦ããã£ã¦ãã¾ãã¾ããâ¦â¦ãªãï¼å®éã«å©ç¨å¯è½ãªç°å¢å¤æ°ç¾¤ã«ã¤ãã¦ã¯ä»¥ä¸ãåèã«ãããã: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
ã¾ã ããã¥ã¡ã³ããååã«æã£ã¦ããªãï¼ã¾ãè¬æåãããããããã®ã§ãã *2 é常ã«é¢ç½ãæ©è½ã ã¨æãã¾ããï¼å¤¢ãåºããã¾ããï¼ï¼ï¼
*1:ããã¥ã¡ã³ãã¯ãã¡ã: https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html