AWS Lambda触ã£ã¦ã
ç¹ã«æçæ å ±ã¯ç¡ããã©ãLambda触ã£ã¦ã¿ã¦ãã¦èªç¤¾ãµã¼ãã¹ã®ç»åã¢ãããã¼ãæ©è½ã®ã ãµã ãã¤ã«çæãLambdaã§ããã¦ã¿ããããªã¨æã£ã¦ã¡ããã£ã¨ãã¤æ¸ãé²ãã¦ããã
JSã¯æä½éæ¸ãããã©ãã¡ããã¨Node.jsæ¸ãã®åãã¦ãªã®ã§Node.jsã®é°å²æ°æ´ã¿ãªããæ¸ãã¦ããã æ¨æ¥ã¯ãµã¼ãã¼å´ã§å¿ è¦ãªIAMã®æ´åããããä»æ¥ã¯S3ããç»åè½ã¨ã -> ImageMagickã§ãªãµã¤ãºãã -> S3ã«æ¸ãæ»ãææ¸ããã
IAMãããã£ã¦ãã¨ãã®çºè¦ã¨ãã¦ã¯lambda:CreateFunctionãããã«ã¯iam:PassRoleã®æ¨©éãå¿ è¦ã ã¨ãããã¨ãããã£ãã 確ãã«Lambda Functionã«execute roleãè¨å®ããã®ã«ã¯æ¨©éãå¿ è¦ããã ãããã¥ã¡ã³ãã«æ¸ãã¦ãªãã»ã»ã»ã
ãµã ãã¤ã«ä½ãã³ã¼ãæ¸ãã¦ãæã®æ°ä»ãã¨ãã¦ã¯ãcallbackã®é¢æ°ã®å¼æ°ãerror, responseã¨ããé çªã§aws sdkãä½ããã¦ããããããã¨ã§ã ãã®é çªã¯Node.jsã®æåã¨ã®ãã¨ã ã£ããæ®æ®µiOSæ¸ãã¦ãæã®ããã§ã¨ã©ã¼ãæå¾ã«åãåããã¨ãã¦ãã¾ã£ã¦ã¡ãã£ã¨ããã£ãã
ãã¨ã¯ãä½äººãLambdaã®éçºã®ç¥è¦ããã¦ããã£ã½ãã®ã§ã©ãã©ãç¥è¦å¸ã£ã¦ããããã