ããã«ã¡ã¯ãCIé¨ æ¿ï¨ã§ãã
æè¿ã¯ãããã³ãã³ã®ã¹ããã·ã¥ããã¬ã¤ã«æã¦ãããã«ãªã£ã¦ãã¦ããã楽ããã¦ä»æ¹ããã¾ããã
ä»åã¯ALBã®ãªã¹ãã¼ã«ã¼ã«ã®åªå
度ã«ç¦ç¹ãå½ã¦ã¦ããããã¨æãã¾ãã
â»æ¬ããã°ã®å·çæç¹(2022å¹´7æ)ã§ã®æ
å ±ã¨ãªãã¾ãã®ã§ä»å¾ãå¤æ´ããããã¨ãäºæ³ããã¾ãã
ALBã®ãªã¹ãã¼ã«ã¼ã«ã®åªå 度ã«ã¤ãã¦
åéããã¦ãããã¨
ALBã®ãªã¹ãã¼ã«ã¼ã«ãè¤æ°è¨å®ããã¨ããã³ã³ä¸ã§ã¯ä»¥ä¸ã®ã¨ããã«åªå
度ã1, 2, 3, 4
ã¨è¡¨ç¤ºããã¾ãã
ãã®ãã¨ããåªå
度ã®è¨å®ã¯1, 2, 3, 4
ã®ããã«æ°åãåãè©°ããç¶æ
ã§ããè¨å®ã§ããããããã¯ã¼ã¯ACLã®ã«ã¼ã«ã®ããã«10, 20, 30, 40
ã¨è¨å®ãããã¨ãã§ããªãã¨æã£ã¦ãã¾ããã
äºå®
ããã³ã³ä¸ã§ã¯åªå
度ã®è¨å®ã¯1, 2, 3, 4
ã®ããã«æ°åãåãè©°ããç¶æ
ã§è¨å®ãããã¨ã¨ãªãã¾ãã(æ£ç¢ºã«ã¯åªå
度ãæ°å¤ã§è¨å®ã§ããªã)
ããããAWS CLIã§ã¯ä»¥ä¸ã®ããã«åªå
度ã10, 20, 30, 40
ã¨è¨å®ãããã¨ãå¯è½ã§ããã
â»AWS CLIã ãã§ãªããCloudFormationãboto3ã§ãåæ§ã®è¨å®ãå¯è½ã§ãã
aws elbv2 set-rule-priorities --rule-priorities RuleArn=<ãªã¹ãã¼ã«ã¼ã«ARN>,Priority=10 RuleArn=<ãªã¹ãã¼ã«ã¼ã«ARN>,Priority=20 RuleArn=<ãªã¹ãã¼ã«ã¼ã«ARN>,Priority=30 RuleArn=<ãªã¹ãã¼ã«ã¼ã«ARN>,Priority=40
set-rule-priorities â AWS CLI 1.25.34 Command Reference
ãã ããä¸è¨ã®ãããªè¨å®ãå
¥ãã¦ãããã³ã³ä¸ã§ã¯1, 2, 3, 4
ã®ããã«æ°åãåãè©°ããç¶æ
ã§è¡¨ç¤ºããã¾ãã
ãã®ç¶æ ã§AWS CLIã使ç¨ãã¦ãªã¹ãã¼ã«ã¼ã«ã®ç¶æ ãåå¾ããã¨ãã·ã¹ãã å´ã§ã¯åªå 度ã®æ å ±ãä¿æããã¦ãããã¨ãåããã¾ãã
[cloudshell-user@ip-10-0-10-1 ~]$ aws elbv2 describe-rules --listener-arn <ãªã¹ãã¼ARN> { "Rules": [ { "RuleArn": "<ãªã¹ãã¼ã«ã¼ã«ARN>", "Priority": "10", ï½ï½ï½ï½ï½çç¥ï½ï½ï½ï½ï½ }, { "RuleArn": "<ãªã¹ãã¼ã«ã¼ã«ARN>", "Priority": "20", ï½ï½ï½ï½ï½çç¥ï½ï½ï½ï½ï½ }, { "RuleArn": "<ãªã¹ãã¼ã«ã¼ã«ARN>", "Priority": "30", ï½ï½ï½ï½ï½çç¥ï½ï½ï½ï½ï½ }, { "RuleArn": "<ãªã¹ãã¼ã«ã¼ã«ARN>", "Priority": "40", ï½ï½ï½ï½ï½çç¥ï½ï½ï½ï½ï½ } ] } [cloudshell-user@ip-10-0-10-1 ~]$
describe-rules â AWS CLI 1.25.34 Command Reference
ãã®ãã¨ããããã³ã³ä¸ã§è¡¨ç¤ºããã¦ããåªå 度ã®æ°å¤ã¯ã·ã¹ãã å´ã®è¨å®å¤ã表示ãã¦ããã®ã§ã¯ãªããåã«ãªã¹ãã¼ã«ã¼ã«ã®é çªã®ãããªãã®ã表示ãã¦ãããã¨ãåããã¾ãã
çå1
ï¼±ï¼AWS CLIã§åªå
度ã10, 20, 30, 40
ã¨è¨å®ããç¶æ
ã§ãããã³ã³ããåªå
度ã®å
¥ãæ¿ããè¡ãã¨ã©ããªããï¼
Aï¼å
¥ãæ¿ãããªã¹ãã¼ã«ã¼ã«ã®åªå
度ã®ä¸ã§æ°åã大ããåªå
度ãåºæºã«æ°ãã«çªå·ãå²ãå½ã¦ãããã
ãªã¹ãã¼ã«ã¼ã«ã®ååã¨åªå
度ãtest1:10, test2:20, test3:30, test4:40
ã¨ãªã£ã¦ããã¨ãã«ãtest1:10
ã¨test4:40
ãå
¥ãæ¿ããã¨test4:40, test2:41, test3:42, test1:43
ã¨ãªãã¾ãã
ããã«test1:10, test2:20, test3:30, test4:100
ã®ç¶æ
ããtest3:30
ã¨test4:100
ãå
¥ãæ¿ããã¨test1:10, test2:20, test4:100, test3:101
ã«ãªãã¾ãã
çå2
ï¼±ï¼ãªã¹ãã¼ã«ã¼ã«ã®åªå 度ã®å¤ã¯ã©ãã¾ã§è¨å®å¯è½ãªã®ãï¼
Aï¼æ¬ããã°ã®å·çæç¹(2022å¹´7æ)ã§ã¯50000
ã¾ã§è¨å®å¯è½ã
â»ãªã¹ãã¼ã«ã¼ã«æ°ã®ä¸éã¯ããã©ã«ã100
ã§ãã®ã§ã注æãã ããã
Application Load Balancer ã®ã¯ã©ã¼ã¿ - Elastic Load Balancing
以ä¸ã®ããã«AWS CLIã§åªå
度ãé«ãè¨å®ãã¦ã¿ãã¨ãããã¨ã©ã¼ã®ä¸ã§ä¸éå¤ãæãã¦ããã¾ããã
â»ç§ãæ¢ããéãã§ã¯CloudFormationã®ããã¥ã¡ã³ãã«ãè¨è¼ããã¦ãã¾ããã
AWS::ElasticLoadBalancingV2::ListenerRule - AWS CloudFormation
[cloudshell-user@ip-10-0-154-145 ~]$ aws elbv2 set-rule-priorities --rule-priorities RuleArn=<ãªã¹ãã¼ã«ã¼ã«ARN>,Priority=100000 An error occurred (ValidationError) when calling the SetRulePriorities operation: 1 validation error detected: Value '100000' at 'rulePriorities.4.member.priority' failed to satisfy constraint: Member must have value less than or equal to 50000 [cloudshell-user@ip-10-0-154-145 ~]$
ããã«çå1ã¨ã®åããæã§ãªã¹ãã¼ã«ã¼ã«ã®ååã¨åªå
度ãtest1:10, test2:20, test3:30, test4:50000
ã¨ãªã£ã¦ããã¨ãã«ãtest3:30
ã¨test4:50000
ãããã³ã³ä¸ã®è¨å®ã§å
¥ãæ¿ãããã¨ããã¨ãã·ã¹ãã å´ã§ã¯test3:50001
ãå²ãå½ã¦ããã¨ãããã50000
ã®ä¸éå¤ã«æµè§¦ãã¾ããã
ä»åã®èª¿æ»ãè¡ãã«è³ã£ãèæ¯
ALBã®ãªã¹ãã¼ã«ã¼ã«ã§ã¯HTMLã®åºå®ã¬ã¹ãã³ã¹ãè¨å®ãããã¨ãã§ããSorryãã¼ã¸ãç°¡åã«å®è£
ãããã¨ãå¯è½ã§ãã
ALB 㧠Sorry ãã¼ã¸ãå®è£
ããæ¹æ³ã¨éç¨ä¸ã®èæ
®ç¹ - ãµã¼ãã¼ã¯ã¼ã¯ã¹ã¨ã³ã¸ãã¢ããã°
ããã§1å¹´ã»ã©åã«æ£å¸¸æã¯ALBããWEBãµã¼ãã¼ã¸ãªã¯ã¨ã¹ããéãã
ç°å¸¸æã«Lambdaããªã¹ãã¼ã«ã¼ã«ã®åªå 度ãå¤æ´ãã¦Sorryãã¼ã¸ã®åºå®ã¬ã¹ãã³ã¹ãè¿ãä»çµã¿ãä½ãã¾ããã
ãã®ã¨ãã¯åä½ã®ALBã«ã¤ãåä½ã®ã¿ã¼ã²ããã°ã«ã¼ããè¨å®ãããããåç´ã«ãªã¹ãã¼ã«ã¼ã«ã®åªå
度ãå
¥ãæ¿ããã ãã§åé¡ããã¾ããã§ããã
ããããæè¿ã«ãªãåä½ã®ALBã«è¤æ°ã®ã¿ã¼ã²ããã°ã«ã¼ããè¨å®ããç¶æ
ã§ãç¹å®ã®ã¿ã¼ã²ããã°ã«ã¼ãã§ç°å¸¸ãçºçããéã«Sorryãã¼ã¸ã®åºå®ã¬ã¹ãã³ã¹ãè¿ãå¿
è¦ãåºã¦ãã¾ããã
ãã®ç¶æ
ã§åªå
度ã®çªå·ã1, 2, 3, 4
ã¨æ°åãåãè©°ããã¨ããªã¹ãã¼ã«ã¼ã«ã®åªå
度ã®å¶å¾¡ãè¤éåãã¾ãã
ããã§ãããã¯ã¼ã¯ACLã®ã«ã¼ã«ã®ããã«åªå
度ã®çªå·ã10, 20, 30, 100
ã¨è¨å®ãã
Sorryãã¼ã¸ã®åºå®ã¬ã¹ãã³ã¹ãåªå
度100
ãç°å¸¸ã®çºçãããªã¹ãã¼ã«ã¼ã«ãä¸æçã«åªå
度101
以ä¸ã«ãããããªå¶å¾¡ãã§ããªãããã¨èããã®ãçºç«¯ã¨ãªãã¾ãã
以ä¸ã¨ãªãã¾ãã
æ¿ï¨ æ人 (è¨äºä¸è¦§)
ã¯ã©ã¦ãã¤ã³ãã°ã¬ã¼ã·ã§ã³é¨
AWS移è¡æ¡ä»¶ã®è¦ä»¶å®ç¾©ï½æ§ç¯ãã¡ã¤ã³ã«æ
å½ã
æè¿ã¯ãããã³ãã³ã¨ãã¼ãããã£ã¦ãã¾ãã