티스토리 뷰

AWS

awscli s3 cloudfront

fendys 2021. 9. 1. 12:34
반응형

phase bucketName
Bucket a.fendys.prod

조건
1. public access 접근이 허용되어야합니다.(CF를 통한 접근)
2. GET에 대해서 cors 허용

###Core

[
    {
        "AllowedHeaders": [],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]

 

3. OAI를 통한 CloudFront에서의 접근이 허용되어야합니다.(확인 위치 : CloudFront -> Security ->Origin access identities)
https://console.aws.amazon.com/cloudfront/v3/home?#/distributions
신규 생성은 CloudFront -> Distributions -> create 에서 생성 하면 기본적으로 origin domain 에서 s3 or ELB 등을 선택하고 생성 한다. 

### S3 -> 해당 Bucket 선택 후 -> 퍼미션 ##

#### Bucket policy  E2T2K1XD11ZZGT(OAI distributions ID) 값을 변경한다. 
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E2T2K1XD11ZZGT"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::a.fendys.prod/*"
        }
    ]
}
반응형

'AWS' 카테고리의 다른 글

awscli efs & policy  (0) 2021.09.01
awscli make s3 & role & policy  (0) 2021.09.01
aws sso config 및 login  (0) 2021.09.01
AWS S3 Command  (0) 2021.08.21
awscli windows 간단사용 - SSO 기준  (0) 2021.08.21