CloudFront VPC Origin

더쿠·2024년 12월 14일
1

참고

Restrict access with VPC origins - Amazon CloudFront

설명

  • VPC Origin 기능을 사용하면 Private Subnet에 위치한 Private Resoure를 CloudFront의 Origin으로 연결하여 사용할 수 있습니다.

    외부에서 EC2에 접근하기 위해서는 Public Subnet에 배치하고 Public IP를 할당해야 합니다. 이전까지는 보안을 위해서 EC2를 Private Subnet에 배치하고 Public Load Balancer를 연결하는 형태로 많이 사용하였습니다.하지만 VPC Orgin 기능의 등장으로 하나의 선택지가 생겼습니다.



  • Private Resource로 Internet ALB 또는 NLB, Private EC2를 등록 가능합니다.

    • Internet NLB가 Dualstack을 사용하거나, TLS Listener 있는 경우 등록이 불가능힙나다.
  • Private Resource의 Security Group에는 CloudFront를 허용하는 규칙이 필요합니다.



설정

VPC Origin 생성 명령어

aws cloudfront create-vpc-origin \
--vpc-origin-endpoint-config '{
  "Name": "<VPC Origin Name>",
  "Arn": "<Prviate Resource ARN>",
  "HTTPPort": <HTTP port number of private resource>,
  "HTTPSPort": <HTTPS port number of private resource>,
  "OriginProtocolPolicy": "<http-only | match-viewer | https-only>", 
  "OriginSslProtocols": {
    "Quantity": <Number of SSL/TLS Protocol to use>
    "Items": [<"SSLv3"|"TLSv1"|"TLSv1.1"|"TLSv1.2">]
  }
}'

[샘플]

aws cloudfront create-vpc-origin \
--vpc-origin-endpoint-config '{
  "Name": "2test-web-origin1",
  "Arn": "arn:aws:ec2:ap-northeast-2:123456789:instance/i-0da7146320f88b683",
  "HTTPPort": 80,
  "HTTPSPort": 443,  
  "OriginProtocolPolicy": "http-only",
  "OriginSslProtocols": {
    "Quantity": 1,
    "Items": ["TLSv1.2"]
  }
}' \
--tags "Items=[{Key=Env,Value=2test},{Key=Team,Value=Ducku}]"
profile
궁금한게 많은 사람

2개의 댓글

comment-user-thumbnail
2025년 3월 6일

서울리전의 경우 apne2-az1 존이 맞겠죠?
흔히 알고 있는 a, b, c, d 존과는 다른 개념입니다.

1개의 답글