공부 기록용이니 틀린 점 있으면 알려주세요
VPC Endpoint
VPC Endpoint는 VPC와 AWS 서비스를(🌐외부 인터넷을 거치지 않는다) 프라이빗 네트워크 연결하기 위한 서비스이다.
VPC Endpoint가 필요한 이유?
▶VPC와 AWS 서비스를 프라이빗하게 연결하기 위해서. 프라이빗 연결 안한다면 VPC Endpoint 사용안해도 된다.
AWS 서비스에는 Public한 공인IP를 가지고 있는 AWS 서비스들이 있다.
📌상당히 중요) S3, CloudWatch, Cloudfront, DynamoDB, API Gateway
위와 같은 서비스들은 Public한 서비스이기 때문에 (사용자가 만든) VPC 내부에서 S3와 같은 서비스에 연결하려면 외부 인터넷을 경유해야 된다.
문제는 외부 인터넷을 경유할 때 데이터가 노출이 될 수 있다는 점이다. 그래서 많은 기업들은 이를 꺼려한다.
VPC Endpoint는 VPC를 S3와 같은 서비스와 연결시킬 때 외부 인터넷을 경유하지 않고 직접적으로 프라이빗한 연결을 만들어 준다.
VPC Endpoint 특징
- VPC Endpoint를 통해서 VPC 내부의 리소스를 다른 외부(Public) AWS 서비스와 프라이빗하게 연결할 수 있다.
- 💪 인터넷을 거치지 않기에 데이터 전송의 보안성을 강화시킨다.
- ⚡ 외부 서버(인터넷)를 거치지 않기에 더 빠르게 접근할 수 있다.
- VPC Endpoint는 2 가지 유형으로 나뉘며, 이용할 수 있는 서비스가 다르다.
- Gateway Endpoint
- Private Link: (ENI) Interface Endpoint
⚠ 주의점
VPC Endpoint는 같은 리전 내에서만 연결 가능하다.
Gateway Endpoint와 PrivateLink의 차이점
Gateway Endpoint | PrivateLink (Interface Endpoint) | |
Supported services | S3, DynamoDB | Most of AWS services (상당히 많다) |
Routing table | Required (필요) | Not required (필요없다) |
Endpoint | VPC | Subnet |
On-premise access | No access | Allow access |
💸 Pricing | Free (무료) | Charged (유료) |
1. Gateway Endpoint
- Amazon S3와 DynamoDB만 프라이빗하게 연결하기 위한 서비스이다.
- S3나 DynamoDB에 연결할 경우, 연결하려는 AWS 리소스가 배치된 VPC에 VPC Endpoint를 할당한다. 그리고 라우팅 테이블에 대상이 VPC 엔드포인트로 향하도록 설정한다
- VPC 한 개당 Gateway Endpoint 한 개만 생성하면 된다.
- 즉, Gateway Endpoint로 연결하면 해당 VPC 내의 모든 리소스가 해당 서비스에 접근할 수 있다.
- 비용은 무료이다.
- Route table이 필요하다.
- VPC가 엔드포인트가 된다. (PrivateLink는 Subnet이 엔드포인트)
Establish connectivity between VPCs and AWS services without exposing data to the internet
2. PrivateLink: (ENI 기반: Interface Endpoint)
- 다양한 AWS 서비스들(CloudWatch Logs, S3, 다른 VPC, ..etc)에 프라이빗 연결하기 위한 서비스이다.
- 서비스에 연결하려는 리소스가 배치된 서브넷에 프라이빗 IP 주소를 가진 ENI(Elastic Network Interface)를 생성하고, ENI와 서비스를 연결한다.
- Elastic Network Interface(ENI)를 사용하여 보안 그룹(security group)과 연결된다. (ENI란 무엇인가 → https://jibinary.tistory.com/133)
- 비용이 든다.
- Route table을 사용하지 않는다.
- Subnet이 엔드포인트가 된다. (Gateway Endpoint는 VPC가 엔드포인트)
AWS PrivateLink 의 연결 대상
- VPC Endpoint로 자신의 AWS계정의 AWS 서비스에 연결
- VPC Endpoint로 다른 AWS 계정의 VPC 연결 (VPC 엔드포인트 서비스)
- VPC Endpoint로 AWS Marketplace 파트너 서비스에 연결
다른 AWS계정의 VPC와 어떻게 PrivateLink로 연결시키는가?
→ VPC Endpoint와 VPC Endpoint Service가 필요하다.
📌 주의 사항
다른 계정의 VPC와 연결하고자 할 때, 연결 상대의 VPC는 같은 Region에 있어야 한다.
서로 다른 리전 간에 VPC를 연결하려면 VPC Peering를 고려해야 한다.
- VPC Endpoint: 서비스 이용하는 측의 VPC 안에서 작성
- VPC Endpoint Service: 서비스 제공하는 VPC 안에서 작성
실습: PrivateLink 연결하기
아래와 같은 환경에서 PrivateLink 연결시키기
PrivateLink를 위해 생성해야 하는 것들
Consumer 측과 Provider 측이 있다고 가정한다면
- VPC Endpoint Service (Provider)
- Network Load Balancer (Provider)
- VPC Endpoint (Consumer)
NLB (Network Load Balancer) 만들기
먼저 Provider 측에서 EC2와 연결되는 NLB가 있어야한다.
VPC Endpoint Service 만들기
AWS console → VPC → Endpoint services → Create endpoint service
방금 만든 NLB를 선택해야된다.
다른 AWS 계정의 VPC와 연결하는 경우
In AWS console -> VPC endpoint services -> Allow principals -> add arn:aws:iam::<계정번호>:root
VPC Endpoint 만들기
AWS console → VPC → Endpoints → Create endpoint
"Service Category" → “Other endpoint services” 선택하기
"Service Setting" → 적절한 endpoint service name을 적기(해당 endpoint service 속성의 Service name값 ) → "Verify service"를 누르기
→ Search service name (VPC Endpoint services - Service name) → select your VPC → select security group → Create endpoint
연결하려는 VPC 선택하기
- 연결하려는 EC2의 Availability Zone의 Subnet 선택하기
- 기본적으로 IPv4 선택
- 연결하려는 EC2의 적절한 Security Group 선택하기
Create endpoint 클릭하기
VPC Endpoint Service 에서 승인하기
AWS console → Endpoint service → Endpoint connections → select "Pending acceptance" → Actions → Accept endpoint connection request
다른 AWS 계정의 VPC와 연결할 경우
A와 B의 계정이 있다고 가정해보자.
A측) 연결할 AWS 계정 허락하기
AWS console → Endpoint service → Allow principals → AWS 계정 입력하기
B측) 연결할 AWS 계정 허락하기
AWS console → Endpoint service → Create endpoint → Other endpoint services 선택 → endpoint service name 입력 → “Verify” 클릭
A측) VPC Endpoint Service 에서 승인하기
AWS console → Endpoint service → Endpoint connections → select "Pending acceptance" → Actions → Accept endpoint connection request
참고자료
https://docs.aws.amazon.com/vpc/latest/privatelink/gateway-endpoints.html
Gateway endpoints - Amazon Virtual Private Cloud
Gateway endpoints Gateway VPC endpoints provide reliable connectivity to Amazon S3 and DynamoDB without requiring an internet gateway or a NAT device for your VPC. Gateway endpoints do not use AWS PrivateLink, unlike other types of VPC endpoints. Pricing T
docs.aws.amazon.com
https://docs.aws.amazon.com/ko_kr/whitepapers/latest/aws-privatelink/what-are-vpc-endpoints.html
What are VPC endpoints? - Securely Access Services Over AWS PrivateLink
What are VPC endpoints? A VPC endpoint enables customers to privately connect to supported AWS services and VPC endpoint services powered by AWS PrivateLink. Amazon VPC instances do not require public IP addresses to communicate with resources of the servi
docs.aws.amazon.com
https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html
AWS PrivateLink concepts - Amazon Virtual Private Cloud
AWS PrivateLink concepts You can use Amazon VPC to define a virtual private cloud (VPC), which is a logically isolated virtual network. You can launch AWS resources in your VPC. You can allow the resources in your VPC to connect to resources outside that V
docs.aws.amazon.com
https://bosungtea9416.tistory.com/entry/AWS-VPC-Endpoint-Gateway-Endpoint-Interface-Endpoint
[AWS] VPC Endpoint (Gateway Endpoint, Interface Endpoint 및 S3 연결)
VPC Endpoint란 VPC Endpoint는 VPC와 AWS 서비스 사이의 통신을 비공개로 연결할 수 있도록 해주는 서비스며 Pubilc IP 주소를 필요로 하지 않게 한다. VPC와 기타 서비스 간의 트래픽은 AWS 네트워크를 벗어
bosungtea9416.tistory.com
https://dev.classmethod.jp/articles/organize-private-links-with-endpoints/
EndPoint Service를 이용해서 PrivateLink 구성 해보기 | DevelopersIO
EndPoint Service를 이용해서 PrivateLink를 구성해 봤습니다.
dev.classmethod.jp