ELB IP whiteList 공급 솔루션 설계

xlwdn·2023년 5월 25일

ELB IP whiteList


ELB를 통해 다중 AZ에 배치된 Autoscaling그룹의 인스턴스 플릿이 존재하고, 해당 인스턴스에서 서비스를 공급할 때, 서비스 이용자가 방화벽 해제를 위한 whiteList를 요구할 수 있다. 해당 글에서는 이러한 요구사항을 충족하는 솔루션을 설계한다.

EC2 instances에 대한 요청이 반드시 분산되어야하는 서비스 요구사항이 존재할 때, 단순히 EC2 하나만 띄워서는 충족시킬 수 없다. 그러므로, 해당 글에서는 NLB의 타겟으로 EIP를 연결하여 글을 진행한다.

EC2 setup



서비스를 제공하는 상황을 유지하기 위해 간단한 2개의 EC2 instances를 launch하고, 이하 내용을 입력하여 nginx를 띄운다.

sudo yum install -y docker
sudo usermod -aG docker $USER
(reconnect with EC2)
docker run -d -p 80:8080 bitnami/nginx

정상 작동

[ec2-user@ip-172-31-28-190 ~]$ curl localhost:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

EIP 생성


whitelist공급을 위한 고정적인 IP를 위해, EIP를 할당하여준다.
loadBalancer는 2개 이상의 AZ를 사용하여야하므로 EIP 2개 이상 할당하여야한다.

Create NLB


ALB를 Elastic IP를 지원하지 않으므로 NLB를 사용하여야만 해당 솔루션을 구축할 수 있습니다. (loadBalancer의 IP 주소들은 동적이므로 시간이 지남에 따라 변하여 클라이언트가 화이트리스트에 추가하여도 연결 이슈가 발생할 수 밖에 없습니다.)

Associate with Target Group


Check EIP



NLB 생성 완료 후, dig를 통해 IP를 확인하면

성공적으로 EIP가 표시되는 것을 확인할 수 있다.

이하 독스를 통해 내용을 다시 한 번 확인할 수 있다.
https://repost.aws/knowledge-center/elb-attach-elastic-ip-to-public-nlb

0개의 댓글