ã©ãºãã¤ã¨AWSã§è©¦ãã»ãã¥ãªãã£æ¤è¨¼ç°å¢æ§ç¯ï¼å¾ç·¨ï¼
åç·¨ã§ã¯ç°å¢è¨å®ã¾ã§è¡ãã¾ãããå¾ç·¨ã§ã¯ãã®ç°å¢ã«ã¦å©ç¨ããDockerã¤ã¡ã¼ã¸ãAWSãæ´»ç¨ãã¦ãã«ããã¾ãã
ç®æ¬¡
- 4. AWSä¸ã§Dockerã¤ã¡ã¼ã¸ã®ãã«ã
- â IAMã¦ã¼ã¶ã¼ã¸ã®ãã¼ã«ã®é©ç¨ãgitèªè¨¼æ å ±ã®çæ
- â AWS CodeCommitã«ãªãã¸ããªã®ä½æ
- â AWS CodeCommitã®ãªãã¸ããªã«ã½ã¼ã¹ã³ã¼ããæ ¼ç´
- â AWS Amazon Elastic Container Registry(ECR)ãªãã¸ããªãä½æ
- â AWS CodeBuildã«ã¦ããã¸ã§ã¯ããä½æ
- â Dockerã¤ã¡ã¼ã¸ã®ãã«ã
- 5. ãã«ãããã¤ã¡ã¼ã¸ã®Raspberry Piä¸ã§ã®å®è¡
- ãããã«
4. AWSä¸ã§Dockerã¤ã¡ã¼ã¸ã®ãã«ã
ãã®ã¹ãããããã¯AWSã使ç¨ãããããã¾ãã¯AWSã«é¢ããè¨å®ãè¡ãã¾ãã
è¨å®ã®æé ã¨æ¦è¦ã¯æ¬¡ã®ã¨ããã§ãã
- âIAMã¦ã¼ã¶ã¼ã¸ã®ãã¼ã«ã®é©ç¨ãgitèªè¨¼æ å ±ã®çæ
- âAWS CodeCommitã«ãªãã¸ããªã®ä½æ
- âAWS CodeCommitã®ãªãã¸ããªã«ã½ã¼ã¹ã³ã¼ããæ ¼ç´
- âAWS Amazon Elastic Container Registry(ECR)ãªãã¸ããªãä½æ
- âAWS CodeBuildã«ã¦ããã¸ã§ã¯ããä½æ
- âDockerã¤ã¡ã¼ã¸ã®ãã«ã
ã注æï¼AWSå©ç¨æéã«ã¤ãã¦
æ¬ã³ã©ã ã®ä»¥éã®ã¹ããããé²ãã¦ããã ããå ´åã®AWSå©ç¨æéã§ãããã½ã¼ã¹ã³ã¼ãã®ãã«ããªã©ä¸é¨ãé¤ãã大é¨åã¯AWS ç¡æå©ç¨æ ã®ç¯å²å ã«åã¾ãã¾ããå©ç¨ãããªã¼ã¸ã§ã³ãªã©ã«ããæéã¯ç°ãªããããäºã以ä¸ã®å 容ãã確èªãã ããã
- ã»AWS CodeCommit ã®æé
https://aws.amazon.com/jp/codecommit/pricing/ - ã»Amazon Elastic Container Registry ã®æé
https://aws.amazon.com/jp/ecr/pricing/ - ã»AWS CodeBuild ã®æé
https://aws.amazon.com/jp/codebuild/pricing/
ããã§ã¯è¨å®ããå 容ãé çªã«ç¢ºèªãã¦ããã¾ãã
â IAMã¦ã¼ã¶ã¼ã¸ã®ãã¼ã«ã®é©ç¨ãgitèªè¨¼æ å ±ã®çæ
æ¬æé ã§ã¯ãAWS CodeCommitãªã©ã¸ã®ã¢ã¯ã»ã¹ã«ä½¿ç¨ããIAM ã¦ã¼ã¶ã¼ã«å¯¾ãã¦å¿ è¦ãªæ¨©éã®ä»ä¸ãããã³ãAWS CodeCommitãªãã¸ããªã¸ã®æ¥ç¶ã«ä½¿ç¨ããèªè¨¼æ å ±ã®çæãè¡ãã¾ãã
å ãã¯AWS ã³ã³ã½ã¼ã«ã«ãµã¤ã³ã¤ã³ããIAM ã³ã³ã½ã¼ã«(https://console.aws.amazon.com/iam/)ã«ã¢ã¯ã»ã¹ãã¾ãã AWS CodeCommitã¸ã®ã¢ã¯ã»ã¹ã«ä½¿ç¨ããIAM ã¦ã¼ã¶ã¼ã¯æ°è¦ã«ä½æããã ãã¦ãæ¢åã®IAMã¦ã¼ã¶ã¼ã§ãã©ã¡ãã§ãåé¡ããã¾ãã(IAMã¦ã¼ã¶ã¼ã®æ°è¦ä½æã®æ¹æ³ãã¢ã¯ã»ã¹è¨±å¯æ¨©éã®è¿½å æ¹æ³ã«ã¤ãã¦ã¯å²æãã¾ã)ã
使ç¨ããIAMã¦ã¼ã¶ã¼ã«å¯¾ãã¦ã次ã®æ¨©éã追å ãã¾ãã
AWSCodeCommitPowerUser
AmazonEC2ContainerRegistryReadOnly
㻠権éã®è¿½å
AWSCodeCommitPowerUserãããã³ãAmazonEC2ContainerRegistryReadOnly 権éã追å ãã¾ãã
㻠権éã追å ããç¶æ
ã» èªè¨¼æ å ±ã®ç¢ºèª
使ç¨ããIAMã¦ã¼ã¶ã¼ã®æ¬¡ã®æ å ±ãå¿ è¦ã¨ãªãããè¨é²ãã¦ããã¾ãã
- ã»AWS ã¢ã¯ã»ã¹ãã¼/AWS Access Key ID
- ã»AWS ã·ã¼ã¯ã¬ããã¢ã¯ã»ã¹ãã¼/AWS Secret Access Key
ç¶ãã¦ãAWS CodeCommitãªãã¸ããªã¸ã¢ã¯ã»ã¹ããããã®èªè¨¼æ å ±(ã¦ã¼ã¶ã¼åããã¹ã¯ã¼ã)ãçæãããããIAM ã³ã³ã½ã¼ã«ããã¦ã¼ã¶ã¼ä¸è¦§ã表示ããå ã»ã©æ¨©éã追å ããã¦ã¼ã¶ã¼ãé¸æãã¦æ¦è¦ç»é¢ãéãã¾ãã
ã» æ¦è¦ç»é¢ã«ã¦ãèªè¨¼æ å ±ãã¿ããé¸æãããAWS CodeCommit ã® HTTPS Git èªè¨¼æ å ±ãæ¬ã«ãããèªè¨¼æ å ±ãçæããã¿ã³ãæ¼ä¸
ã» çæãããèªè¨¼æ å ±ãè¨é²
ãã®èªè¨¼æ å ±ã¯AWS CodeCommitãªãã¸ããªã¸ã½ã¼ã¹ã³ã¼ããpushããéã«ä½¿ç¨ãã¾ãã
â AWS CodeCommitã«ãªãã¸ããªãä½æ
ãç±³å½æ±é¨ (ãã¼ã¸ãã¢åé¨) us-east-1ããªã¼ã¸ã§ã³(â»)ã®AWS CodeCommitã«ã½ã¼ã¹ã³ã¼ããæ ¼ç´ããããã®ãªãã¸ããªãä½æãã¾ãã
â»ãªã¼ã¸ã§ã³ã¯ä»»æã«æå®ããã ãã¦åé¡ããã¾ããã
ãç±³å½æ±é¨ (ãã¼ã¸ãã¢åé¨) us-east-1ã以å¤ãæå®ããå ´åã以å¾ã¯é©å®èªã¿æ¿ãã¦ãã ããã
ã» CodeCommit ã³ã³ã½ã¼ã«ã«ã¢ã¯ã»ã¹ããç»é¢å³ä¸ãããç±³å½æ±é¨ (ãã¼ã¸ãã¢åé¨) us-east-1ããªã¼ã¸ã§ã³ãæå®å¾ãããªãã¸ããªãä½æããã¿ã³ãæ¼ä¸
ã» ããªãã¸ããªãä½æãç»é¢ã«ã¦ãä»»æã®ãªãã¸ããªå(ä¾ï¼ita-websec-handson)ãå ¥åãã¦ãä½æããã¿ã³ãæ¼ä¸
ã» ä½æããããªãã¸ããªã¨URLã¨ã®åå¾
ãªãã¸ããªã®ä½æå¾ããURLã®ã¯ãã¼ã³ãã³ã³ãããã¯ã¹ãæ¼ä¸ãã表示ããããªãã·ã§ã³ãããHTTPSã®ã¯ãã¼ã³ããé¸æãããã¨ã«ãããCodeCommit ã«æ¥ç¶ããããã®URLãåå¾ãããã¨ãã§ãã¾ãã
åå¾ããURLããããç±³å½æ±é¨ (ãã¼ã¸ãã¢åé¨) us-east-1ããªã¼ã¸ã§ã³ã§ãããã¨ããªãã¸ããªåããita-websec-handsonãã§ãããã¨ãå¤ãã¾ãã
https://git-codecommit.us-east-1.amazonaws.com/v1/repos/ita-websec-handson
åèï¼Git ãªãã¸ããªã AWS CodeCommit ã«ç§»è¡ãã
https://docs.aws.amazon.com/ja_jp/codecommit/latest/userguide/how-to-migrate-repository-existing.html
â AWS CodeCommitã®ãªãã¸ããªã«ã½ã¼ã¹ã³ã¼ããæ ¼ç´
ä½æããAWS CodeCommitã®ãªãã¸ããªã«ãåã®ã¹ãããã«ã¦Kaliã«ãã¦ã³ãã¼ãããOWASP Juice Shopã®ã½ã¼ã¹ã³ã¼ããããã·ã¥ãã¾ãã
VS Codeãèµ·åãã¦ããªãå ´åã¯VS Codeãèµ·åããOWASP Juice Shopã®ã½ã¼ã¹ã³ã¼ãããããã©ã«ãã¼ãéãã¦ãã ããã
ã» AWS CodeCommitãªãã¸ããªã¸ã®pushæä½ã®å®æ½
ã¿ã¼ããã«ãã次ã®ã³ãã³ããå®è¡ãã¾ãã
git push https://git-codecommit.us-east-1.amazonaws.com/v1/repos/ita-websec-handson --all
ãªã¼ã¸ã§ã³ããªãã¸ããªåãå¤æ´ãã¦ããå ´åã¯èµ¤ååæãé©å®ä¿®æ£ãã¦ãã ããã
ãusernameãããpasswordãã®å ¥åãé ã«æ±ãããããããåã®æé ã«ã¦çæããgitèªè¨¼æ å ±ã®ã¦ã¼ã¶ã¼åããã¹ã¯ã¼ããå ¥åãã¾ãã
ã» ããã·ã¥ãããã½ã¼ã¹ã³ã¼ãã®ç¢ºèªããã³ä¿®æ£
AWS CodeCommitãªãã¸ããªãåç
§ããã¨ãã½ã¼ã¹ã³ã¼ããããã·ã¥ããããã¨ã確èªã§ãã¾ãã
ãã®å¾ã«ããã·ã¥ããã½ã¼ã¹ã³ã¼ãããã«ããã¦Dockerã¤ã¡ã¼ã¸ãä½æãã¾ãããããã·ã¥ãããã®ã§ãããã¨ãå¤ããããããã«ãã¡ã¤ã«ãä¸é¨ä¿®æ£ãã¦ãã¼ãè¨å®ãå¤æ´ãã¾ã(å®æ½ããã«æ¬¡ã®æé ã«é²ãã§ãåé¡ããã¾ãã)ã以ä¸ã«ä¿®æ£ãããã¡ã¤ã«ã¨ä¿®æ£ç®æã示ãã¾ãã
ä¿®æ£å¯¾è±¡ãã¡ã¤ã«ï¼/config/default.yml
ãã¡ã¤ã«ãç·¨éããå ´åã¯ãªãã¸ããªå ã§ä¿®æ£ããããã¡ã¤ã«ãé¸æãããç·¨éããã¿ã³ãæ¼ä¸ãããã¨ã§ç·¨éå¯è½ã«ãªãã¾ãã
ä¿®æ£å 容ï¼
ä¿®æ£åãtheme: bluegrey-lightgreen
ä¿®æ£å¾ãtheme: deeporange-indigo
ãã¡ã¤ã«ä¿®æ£å¾ãä¿®æ£ãã³ãããããå¿ è¦ãããã¾ããã³ãããã®éã«ã¯æ¬¡ã®æ å ±ã®å ¥åãæ±ãããããããé©å®å ¥åãã¦ãã ããã
- â¦ãä½æè åã(å¿ é )
- â¦ãEã¡ã¼ã«ã¢ãã¬ã¹ã(å¿ é )
- â¦ãã³ãããã¡ãã»ã¼ã¸ã(ãªãã·ã§ã³)
å ¥åå®äºå¾ããå¤æ´ã®ã³ãããããã¿ã³ãæ¼ä¸ãã¾ãã
ã¡ãªã¿ã«ãä¿®æ£å¯¾è±¡ã®ã/config/default.ymlããã¡ã¤ã«ã«ã¯OWASP Juice Shopã«é¢ãã¦ãµã¼ãã¼ãèµ·åãããã¼ããã¿ã¤ãã«ã®å¤æ´ãªã©å¤ãã®è¨å®é
ç®ãããã¾ãã
ã©ã®ãããªè¨å®ãå¯è½ãã¯ããã¥ã¡ã³ããç¨æããã¦ãããããã¡ããã確èªãã ããã
ãªããä»åã¯ç´æ¥ãã¡ã¤ã«ãä¿®æ£ãã¾ããããç¬èªã®è¨å®ãã¡ã¤ã«ãç¨æãã¦ä»»æã«è¨å®ãåãæ¿ãããã¨ãå¯è½ã§ãããã®æ¹æ³ã«ã¤ãã¦ãè¨è¼ããã¦ãã¾ãããä½µãã¦ã確èªãã ããã
åèï¼Customization
https://pwning.owasp-juice.shop/part1/customization.html
â AWS Amazon Elastic Container Registry(ECR)ãªãã¸ããªãä½æ
AWS CodeCommitãªãã¸ããªã«æ ¼ç´ããã½ã¼ã¹ã³ã¼ãããã«ããã¦çæãããDockerã¤ã¡ã¼ã¸ãæ ¼ç´ããããã®å ´æ(ãªãã¸ããª)ãæºåãã¾ãã
ã» Amazon Container Serviceså ã®RepositoriesããPrivateãé¸æããããªãã¸ããªãä½æããã¿ã³ãæ¼ä¸
ã» ããªãã¸ããªãä½æãç»é¢ã«ã¦ãä»»æã®ãªãã¸ããªå(ä¾ï¼ita-app)ãå ¥åããããªãã¸ããªãä½æããã¿ã³ãæ¼ä¸
Dockerã¤ã¡ã¼ã¸ãæ ¼ç´ãããªãã¸ããªã®æºåãå®äºããããã次ã¯ã½ã¼ã¹ã³ã¼ãããã«ãããããã®è¨å®ãè¡ãã¾ãã
â AWS CodeBuildã«ã¦ããã¸ã§ã¯ããä½æ
AWS CodeCommitã«æ ¼ç´ããã½ã¼ã¹ã³ã¼ãããã«ããããããã³ã³ã½ã¼ã«ãã¼ã ããCodeBuildã¸é·ç§»ãè¨å®ãè¡ãã¾ãã
ã» ããã«ãããã¸ã§ã¯ããç»é¢ã«ã¦ããã«ãããã¸ã§ã¯ããä½æããããã¿ã³ãæ¼ä¸
ã» ããã«ãããã¸ã§ã¯ããä½æãããç»é¢ã«ã¦å種è¨å®ãå®æ½
ãªããããã¸ã§ã¯ãåãªã©ã®è¨å®ãé 次è¡ã£ã¦ããã¾ãããããããè¨å®ãããã³ãã¢ã¼ãã£ãã¡ã¯ããã«ã¤ãã¦ã¯ç¹ã«è¨å®ã¯è¡ããªããã説æãçç¥ãã¦ãã¾ãã
ã» ãããã¸ã§ã¯ãã®è¨å®ãæ¬
ããã¸ã§ã¯ãåï¼ita-juice-shop
ã» ãã½ã¼ã¹ãæ¬
- â¦ã½ã¼ã¹ãããã¤ãï¼AWS CodeCommit
- â¦ãªãã¸ããª(â»)ï¼ita-websec-handson
- â¦ãªãã¡ã¬ã³ã¹ã¿ã¤ãï¼ãã©ã³ã
- â¦ãã©ã³ãï¼master
â»åã®ã¹ãããã«ã¦å¥ã®ãªãã¸ããªåãæå®ããå ´åã¯ãã¡ãã«åããã¦æå®ãã¦ãã ããã
ã» ãç°å¢ãæ¬
- â¦ç°å¢ã¤ã¡ã¼ã¸ï¼ããã¼ã¸ãåã¤ã¡ã¼ã¸
- â¦ãªãã¬ã¼ãã£ã³ã°ã·ã¹ãã ï¼Amazon Linux 2
- â¦ã©ã³ã¿ã¤ã ï¼Standard
- â¦ã¤ã¡ã¼ã¸ï¼aws/codebuild/amazonlinux2-aarch64-standard:2.0
- â¦ã¤ã¡ã¼ã¸ã®ãã¼ã¸ã§ã³ï¼ãã®ã©ã³ã¿ã¤ã ãã¼ã¸ã§ã³ã«ã¯å¸¸ã«ææ°ã®ã¤ã¡ã¼ã¸ã使ç¨ãã¦ãã ãã
- â¦ç¹æ¨©ä»ä¸ï¼ãã§ãã¯
- â¦ãµã¼ãã¹ãã¼ã«ï¼æ°ãããµã¼ãã¹ãã¼ã«
- â¦ãã¼ã«åï¼codebuild-ita-websec-handson-service-role (èªåå ¥å)
ããã§ã¯ãµã¼ãã¹ãã¼ã«ãæ°è¦ã«ä½æãã¦ãã¾ãã
CodeBuildã§çæããDockerã¤ã¡ã¼ã¸ã¯AWS ECRã«ããã·ã¥ãããããCodeBuildã«ECRã¸ã®ã¢ã¯ã»ã¹ã許å¯ããè¨å®ãè¡ãå¿
è¦ãããã¾ãã
ããã¸ã§ã¯ãä½æå¾ã«ãã®è¨±å¯ãè¡ãä¿®æ£ããã®ãµã¼ãã¹ãã¼ã«ã«å¯¾ãã¦è¡ãã¾ãã
ã» ãç°å¢ã- ã追å è¨å®ãæ¬
- â¦ã³ã³ãã¥ã¼ãã£ã³ã°ï¼4 GB ã¡ã¢ãªã2 vCPUs
- â¦ç°å¢å¤æ°
ç°å¢å¤æ°ã®è¨å®ã®å
¥åãã£ã¼ã«ãã¯ãæåã¯ï¼çµãã表示ããã¦ããªãããããç°å¢å¤æ°ã®è¿½å ããã¿ã³ãæ¼ä¸ãã¦å
¥åãã£ã¼ã«ãã追å ãã¾ãã
ãããã®è¨å®å¤ã¯ãã®å¾ã«è¨å®ãè¡ããBuildspecãã®ããã«ãã³ãã³ããã«åæ ããã¾ãã
- â¦AWS_DEFAULT_REGIONï¼us-east-1
- â¦AWS_ACCOUNT_IDï¼********* (ãèªèº«ã®ã¢ã«ã¦ã³ã ID[ç»é¢ã®å³ä¸ãã確èªããã ãããã¨æãã¾ã]ãæå®ãã¾ã)
- â¦IMAGE_REPO_NAMEï¼ita-app (ECRã®ãªãã¸ããªåãæå®ãã¾ã)
- â¦IMAGE_TAGï¼latest
ã» ãBuildspecãæ¬
ãã«ãä»æ§ãå®ç¾©ãã¾ãã
åèï¼CodeBuild ã®ãã«ãä»æ§ã«é¢ãããªãã¡ã¬ã³ã¹
https://docs.aws.amazon.com/ja_jp/codebuild/latest/userguide/build-spec-ref.html
- â¦ãã«ãä»æ§ï¼ãã«ãã³ãã³ãã®æ¿å ¥
- â¦ãã«ãã³ãã³ãï¼ãã¨ãã£ã¿ã«åãæ¿ãããã¿ã³ãæ¼ä¸ãã¦ä»¥ä¸ã®å 容ãå ¥åãã¾ãã
version: 0.2 phases: install: runtime-versions: docker: 19 nodejs: 12 pre_build: commands: - echo Logging in to Amazon ECR... - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com build: commands: - echo Build started on `date` - echo Building the Docker image... - docker build -f Dockerfile.arm -t $IMAGE_REPO_NAME . - docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG post_build: commands: - echo Build completed on `date` - echo Pushing the Docker image... - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
ã» ããã°ãæ¬
ãã«ãã«ã¦ä½ããã®ã¨ã©ã¼ãçºçããå ´åã«ãã®è©³ç´°ã確èªããããããã°ãæå¹ã«ãã¦ãããã¨ããã¹ã¹ã¡ãã¾ãã
- â¦CloudWatch Logs - ãªãã·ã§ãã«ï¼ãã§ãã¯
- â¦ã°ã«ã¼ãåï¼ita-ojs-build
- â¦ã¹ããªã¼ã åï¼ita-ojs-build
以ä¸ã§è¨å®ã¯å®äºã§ãã
ããã«ãããã¸ã§ã¯ããä½æããããã¿ã³ãæ¼ä¸ãã¾ãã
ç¶ãã¦ã³ã³ã½ã¼ã«ãã¼ã ããIAMã¸é·ç§»ãããã¼ã«ã®è¨å®ãè¡ãã¾ãã
ããã¼ã«ãç»é¢ã«ã¦ãåã®æé ã§æ°è¦ã«ä½æãããcodebuild-ita-juice-shop-service-roleããé¸æãã¾ãã
ã» ãã¼ã«ã®é¸æ
ã» é¸æãããã¼ã«ã®ããªã·ã¼ã®ç·¨é
ããªã·ã¼ã«è¿½å ããã¹ãã¼ãã¡ã³ãã¯æ¬¡ã®ã¨ããã§ãã
赤æåã§ç¤ºããå
é¨ã®æååãã³ãã¼ãã¦ããªã·ã¼ã«è¿½å ãã¾ãã
{ "Statement": [ ### BEGIN ADDING STATEMENT HERE ### { "Action": [ "ecr:BatchCheckLayerAvailability", "ecr:CompleteLayerUpload", "ecr:GetAuthorizationToken", "ecr:InitiateLayerUpload", "ecr:PutImage", "ecr:UploadLayerPart" ], "Resource": "*", "Effect": "Allow" }, ### END ADDING STATEMENT HERE ### ... ], "Version": "2012-10-17" }
ã¹ãã¼ãã¡ã³ãã®è¿½å ã¤ã¡ã¼ã¸
åèï¼CodeBuild ã®Docker ãµã³ãã«
https://docs.aws.amazon.com/ja_jp/codebuild/latest/userguide/sample-docker.html
â Dockerã¤ã¡ã¼ã¸ã®ãã«ã
ãã«ãããã¸ã§ã¯ãã®ä½æå®äºå¾ãä½æãããã«ãããã¸ã§ã¯ãã«ããã«ããéå§ããã¿ã³ã表示ããã¾ãã
ããã«ããéå§ããã¿ã³ãæ¼ä¸ãã¦ãã«ããè¡ãã¾ãã
ã» ãã«ãããã¸ã§ã¯ã
ã» ãã«ãæå
ãã«ããéå§å¾ãçµäºããã¾ã§å¤å°æéããããã¾ãã
ãã«ãã«è¦ããæéã¯æ¬¡ã®ã¨ããã§ã(â»)ã
No. | ã³ã³ãã¥ã¼ãã£ã³ã° | æè¦æé |
---|---|---|
1 | 4 GB ã¡ã¢ãªã2 vCPUs | 9 å 23ç§ |
2 | 16 GB ã¡ã¢ãªã8 vCPU | 8 å 51ç§ |
â»ç°å¢è¨å®ã®ãã³ã³ãã¥ã¼ãã£ã³ã°ãè¨å®ããé¸æã§ãã2ã¤ã®ç°å¢ããããã§3åå®æ½ãã¦ã®å¹³åå¤ã示ãã¦ãã¾ãã
ã» ãã«ã失æ
ãã«ãã«å¤±æããå ´åãè¨å®æ¼ãããªãããè¨è¿°ãã¹ããªãããã確èªãã ããããã°ãæå¹ã«ãã¦ããå ´åã¯ãã«ãå¦çã®ã©ãã§ã¨ã©ã¼ãåºã¦ããããåããããããã®æ å ±ãåèã«è¨å®æ¼ããªã©ãããã°ä¿®æ£ãã¾ãã
ã¾ããè¨å®ã«ãã¹ããªããã«ãã«å¤±æããå ´åã次ã®ã¡ãã»ã¼ã¸ããã°ã®ä¸ã«ç¢ºèªã§ãããã¨ãããã¾ãã
toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
ãã®ã¡ãã»ã¼ã¸ã¯Docker Hubã¸ã®Pullãªã¯ã¨ã¹ãã®åæ°å¶éãè¶
ããå ´åã«åºåããã¾ãã
åæ°ã®ã«ã¦ã³ãã¯IPã¢ãã¬ã¹åä½ã«è¡ãããä»ã®ã¦ã¼ã¶ã¼ã®æ¹ã®Pullãªã¯ã¨ã¹ãåæ°ã¨åç®ãããç¹ã«ã注æãã ããã
ãªããã®ã¨ã©ã¼ã®åé¿çã¨ãã¦ã¯ãDocker Hubã¸ã®ãã°ã¤ã³å¦çãbuildspecã«è¨è¿°ããæ¹æ³ãç°¡åã ã¨æãã¾ãã
ããã¾ã Docker Hubã®ã¢ã«ã¦ã³ããä¿æãã¦ããªãå ´åã¯æ°è¦ã«ã¢ã«ã¦ã³ããåå¾ãããã¨ããã¹ã¹ã¡ãã¾ããæ¬ã³ã©ã ã®å
容ã試ãç¨åº¦ã§ããã°ç¡æã®Personalãã©ã³ã®ã¢ã«ã¦ã³ãã§ãååãã¨æãã¾ãããDocker Hubã®å©ç¨ç¶æ³ã«ãã£ã¦ã¯Proãã©ã³ãªã©ã®æåãã©ã³ããæ¤è¨ãã ããã
5. ãã«ãããã¤ã¡ã¼ã¸ã®Raspberry Piä¸ã§ã®å®è¡
AWSç°å¢ã«ã¦ãã«ãããDockerã¤ã¡ã¼ã¸ãKaliç°å¢ã§ä½¿ç¨ããæºåãããããæ´ãã¾ããã
AWS ECRããDockerã¤ã¡ã¼ã¸ãåå¾ããããã®è¨å®ãè¡ããã¤ã¡ã¼ã¸ã®åå¾ãOWASP Juice Shopã®èµ·åãé ã«è¡ãã¾ãã
â AWS CLIã®(ããã©ã«ã)ãããã¡ã¤ã« è¨å®
次ã®ã³ãã³ããå®è¡ãã¾ãã
âââ(kaliã¿kali-raspberry-pi)-[~] ââ$ aws configure
4ã¤ã®äºé
(ã¢ã¯ã»ã¹ãã¼IDãã·ã¼ã¯ã¬ããã¢ã¯ã»ã¹ãã¼ããªã¼ã¸ã§ã³ãåºåå½¢å¼)ã«ã¤ãã¦å
¥åãæ±ãããã¾ãã
ã¢ã¯ã»ã¹ãã¼IDãããã³ãã·ã¼ã¯ã¬ããã¢ã¯ã»ã¹ãã¼ã«ã¤ãã¦ã¯åã®ã¹ãããã«ã¦æ¨©éã追å ããIAMã¦ã¼ã¶ã¼ã®æ
å ±ãé ã«å
¥åãã¾ãã
ãªã¼ã¸ã§ã³ãåºåå½¢å¼ã«ã¤ãã¦ã¯ç¹ã«å¤æ´ããªããã°æ¬¡ã«ç¤ºãå¤ããã®ã¾ã¾å
¥åãã¾ãã
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-east-1 Default output format [None]: json
赤æåé¨åã¯ããã¼ã®å¤ã®ãããé©å®æ¸ãæãã¦å ¥åãã¾ãã
â AWS CLIã«ãããECRå©ç¨ã®è¨å®
AWS CLIããAWS ECRã«ã¢ã¯ã»ã¹ããããã®ã³ãã³ããå®è¡ãã¾ãã
âââ(kaliã¿kali-raspberry-pi)-[~] ââ$ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ã¢ã«ã¦ã³ãID.dkr.ecr.us-east-1.amazonaws.com
赤æåé¨åã¯é©å®æ¸ãæãã¦å ¥åãã¾ãã
ã³ãã³ããåé¡ãªãå®è¡ãããå ´åãçµæã¨ãã¦ãLogin Succeededãã表示ããã¾ãã次ã®æé ã«é²ã¿ã¾ãã
Login Succeeded
åèï¼AWS CLI ã§ã® Amazon ECR ã®ä½¿ç¨
https://docs.aws.amazon.com/ja_jp/AmazonECR/latest/userguide/getting-started-cli.html
â AWS ECRããDockerã¤ã¡ã¼ã¸ã®åå¾
次ã®ã³ãã³ããå®è¡ããAWS ECRããDockerã¤ã¡ã¼ã¸ãåå¾ãã¾ãã
âââ(kaliã¿kali-raspberry-pi)-[~] ââ$ docker pull ã¢ã«ã¦ã³ãID.dkr.ecr.us-east-1.amazonaws.com/ita-app:latest
赤æåé¨åã¯é©å®æ¸ãæãã¦å ¥åãã¾ãã
â ECRããåå¾ããã¤ã¡ã¼ã¸ã«ã¦OWASP Juice Shopã®èµ·å
ã¤ã¡ã¼ã¸åå¾ã«æåå¾ãdocker runã³ãã³ãã«ã¦èµ·åããhttp://localhost:3000 ã«ã¢ã¯ã»ã¹ãã¾ãã
âââ(kaliã¿kali-raspberry-pi)-[~/my-juice-shop] ââ$ docker run --rm -p 3000:3000 ã¢ã«ã¦ã³ãID.dkr.ecr.us-east-1.amazonaws.com/ita-app
赤æåé¨åã¯é©å®æ¸ãæãã¦å ¥åãã¾ãã
ã» OWASP Juice Shopèµ·åã¤ã¡ã¼ã¸
ä¿®æ£ãããã¼ããåæ ããã¦ãããã¨ã確èªã§ãã¾ãã
â ã¯ãªã¼ã³ã¢ãã
æ¤è¨¼çµäºå¾ã使ç¨ããªããªã½ã¼ã¹ã«ã¤ãã¦åé¤ãã¾ãã
- â¦IAMï¼ä½¿ç¨ããã¦ã¼ã¶ã¼ã®åé¤ãã¾ãã¯ãã¢ã¯ã»ã¹ãã¼ãããã³ãgit èªè¨¼æ å ±ã®ç¡å¹å/åé¤
- â¦AWS CodeCommitï¼ãªãã¸ããªã®åé¤
- â¦AWS Amazon Elastic Container Registry(ECR)ï¼ãªãã¸ããªã®åé¤
- â¦AWS CodeBuildï¼ããã¸ã§ã¯ãã®åé¤
ãããã«
ãç²ãæ§ã§ããã以ä¸ã§çµäºã«ãªãã¾ããããããã§ããã§ãããï¼
Raspberry Piã¯æè²ç¨ã¨ãã¦å©ç¨ããããã¨ãæ³å®ãã¦å½åã¯ä½æããããã®å¾ã«IoTã®è©¦ä½åéçºãªã©ã«ãå©ç¨ããã¦ããçµç·¯ã®ãããå¦çæ§è½ã¯ããã»ã©ã§ãããã¾ãããã§ãããVS CodeãDockerãã³ã³ããã§èµ·åããOWASP Juice Shopãªã©ã¯Raspberry Piä¸ã§ãç¹ã«åé¡ãªãåä½ãããã¨ã確èªã§ãããã¨æãã¾ãã
ã»ãã¥ãªãã£ã«é¢ããæ¤è¨¼ãè¡ãå ´åããã®çµæã¨ãã¦æ¤è¨¼ç°å¢ã«ä½ããã®æ¹å¤ãä¸ãããã¨ãå¤ããæ¤è¨¼ç°å¢ã®æ§ç¯ã¨ãã®ç¶æã¯æéãæéããããä¸ã«ã¹ãã¬ã¼ã¸ãå§è¿«ãããªã©æ©ã¾ããé¢ãå¤ãããã¾ãããã§ãããæ°è»½ã«ç°å¢ã®æ§ç¯/ç ´æ£ãè¡ããDockerãRaspberry Piãã¯ã©ã¦ããªã©ãä½µç¨ãããã¨ã«ãããããããæ¤è¨¼ç°å¢ã«ã¾ã¤ããè¦å´ã®è§£æ¶ã«å½¹ç«ã¦ããã¨ãã§ãã¾ãã
ããã¯ã©ã¤ã¢ã³ãã®å¦çè½åãä¸å®ãªå ´åã¯ãRaspberry Piã§ã¯ãªãã¢ããã«ã®M1ããããæè¼ããMacãå©ç¨ãããã¨ãå¯è½ã§ãããã¾ãããµã¼ãã¼ãAWSã®Armæ¡ç¨ã®ã¤ã³ã¹ã¿ã³ã¹ãæ´»ç¨ãããã¨ã§ã³ã¹ãããã©ã¼ãã³ã¹ãçé»åæ§è½ã«æå¾ ã§ãããªã©ãé©æé©æã§æ©æãé¸æãããã¨ã§å¤ãã®ã¡ãªãããèããããç¶æ³ã«ãªãã¾ãããä¸æ¦ã«ã¯è¨ãã¾ããããå°ãªãã¨ãæ¬ã³ã©ã ã§ã覧ããã ããããã«éçºãæ¤è¨¼ç°å¢ã¨ãã¦ãArmãæ¡ç¨ã®é¸æè¢ã«ãªãã¨èãããã¾ãã
å¼ç¤¾ã§ã¯ã¨ã³ã¸ãã¢ãè¬å¸«ãæ å½ããã¯ã©ã¦ããã»ãã¥ãªãã£çã®å種ã®ãã¬ã¼ãã³ã°ã³ã¼ã¹ãæä¾ãã¦ãã¾ãããã¬ã¼ãã³ã°ã«ã¦ã¯ã©ã¦ããªã©ãããæ´»ç¨ããããã®ãã¦ãã¦ã®ç²å¾ãã§ãããããã¯ã©ã¦ãã®å°å ¥ãæ¤è¨ããã¦ãããã»ãã¥ãªãã£ã«ã¤ãã¦å¦ã³ããå ´åãªã©ãåè¬ãæ¤è¨ããã¦ã¿ã¦ã¯ãããã§ãããã
é¢é£ãªã³ã¯
Amazon Web Servicesï¼AWSï¼èªå®ãã¬ã¼ãã³ã°
â»æç« ä¸ã®åååãä¼ç¤¾åãå£ä½åã¯ãå社ã®åæ¨ã¾ãã¯ç»é²åæ¨ã§ãã