ããã«ã¡ã¯ã ãã£ããããã¡ã³ããµã¼ãã¹ï¼èª²ã®å±±æ¬ã§ãã
AWS Serverless Application Model ï¼ä»¥éãSAM) ãå©ç¨ããé
空ç½ãå«ãæååã§ãã©ã¡ã¼ã¿ãä¸æ¸ãããå ´åã®æ³¨æç¹ã説æãã¾ãã
- ãã®è¨äºã®å¯¾è±¡è ã¯ï¼
- ãã©ã¡ã¼ã¿ã®ä¸æ¸ãã«ã¤ãã¦
- 空ç½ãå«ãæååããã©ã¡ã¼ã¿ã«å«ã¾ããå ´åã®ã¨ã©ã¼
- ã¨ã©ã¼ã®åå
- 対ç
- ã¾ã¨ã
- ãããã«
ãã®è¨äºã®å¯¾è±¡è ã¯ï¼
- SAM ã使ã£ããããã¤ãæ¤è¨ã»å©ç¨ããã¦ããæ¹
ãã©ã¡ã¼ã¿ã®ä¸æ¸ãã«ã¤ãã¦
以ä¸ã2種é¡ã®æ¹æ³ã«ã¦
CloudFormation å
ã®ãã©ã¡ã¼ã¿å¤ããããã¤æã«ä¸æ¸ããããã¨ãå¯è½ã§ãã
--parameter-overrides
ã deploy æã®å¼æ°ã«è¨å®ãã- AWS SAM CLI è¨å®ãã¡ã¤ã« ã«ã¦ãparameter-overrides ã®è¨è¼ããã
AWS SAM CLI è¨å®ãã¡ã¤ã« - AWS Serverless Application Model
空ç½ãå«ãæååããã©ã¡ã¼ã¿ã«å«ã¾ããå ´åã®ã¨ã©ã¼
éå»ã®ããã°ã«ã¦ããã©ã¡ã¼ã¿ã« cron ã¹ã±ã¸ã¥ã¼ã«ãè¨å®ãã¾ããã
æåã«ä½ã£ã AWS SAM CLI è¨å®ãã¡ã¤ã«ã
åé¡ã§ãã
ã©ã®ç®æã§ã¨ã©ã¼ãåºãã¨æãã¾ããï¼
version = 0.1 [default.deploy.parameters] stack_name = "auto-nat-gateway-stack" capabilities = "CAPABILITY_NAMED_IAM" region = "ap-northeast-1" s3_bucket = "sam-resource-xxx" parameter_overrides = [ "SystemName=dev", # ã·ã¹ãã å "SubnetId=subnet-xxxxxxxxxxxxxx", # NAT Gateway ãè¨ç½®ãããµãããã "RouteTableId=rtb-xxxxxxxxxxxxxx", # NAT Gateway ã«åããã«ã¼ããã¼ãã« "StartCronExpression=cron(0 9 ? * MON-FRI *)", # NAT Gateway èµ·åæé(JST) "StopCronExpression=cron(0 18 ? * MON-FRI *)" # NAT Gateway çµäºæé(JST) ]
çãã
cronã¹ã±ã¸ã¥ã¼ã«ãéä¸ã§åãã¦ãã¨ã©ã¼ã¨ãªãã¾ãã
Resource handler returned message: "Invalid request provided: Invalid Schedule Expression cron(0
ã¨ã©ã¼ã®åå
AWS SAM CLI è¨å®ãã¡ã¤ã« ã¯æåéã CLI ã§éä¿¡ããå¼æ°ããã¡ã¤ã«ã§ç®¡çãã¦ããã ããªã®ã§ãå®éã¯ä»¥ä¸ã®éãã®ã³ãã³ãã§éä¿¡ããã¾ãã
sam deploy --parameter_overrides SystemName=dev SubnetId=subnet-xxxxxxxxxxxxxx RouteTableId=rtb-xxxxxxxxxxxxxx StartCronExpression=cron(0 9 ? * MON-FRI *) StopCronExpression=cron(0 18 ? * MON-FRI *)
ããã§ãã
ãã©ã¡ã¼ã¿ã®åºåãã空ç½ã§ç®¡çãã¦ãããã
StartCronExpression=cron(0
ã¾ã§ããã©ã¡ã¼ã¿ã¨ãã¦å¦çããã¾ãã
対ç
'
㨠"
ã§å²ã£ã¦ã空ç½ãå«ãæååããã¡ãã¨æåååãã¾ãããã
version = 0.1 [default.deploy.parameters] stack_name = "auto-nat-gateway-stack" capabilities = "CAPABILITY_NAMED_IAM" region = "ap-northeast-1" s3_bucket = "{SAM ãªã½ã¼ã¹ãä¿ç®¡ãã S3 ãã±ããå}" parameter_overrides = [ "SystemName=dev", # ã·ã¹ãã å "SubnetId=subnet-xxxxxxxxxxxxxx", # NAT Gateway ãè¨ç½®ãããµãããã "RouteTableId=rtb-xxxxxxxxxxxxxx", # NAT Gateway ã«åããã«ã¼ããã¼ãã« 'StartCronExpression="cron(0 9 ? * MON-FRI *)"', # NAT Gateway èµ·åæé(JST) 'StopCronExpression="cron(0 18 ? * MON-FRI *)"' # NAT Gateway çµäºæé(JST) ]
ã¾ã¨ã
- AWS SAM CLI è¨å®ãã¡ã¤ã« 㯠ããã¾ã§ CLI ã§éä¿¡ããã³ãã³ã管çãã¡ã¤ã«
- æçµçã«ã¯ã³ãã³ãä¸ã§å±éããããã¨ãèãã¦ã空ç½ã®å¦çãªã©ã¯ãã¡ãã¨ãã¾ããã
ãããã«
åç´ã ãã©ãªããªãæ°ã¥ããªã話ã
æ¬ããã°ãã©ãªããã®ãå½¹ã«ç«ã¦ãã°å¹¸ãã§ãã
å±±æ¬ ç大(å·çè¨äºã®ä¸è¦§)
ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¹é¨ ãã£ããããã¡ã³ããµã¼ãã¹1課
2023å¹´8æå ¥ç¤¾ãã«ããã©ããã好ãã