Transcript
Page 1: Cloudfront private distribution 개요

CloudFront Private Distribution

BDWise

Page 2: Cloudfront private distribution 개요

CloudFront Private Distribution

• 특정시간, IP에서만접속가능한 CDN 구성

• SignedURL발급을통하여권한있는사용자만Access 가능하도록제한하여유료컨텐츠에대한보호

Page 3: Cloudfront private distribution 개요

구성단계

• (준비)Step1. S3 Bucket 생성

• (준비) Step2. CF Origin Access Identity 생성

• (준비) Step3. CF Distribution 생성

• 검증

• (준비) Step4. CF Key Pair 생성

• (준비) Step5. DER 파일생성

• (통제) Step6. Signed URL 생성

• 검증

Page 4: Cloudfront private distribution 개요

Step1. S3 Bucket 생성

Owner만접속가능한 Bucket 생성(기본값)

Page 5: Cloudfront private distribution 개요

Step2. CF Origin Access Identity 생성

CF에서 Origin(여기서는 S3)에접속할 ID 생성

Page 6: Cloudfront private distribution 개요

Step3. CF Distribution 생성

Distribution 생성시 Step2.에서생성된OAI로만접속가능하도록 S3 Bucket Policy 업데이트설정

-Signature로검증된 URL만접속허용-Owner 소유의 Private Key를사용하여만들어진 Signature만허용

Page 7: Cloudfront private distribution 개요

검증

S3 URL 접속시접속불가 CDN URL 접속시접속불가

Page 8: Cloudfront private distribution 개요

Step4. CF Key Pair 생성

CF를위한 Signed URL 생성을위한 Key-Pair 생성

Page 9: Cloudfront private distribution 개요

Step5. Step5. DER 파일 생성

• openssl pkcs8 -topk8 -nocrypt -in $private_key-inform PEM -out mykey.der -outform DER

Private Key 파일타입변경(openssl 설치필요)

Page 10: Cloudfront private distribution 개요

Step6. Signed URL 생성private static String DistributionDomain = “….cloudfront.net";

private static String KeyPairId = “….";

public static void main(String[] args)

throws CloudFrontServiceException, ParseException, FileNotFoundException, IOException {

Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

byte[] derPrivateKey = IOUtils.toByteArray(new FileInputStream("./mykey.der"));

String s3ObjectKey = "a.pdf";

String signedUrlCanned = CloudFrontService.signUrlCanned(

"http://"+ DistributionDomain + "/" + s3ObjectKey, KeyPairId,

derPrivateKey,

ServiceUtils.parseIso8601Date("2014-03-13T16:00:00.000Z+09"));

System.out.println(signedUrlCanned);

}Signed Url생성코드샘플

Page 11: Cloudfront private distribution 개요

검증

Signed Url을사용한접속