웹 사이트 AWS에서 들어오는 트래픽 제어

로드 밸런서는 무엇입니까?
로드 밸런서는 수신되는 애플리케이션 트래픽을 여러 가용 영역의 여러 EC2 인스턴스에 분산합니다. 이렇게 하면 애플리케이션의 내결함성이 향상됩니다.
시작하다
EC2 인스턴스 생성을 시작하겠습니다.
이제 Amazon EC2 콘솔을 엽니다.

이제 왼쪽 메뉴의 인스턴스에서 인스턴스를 선택합니다.
새 인스턴스를 생성하고 구성 페이지에서 인스턴스 번호가 2를 입력하는 것을 볼 수 있습니다(동일한 구성으로 두 개의 인스턴스를 생성하고 있습니다).

인스턴스 시작
완료 방금 2개의 인스턴스를 시작했습니다.
TargetGroups를 생성해 보겠습니다.
이제 왼쪽 메뉴의 부하 분산에서 TargetGroups를 선택합니다.

새 대상 그룹 만들기

인스턴스에서 2개의 인스턴스를 선택하고 대기 중인 인스턴스에 추가하고 대상 그룹 생성을 클릭합니다.


방금 대상 그룹을 생성했습니다.
로드 밸런서를 만들어 봅시다
이제 왼쪽 메뉴의 로드 밸런싱에서 로드 밸런서를 선택합니다.

새 로드 밸런서 생성


보안 그룹에서 인스턴스에 지정한 그룹을 선택합니다.

대상 그룹에서 방금 생성한 대상 그룹을 선택합니다.

하단에서 로드 밸런서 생성을 클릭합니다.

방금 Load Balancer를 생성했습니다.
이제 인스턴스 페이지로 이동하여 첫 번째 인스턴스를 클릭합니다.

이제 연결을 클릭하고 EC2 인스턴스 연결을 사용하고 연결을 클릭하십시오.


이제 Linux 콘솔이 팝업되는 것을 볼 수 있습니다.

이제 콘솔에서 루트 액세스 권한이 필요하므로 인스턴스에 샘플 웹 사이트를 로드해야 합니다.
유형: 루트 디렉토리로 이동합니다.
sudo su
이제 코드 스니펫을 따르십시오.
yum update -y # it will update the system
yum install httpd -y # it will install the Apache Hypertext transfer protocol server program
systemctl start httpd # It will start the server
cd /var/www/html/ # After install httpd you will see the html directory where we can add our html pages which will be displayed on the brower
nano index.html # it will create a index.html file in html folder
이 HTML 데이터를 index.html 파일에 추가하십시오.
<html>
<head>
<title>
Welcome to server 1
</title>
</head>
<body>
<h1>Welcome to AWS praticse web page</h1>
</body>
</html>
파일을 저장하고 다음 명령을 입력하십시오.
systemctl enable httpd # server will be enable and it runs continuously
이제 인스턴스로 이동하여 첫 번째 인스턴스를 선택합니다. 맨 아래에 공개 주소가 표시되고 해당 주소를 복사하여 새 탭에 붙여넣으면 Welcome to server 1이라는 제목의 샘플 웹 페이지와 Welcome to AWS practice web page라는 기본 콘텐츠가 표시됩니다.


이제 다른 인스턴스에 대해 동일한 프로세스를 반복합니다.
index.html 파일에서 제목을 Welcome to server 2로 업데이트합니다.

동일한 제목을 가질 수 있지만 여기에서 웹 페이지를 로드하는 동안 실행 중인 인스턴스를 확인할 수 있습니다.
이제 왼쪽 메뉴의 로드 밸런싱에서 대상 그룹을 선택하고 TG를 선택하십시오.
맨 아래에서 두 인스턴스가 모두 정상임을 확인할 수 있습니다.

이제 로드 밸런서로 이동하여 로드 밸런서를 선택합니다.
하단에 해당 URL을 복사하여 새 탭에 붙여넣는 DNS 이름이 표시됩니다.



페이지를 새로 고치면 인스턴스가 변경될 때마다 알 수 있습니다.

새로 고침하는 동안 웹 페이지 제목이 매번 변경되는 것을 볼 수 있습니다.
새로고침할 때마다 인스턴스를 교환하여 웹 트래픽을 제어할 수 있는 방법입니다.
참고: 두 경우 모두 동일한 코드를 유지해야 합니다.
사용자가 더 많고 CPU가 80% 이상인 경우 자동 크기 조정을 사용해야 합니다.
CPU가 80%로 이동하는 자동 크기 조정에 대한 새 기사를 작성하겠습니다…
저는 AWS 초보자입니다. 기사에 문제가 있다고 생각되면 댓글을 달 수 있습니다. 그래서 나 자신을 향상시킬 수 있습니다.
** 메모:
이는 인스턴스를 삭제할 수 있는 일정 시간이 지난 후 테스트용으로만 사용됩니다. 며칠 동안 활성 상태로 유지하면 요금이 부과될 수 있으므로 인스턴스 삭제를 연습한 후.
기사를 읽어주셔서 감사합니다…

Reference
이 문제에 관하여(웹 사이트 AWS에서 들어오는 트래픽 제어), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/lmas3009/control-your-incoming-traffic-on-your-website-aws-15kl텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)