æ£çŽã«èšã£ãŠãæšå®ãã©ãã£ãã¯ã1ãæããã50ã100 GBãè¶ ããŠã¯ãªããªãå°ããªãããžã§ã¯ããéå§ã®ããã«ãçŸåšCDNãèŠã€ããã®ã¯å°é£ã§ãã 圌ãã¯éåžžã«é«äŸ¡ã§ãããã倧éã®ãã©ãã£ãã¯ãçæãããµã€ãã§ã®ã¿åäœããã»ãšãã©ãã¹ãŠãããªãã€ãããŒã¹ã§åäœããŸãã å®éã«äœ¿çšãããã©ãã£ãã¯ã«å¯ŸããŠæ¯æãã®ã§ã¯ãªããããçšåºŠã®éé¡ã«å¯ŸããŠã¯è§£æ±ºã§ããªãå ŽåããããŸãã
ãã®ç¹ã§ãAmazon CloudFrontã¯ç«¶åä»ç€Ÿãšæ¯èŒããŠæå©ã§ãã ããã§ã®æéã¯ãå®éã«äœ¿çšããããã©ãã£ãã¯ã«å¯ŸããŠã®ã¿è«æ±ãããGBãããå¹³å$ 0.15ã®å°åã«ããããŸãããå°é¡ã§ãã ãã ããCloudFrontãS3ãµãŒãã¹ãšé£æºããŠäœ¿çšããå¿ èŠããããã³ã¹ããå¢å ããåã«ãç¬èªã®ãµãŒããŒããªãªãžã³ãµãŒããŒãšããŠäœ¿çšã§ããããã«ãªããŸããã
ãããžã§ã¯ãã§CloudFrontãµããŒããæ¥ç¶ãæ¯æããè¿œå ããæ¹æ³ã«ã€ããŠè©³ãã説æããããšæããŸãã
ãæ¯æã
æåã«ããµãŒãã¹ã«å¯Ÿããæ¯æãæ¹æ³ãšããã®æ®µéã§çŽé¢ããå°é£ã«ã€ããŠã話ããããšæããŸãã
ã§ããããç§èªèº«ã¯ãŠã¯ã©ã€ãåºèº«ã§ããããã¹ãŠãŸãã¯å€ãã®CISè«žåœã«ãšã£ãŠããã®æ å ±ã¯éèŠã ãšæããŸãã Amazonã§æäŸãããŠããæ¯æãæ¹æ³ã¯ãã¯ã¬ãžããã«ãŒãã«ããæ¯æãã®ã¿ã§ãã ã€ãŸã WebMoneyã®ãããªé»åãããŒã¯åãå ¥ããããŸããã ãããã£ãŠãç§ã¯éè¡ã«è¡ã£ãŠã¯ã¬ãžããã«ãŒããéããªããã°ãªããŸããã§ããã AvalãéžæããŸããããã»ãšãã©ã®å Žåéè¡ã¯éèŠã§ã¯ãããŸããããã¯ã¬ãžããã«ãŒãèªäœã¯éèŠã§ãã ãã«Visa ClassicãçºèŠãããããéãããšãã«ãéè¡ã®åŸæ¥å¡ã«ããã®ã«ãŒãã䜿çšããŠå€åœã®ã«ãŒãã§ã€ã³ã¿ãŒãããã§ã®è³Œå ¥ã«å¯ŸããŠæ¯æãããšãã§ãããã©ãããæ確ã«ããŸããã ã«ãŒããéãã«ã¯10å¶æ¥æ¥ããããŸããã
ä»ãç§ãééããåé¡ã«ã€ããŠïŒ
1.ã«ãŒãã®ã¢ã¯ãã£ããŒã·ã§ã³-ããã§ãç§ã¯å°ãèªåã§ãã£ãããšãèªããªããã°ãªããŸããã éè¡ã®ãã£ãã·ã¥ãã¹ã¯ãä»ããŠã«ãŒãã«ãéãå ¥ããŸãããATMãä»ããŠäœããã®ã¢ã¯ã·ã§ã³ãå®è¡ãããšïŒãéãæ¢ã«ååšããŠããã¯ãã§ããïŒæ®é«ç¢ºèªãè¡ãããŸãã ãããã«ãããéè¡ã§ã«ãŒããã©ã®ããã«æå¹åãããŠããããéè¡å¡ã«ç¢ºèªãã䟡å€ããããŸãã
2. CVV-ã¢ããŸã³ã¯ãç§ããšãŠãé©ãããŸããããã«ãŒãã®CVVã³ãŒããèŠæ±ããŸããã ç»é²æã«ã¯ãã«ãŒãçªå·ãæå¹æéãã«ãŒãå矩人ã®ååã®ã¿ãå ¥åããå¿ èŠããããŸãã å€æããããã«ãAmazonã¯ãã®CVVãäžèŠãªã¹ããŒã ã«åŸã£ãŠåäœããŸãããæ¯æãæãŸãã¯æ°žç¶çã«ãCVVã³ãŒãã«ããã«ãŒãã®ä¿è·ãç¡å¹ã«ããå¿ èŠããããŸãã ããã¯ãéè¡ã®ã³ãŒã«ã»ã³ã¿ãŒãä»ããŠé»è©±ã§è¡ãããã«ãŒããéããéšéã§æ现æžãäœæããŠè¡ããŸãã
ååãšããŠããããã¯ãã¹ãŠç§ã®æ¯æãã§çããåé¡ã§ãã
ç»é²ãšããŒ
ç»é²ããã»ã¹ã¯ã CloudFrontããŒãžããéå§ã§ããŸãã ç»é²ã¯éåžžã«ç°¡åã§ããç»é²æé ã®1ã€ã§ãã«ãŒãã«é¢ããæ å ±ãå ¥åããå¿ èŠããããæ€èšŒã«åæ Œãããšãã¢ã«ãŠã³ããç»é²ãããŸãã CloudFrontã¢ã«ãŠã³ããšãšãã«ãã«ã¹ã¿ã ãªãªãžã³ã䜿çšããå Žåã§ããS3ãµãŒãã¹ã®ã¢ã«ãŠã³ããèªåçã«äœæãããŸãã
ç»é²åŸãAPIãšéä¿¡ãããã¡ã€ã«ã®å®å šãªURLãçæããããã«å¿ èŠãªããŒãçæããå¿ èŠããããŸãã ãããè¡ãã«ã¯ãã¢ã«ãŠã³ãã®ã»ãã¥ãªãã£è³æ Œæ å ±ã»ã¯ã·ã§ã³ã«ç§»åããŸãã ããã«ã¯3ã€ã®ã¿ãããããŸãã
1.ã¢ã¯ã»ã¹ããŒ-ãã®ã¿ãã®ããŒã¿ã¯ãAPIãžã®ãªã¯ãšã¹ãã®èªèšŒããããŒãçæããããã«å¿ èŠã§ãã
2. X.509蚌ææž-SOAPãä»ããAPIèŠæ±ã®ããŒã
3.ããŒãã¢-å®å šãªURLãçæããããã®ããŒã
REST APIãšéä¿¡ãããšãã®æšæºããããŒ
ãã¹ãŠã®REST APIãªã¯ãšã¹ãã«ã¯ã次ã®ããããŒãå¿ èŠã§ãã
1. x-amz-date-ãªã¯ãšã¹ãã®æ¥ä»ã æ¥ä»ã¯ã RFC 2616ä»æ§ã®ãæ¥ä»/æå»åœ¢åŒãã»ã¯ã·ã§ã³ã§èª¬æãããŠãã圢åŒã®ããããã§ãªããã°ãªããŸããã
2. Content-Type-ãªã¯ãšã¹ãããã£ã¿ã€ããéåžžã¯ãapplication / xmlãã
3. Content-Length-ãªã¯ãšã¹ãæ¬æã®é·ãã
4.æ¿èª-æ¿èªããããŒã®æ§é ã¯æ¬¡ã®ãšããã§ãïŒ "AWS aws_secret_key_idïŒsignature"ãããã§ïŒ
4.1 AWS-å®æ°æååãšããã«ç¶ã空çœæåã
4.2 aws_secret_key_id-ã¢ã«ãŠã³ãã®[ã¢ã¯ã»ã¹ããŒ]ã¿ãã®[ ã»ãã¥ãªãã£èªèšŒæ å ±]ããŒãžã«ãããŸãã
4.3眲å-x-amz-dateããããŒã§æå®ãããªã¯ãšã¹ãæ¥ãšaws_secret_key_idãé 眮ãããŠããããŒãžã«ããç§å¯éµã«åºã¥ããŠãsha1ããã·ã¥ã¢ã«ãŽãªãºã ã䜿çšããŠçæãããæ€èšŒçœ²åã 以äžã¯ã眲åãçæããPHPã³ãŒãã§ãã
-
$signature = base64_encode ( hash_hmac ( 'sha1' , $requestDate , $awsSecretKey , true ) ) ;
é åž
Amazon CloudFrontãä»ããŠãã¡ã€ã«ãé åžããæ©äŒãåŸãã«ã¯ãDistributionãäœæããå¿ èŠããããŸãã
1ã€ã®ã¢ã«ãŠã³ãã§ãæ倧100åã®Distributionãäœæã§ããŸãã1ã€ã®Distributionå ã®ãã¡ã€ã«ã®æ°ã¯å¶éãããŠããŸããã
é åžã«ã¯2ã€ã®ã¿ã€ãããããŸãã
1.ããŠã³ããŒã-HTTPããã³HTTPSãä»ããŠãã¡ã€ã«ãé åžããŸãïŒHTTPSã¯å°ãé«äŸ¡ã§ãïŒã
2.ã¹ããªãŒã -RTMPãããã³ã«ãä»ãããããªããã³ãªãŒãã£ãªãã¡ã€ã«ã®é ä¿¡çšã ããã«å€±æãããã®ã§ãããStreamã¿ã€ãã®é ä¿¡ã¯ã«ã¹ã¿ã ãªãªãžã³ã§ã¯æ©èœãã ããªãªãžã³ãµãŒããŒãšããŠã®S3ã§ã®ã¿æ©èœããŸãã
èšäºã®ã¿ã€ãã«ãšæ®µèœ2ã«åºã¥ããŠãããŠã³ããŒãé åžã®ã¿ãæ€èšããŸãã æ°ããããŠã³ããŒãé åžãäœæããããã®XMLèŠæ±ã®äŸãããã«æäŸããŸãã
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
-
<?xml version = "1.0" encoding = "UTF-8" ?> <DistributionConfig xmlns = "http://cloudfront.amazonaws.com/doc/2010-11-01/" > <CustomOrigin > <DNSName > www.example.com </DNSName > <HTTPPort > 80 </HTTPPort > <OriginProtocolPolicy > http-only </OriginProtocolPolicy > </CustomOrigin > <CallerReference > your unique caller reference </CallerReference > <CNAME > mysite.example.com </CNAME > <Comment > My comments </Comment > <Enabled > true </Enabled > <TrustedSigners > <Self /> </TrustedSigners > <Logging > <Bucket > mylogs.s3.amazonaws.com </Bucket > <Prefix > myprefix/ </Prefix > </Logging > </DistributionConfig >
ãªã¯ãšã¹ãURL ïŒ cloudfront.amazonaws.com/2010 â11â01 /é åž
ãªã¯ãšã¹ãæ¹æ³ ïŒPOST
åã¿ã°ã®æå³ãããã«è©³ãã説æããŸãã
1. CustomOriginã¯ããªãªãžã³ãµãŒããŒã®ãã©ã¡ãŒã¿ãŒãèšå®ãããé åã§ãã
1.1 DNSName-ãã¡ã€ã³ãªãªãžã³ãµãŒããŒã
1.2 HTTPPort-HTTPçµç±ã§ãªãªãžã³ãµãŒããŒã«ã¢ã¯ã»ã¹ããããã®ããŒãã
1.3 OriginProtocolPolicy-Amazonã¯ããªãªãžã³ãµãŒããŒãããã¡ã€ã«ã2ã€ã®æ¹æ³ã§ãªã¯ãšã¹ãã§ããŸããhttpã®ã¿-åžžã«HTTPãããã³ã«ã䜿çšãmatch-viewer-ãšã³ããŠãŒã¶ãŒããã¡ã€ã«ã®ãªã¯ãšã¹ãã«äœ¿çšãããããã³ã«ã䜿çšããŸãããHTTPãŸãã¯HTTPSã®ã¿ã
2. CallerReference-ãªã¯ãšã¹ãã®äžæã®èå¥åãæ°å€ã§ãã¢ã«ãã¡ãããã§ãããŸããŸãããäž»ãªãã®ã¯äžæã§ãã
3. CNAME-ãã£ã¹ããªãã¥ãŒã·ã§ã³ããšã«ãAmazonã¯cloudfront.netãã¡ã€ã³ã®ãµããã¡ã€ã³ãäœæããŸãã ãã®ãã¡ã€ã³ã§ã¯ã1ã€ãŸãã¯è€æ°ã®CNAMEããã³ã°ãããããšãã§ããŸãã
4.ã³ã¡ã³ã-é åžçšã®ã³ã¡ã³ãã
5.æå¹-é åžãã¢ã¯ãã£ããã©ãããèšå®ããŸãã
6. TrustedSigners-é åžã¯ãããããžã®ã¢ã¯ã»ã¹ã®ã¿ã€ãïŒãããªãã¯ãšãã©ã€ããŒãïŒã«ãã£ãŠãåããããŸãã 誰ãããããªãã¯ãã£ã¹ããªãã¥ãŒã·ã§ã³ã®ãã¡ã€ã«ã«ã¢ã¯ã»ã¹ã§ããŸãããã©ã€ããŒããã¡ã€ã«ã«ã¢ã¯ã»ã¹ããã«ã¯ãæå¹æéãIPã¢ã¯ã»ã¹ãªã©ãæå®ã§ããå®å šãªURLãäœæããå¿ èŠããããŸãã ãã©ã€ããŒãé åžãäœæããã«ã¯ããã®ã»ã¯ã·ã§ã³ãæå®ããå¿ èŠããããŸãã
7.ãã°-ã¯ãšãªãã°ãã©ã¡ãŒã¿ãèšå®ããã»ã¯ã·ã§ã³ïŒ
7.1ãã±ãã-Amazonã¯S3ãµãŒãã¹ã䜿çšããŠãã°ãä¿åããããããããã䜿çšããå Žåã¯S3ã«è¿œå æéãæ¯æãå¿ èŠããããŸãã ãã®ãã©ã¡ãŒã¿ãŒã¯ããã°ãä¿åãããS3ãã±ãããèšå®ããŸãã
7.2æ¥é èŸ-ãã°æ¥é èŸãç§ãç解ããŠããããã«ãããã¯ãã°ã®ãã£ã¬ã¯ããªã®ãããªãã®ã§ãã
DistributionãäœæããçŽåŸã¯ãInProgressã¹ããŒã¿ã¹ã«ãªã£ãŠããŸãããã¹ããŒã¿ã¹ãActiveã«å€æŽããåŸã«ã®ã¿äœæ¥ãéå§ã§ããŸãã éåžžã10ã15åããããŸãã Distributionã®ã¹ããŒã¿ã¹ã確èªããã«ã¯ãAPIãªã¯ãšã¹ãã䜿çšããŠDistributionã«é¢ããæ å ±ãååŸã§ããŸãã
ãªã¯ãšã¹ãURL ïŒ cloudfront.amazonaws.com/2010 â11â01 / distribution / distribution_id
ãªã¯ãšã¹ãæ¹æ³ ïŒGET
distribution_id-Amazonã¯ãDistributionãäœæãããªã¯ãšã¹ãã®æåã«å¿çããŠæ»ããŸãã
ãã¡ã€ã«ã¢ããããŒãæ©èœ
ããã§ãæãéèŠãªããšã«å°éããŸãã-CDNçµç±ã§ã®ãã¡ã€ã«ã®è¿åŽã§ãã ããã€ãã®æ©èœããããŸãã
1. Amazon CloudFrontã¯ãCDN.Tãããã¡ã€ã«ããªã¯ãšã¹ãããããšãã«è»¢éãããURLãã©ã¡ãŒã¿ãŒããªãªãžã³ãµãŒããŒã«éä¿¡ããŸããã eããšã³ããŠãŒã¶ãŒããã¡ã€ã«example_sub_domain.cloudfront.net/image_1.jpg?param=valueãèŠæ±ããå ŽåããµãŒããŒã®ãªãªãžã³ãããã®ãã¡ã€ã«ãèŠæ±ãããšããparam = valueããåãåããŸãããããã°ã«ã¯å®å šãªURLãå«ãŸããŸãã
2. Distributionã§ãã¡ã€ã«ãæŽæ°ããŸãã 次ã®å Žåã«ãã¡ã€ã«ãèŠæ±ãããå ŽåããããŸãã
2.1 CloudFrontãµãŒããŒäžã«ãªãå Žå;
2.2ãã¡ã€ã«ã®æå¹æéãåããŠããå Žåã æå¹æéã¯ãããããŒã䜿çšããŠå¶åŸ¡ã§ããŸãïŒcache-controlãexpiresãpragmaã ããã©ã«ãã§ã¯ããã¡ã€ã«ã¯24æéãã£ãã·ã¥ãããŸãã
2.3 ç¡å¹åãªã¯ãšã¹ãã䜿çšããŠDistributionãããã¡ã€ã«ãåé€ãããå Žåã
ãšã³ããŠãŒã¶ãŒããã¡ã€ã«ããªã¯ãšã¹ãããå ŽåãAmazonã¯ä»ã®CDNãè¡ãããã«ãã¡ã€ã«ã®å€æŽæ¥ããã§ãã¯ããªãããšã«æ³šæããŠãã ããã ãã¡ã€ã«ãå€æŽãããšãã«AmazonãµãŒããŒãèªåçã«ãã¡ã€ã«ãååŸããããã«ããå Žåã¯ããã¡ã€ã«åã«ããŒãžã§ã³ãŸãã¯å€æŽæ¥ãæå®ããå¿ èŠããããŸãã
3.ãªãªãžã³åŽã®ãã¡ã€ã«ã®ä¿è·-ãªãªãžã³ãµãŒããŒãšããŠç¬èªã®ãã®ã䜿çšããå ŽåïŒã€ãŸããèšäºã§èª¬æããå ŽåïŒAmazonã¯ããªãªãžã³ãµãŒããŒäžã®ãã¡ã€ã«ãäžæ£ã¢ã¯ã»ã¹ããä¿è·ããŸããããã®ã¿ã¹ã¯å®å šã«èµ·æºã®ææè ã«ãããŸãã ãã ããåæã«ãAmazonèªäœãHTTPãŸãã¯HTTPSãä»ããŠãããã®ãã¡ã€ã«ã«ã¢ã¯ã»ã¹ã§ããããã«ããã¡ã€ã«ä¿è·ãå®è£ ããå¿ èŠããããŸãã åæã«ãAmazonã¯ãã¡ã€ã«ããªã¯ãšã¹ããããšãã«ããŒã¿ãéä¿¡ããŸãããããã«ããããªã¯ãšã¹ãã¯ä»ã®ãªã¯ãšã¹ããšåºå¥ãããŸãã ããã«åºã¥ããŠããªãªãžã³ãµãŒããŒäžã®ã¡ã³ããŒãã¡ã€ã«ãä¿è·ããããã®å¯äžã®ãªãã·ã§ã³ããããŸã-IPä¿è·ã 次ã®åœ¢åŒã®.htaccessã§ã¡ã³ããŒãã¡ã€ã«ãä¿è·ããŸãã
- 泚æ æåŠ ã èš±å¯
- ãã¹ãŠ ãã æåŠ
Amazonããã¡ã€ã«ã«ã¢ã¯ã»ã¹ã§ããããã«ã次ã®ã«ãŒã«ã.htaccessã«è¿œå ããŸãã
- ïŒAmazon CloudFront
- 216.137.60.0/ 23 ãã èš±å¯
ããã§ãã¹ã¯216.137.60.0/23ãåããŸãã ã
å ¬éURL
ãã¡ã€ã«ã次ã®ãªãªãžã³ãµãŒããŒã§å©çšå¯èœã§ãããšä»®å®ããŸãã
- origin.example.com/images/image_1.jpg
次ã«ãAmazon CloudFrontãä»ããŠæäŸããã«ã¯ã次ã®URLãçæããå¿ èŠããããŸãã
- example_sub_domain.cloudfront.net/images/image_1.jpg
ããã§ãexample_sub_domain.cloudfront.netã¯ãorigin.example.comã®çºä¿¡å ã«äžèŽãããã®Distributionã®ãã¡ã€ã³ã§ãã
ãã©ã€ããŒãURL
ãã©ã€ããŒãURLã¯2ã€ã®ã¿ã€ãã«åããããŸãã
1.猶詰-URLã®æå¹æéã®ã¿ãæå®ã§ããŸãã
2.ã«ã¹ã¿ã -URlãæå¹ã«ãªãæéãšãURLã䜿çšã§ãã1ã€ä»¥äžã®IPã¢ãã¬ã¹ãæå®ã§ããŸãã
URLãæå¹ã«ãªãæ¥ä»ã®ã¿ãå¿ èŠã ã£ãã®ã§ãå®åURLãçæããäŸã瀺ããŸãã
- é¢æ° getSignedUrl ïŒ $ url ïŒ
- {
- //æå¹æéãæºåããŸã
- $ expireDate = time ïŒ ïŒ + SECURE_URL_TIMEOUT ;
- // Cloudfrontãã©ã€ããŒãããŒãã¢ãèªã¿åããŸã
- $ fp = fopen ïŒ CLOUD_FRONT_KEY_PAIR_PATH ã "r" ïŒ ;
- $ privateKey = fread ïŒ $ fp ã 8192 ïŒ ;
- fclose ïŒ $ fp ïŒ ;
- //ç§å¯éµãäœæããŸã
- $ privateKey = openssl_get_privatekey ïŒ $ privateKey ïŒ ;
- if ïŒ ïŒ $ privateKey ïŒ {
- falseã è¿ã ãŸã ã
- }
- // JSONããªã·ãŒãæºåããŸã
- $ json = '{"Statement"ïŒ[{"Resource"ïŒ "' ã $ url ã '"ã "Condition"ïŒ{"DateLessThan"ïŒ{"AWSïŒEpochTime"ïŒ' ã $ expireDate ã '}}}]}' ;
- //ç§å¯éµã§ããªã·ãŒã«çœ²åããŸã
- if ïŒ ïŒ openssl_sign ïŒ $ json ã $ signature ã $ privateKey ã OPENSSL_ALGO_SHA1 ïŒ ïŒïŒ {
- falseã è¿ã ãŸã ã
- }
- // URLã»ãŒã眲åããªã·ãŒãäœæããŸã
- $ signature = str_replace ïŒ array ïŒ '+' ã '=' ã '/' ïŒ ã array ïŒ '-' ã '_' ã 'ã' ïŒ ã base64_encode ïŒ $ signature ïŒ ïŒ ;
- // URLãæ§ç¯ããŸã
- $ urlã è¿ããŸã
- ã 'ïŒExpires =' ã $ expireDate
- ã 'ïŒSignature =' ã $眲å
- ã 'ïŒKey-Pair-Id =' CLOUD_FRONT_KEY_PAIR_ID ;
- }
ãã®é¢æ°ã¯ã次ã®ãã©ã¡ãŒã¿ãŒãšå®æ°ã䜿çšããŸãã
1. $ urlã¯ãhttpïŒ//example_sub_domain.cloudfront.net/images/image_1.jpgãšãã圢åŒã®ãœãŒã¹URLã§ãã
2. SECURE_URL_TIMEOUT-URLã®ã¿ã€ã ã¢ãŠãïŒç§åäœïŒã
3. CLOUD_FRONT_KEY_PAIR_PATH-ç§å¯ããŒãžã®ãã¹ã[ããŒãã¢]ã¿ãã®[ ã»ãã¥ãªãã£è³æ Œæ å ±]ããŒãžã§çæã§ããŸãã
4. CLOUD_FRONT_KEY_PAIR_ID-ç§å¯ããŒã®èå¥åãããŒèªäœãšåãå Žæã«ãããŸãã
ãã®é¢æ°ã®åºåã¯ãã©ã€ããŒãURLã«ãªããŸããããã«ããããšã³ããŠãŒã¶ãŒã¯ãå²ãåœãŠãããã¿ã€ã ã¢ãŠãã§ããã©ã€ããŒãDistributionã«ããã³ã³ãã³ãã«ã¢ã¯ã»ã¹ã§ããŸãã
䟿å©ãªãªã³ã¯
1. Amazon CloudFront-ãµãŒãã¹ã®ã¡ã€ã³ããŒãžã
2. éçºè ã¬ã€ã -CloudFrontãµãŒãã¹ã®è©³çŽ°ãªèª¬æã
3. APIãªãã¡ã¬ã³ã¹ -CloudFrontãµãŒãã¹ã®REST APIããã¥ã¡ã³ãã
4. AWS SDK for PHP-ãã¹ãŠã®AmazonãµãŒãã¹ãæäœããããã®ã¯ã©ã¹ãå«ãPHPã©ã€ãã©ãªã éåžžã«äŸ¿å©ãªãã®ã
5. ãã¹ãã³ãŒã -ãã¹ãããã»ã¹äžã«äœæããå°ããªã³ãŒãã
PS
åºæ¬çã«ç§ãæžãããã£ãã®ã¯ããã ãã§ãã ãã®èšäºã¯ãCloudFrontã®ã«ã¹ã¿ã ãªãªãžã³ãµãŒããŒã®äœ¿çšã«é¢ããå®å šãªã¬ã€ãã§ãããšã¯äž»åŒµããŠããŸããããS3ãå¿ èŠãšããªã人ã«ãšã£ãŠåœ¹ç«ã€ããšãé¡ã£ãŠããŸãã ãæž èŽããããšãããããŸããã