aws 서비스중에 Load Balancing을 사용하면 http를 https로 연결되게 할 수 있다.
가장먼저 certificate manager로 가서 발급을 인증서를 발급받아야한다.
화면 오른쪽에 요청을 누른다.
public으로 받자
users에서 Add users를 누르자
domain name을 적어주고 나머지는 그대로 두면 된다. =
*.abc.com 이런식으로 등록함면 하위 도메인들이 모두 사용할 수 있는 인증서가 된다.
쉽게 말해서 kakao.abc.com / ya.abc.com 등등 모든 하위 도메인이 사용할 수 있는 인증서가 된다.
단, abc.com은 사용하지 못하니 abc.com도 사용하고 싶으면 "이 인증서에 다른 이름 추가"를 눌러준다.
그리고 마짐가에 요청 눌러주면 됩니다.
다음 페이지에서는 검증 방법으로 DNS 검증을 하시면 조금더 수월하십니다. \
그리고 확인을 눌르시면 "검증 보류" 상태일겁니다. 거기서 계속을 눌르시면
파란색 버튼으로 Route 53에서 레코드 생성이 있는데 그걸 눌러주세요
그럼 Route 53을 통해 자동으로 CNAME이 등록이되며 DNS 검증이 시작됩니다.
그리고 다시 확인했을 때 Route 53에 DNS 레코드가 생성되었다는 메세지가 나오면 됩니다.
20~30분 기다리시면 발급완료가 됩니다.
자 그럼 이 인증서는 조금뒤에 사용하니 가지고 계시고
다음 스텝으로 넘어가봅시다.
이제 ec2로 가셔서 왼쪽 bar를 보시면 로드 밸런싱이라는게 있습니다. 그걸 눌러주시고
왼쪽 상단에 로드밸런싱 생성이 있으니 눌러주세요
그럼 이렇게 3가지가 있는데 제일 첫 번째인 Application Load Balancer의 생성을 눌러주세요
그럼 여러가지가 아래로 쭉 나열될텐데
한칸씩 작성해 봅시다.
첫 번째 칸은 이름만 작성해주시면 됩니다.
원하는 name으로 작성하시고 다음 칸으로 넘어갑니다.
네모 박스칸 4개를 전부 클릭해주세요
이런식으로 쭉 해주시면 됩니다.
보안 그룹은 ec2인스턴스랑 같은 보안 그룹으로 해주시기 바랍니다.
그리고 중요한 listeners 와 routing입니다. 집중해서 보세요
기본은 http 80만 되어있는데 추가하셔서 https 443도 추가해주세요
그런뒤 여러분들은 아마 target group이 없기에 새로 하나 만들어주셔야 됩니다.
저기 아래 create target group를 눌러주세요
그럼 새로운 페이지로 넘어가는데 아무것도 누르지 마시고 target group name만 입력하시고 next 눌러주시면 됩니다.
그럼 이런식으로 나오는데 네모칸에 80적으시고 include as pending below를 누르시고 오른쪽 맨 아래 타겟 그룹 생성을 누르시면 됩
니다.
그리고
이걸누르시고 default action 글자 아래 화살표 누르시면 방금 우리가 만든 타겟 그룹이 나옵니다. http와 https모두 적용시켜주세요
그리고 드디어 마지막 칸
security policy는 그대로 두시고 오른쪽 From ACM을 고르시고 옆에칸 화살표를 누르시면 아까 우리가 처음에 발급한 인증서가 나옵니다 그걸 누르시면 됩니다.
그리고나서 드디어 로드 밸런서 생성을 누르세요
그럼 방금 우리가 만든 로드 밸런서가 있을 겁니다.
거기서 듣기를 눌러주세요
그럼 아까 우리가 설정한 http 80과 http 443이 보입니다.
여기서부터 중요합니다. 조금 더 오른쪽을 보시면
이렇게 규칙이 있습니다.
지금 부터 우리는 이 규칙을 두 listener 다 수정해 줄겁니다.
먼저 http 80 수정을 눌러주세요
그럼 이렇게 창이 넘어가고 저기 위에 연필 왼쪽에 " + " 버튼을 눌러주세요
규칙 추가를 눌러주시고
if 칸에 처음 증명서 만드실때 쓴 도메인 쓰시면 됩니다.
*.abc.com이였다면 이렇게 쓰시면 됩니다. v 표시누르고 오른쪽 THEN에서 추가누르시고
Redirect to에다 https s443 적으시고 나머지는 그대로 두시면 됩니다. 그리고 동작 추가를 누르시면 끝
그리고 다음으로 https:443입니다. 이또한 이전과 마찬가리고 +누르시고
if 똑같이하시고 오른쪽 THEN은 아까만든 타겟 그룹을 넣으시고 비중을 입력해주시면 됩니다. 전 100으로 햇습니다.
자그러면 연결 완료 !