#!/bin/bash
yum install -y httpd git
systemctl enable --now httpd
echo "<h1>PAULO</h1>" > /var/www/html/index.html
(매번 IP로 들어가기 번거롭기 때문에 도메인으로 들어가기 위함)
HA-seoul 도메인 생성
이름 : ha-seoul
값 : ha-seoul IP
HA-tokyo 도메인 생성
이름 : ha-tokyo
값 : ha-tokyo IP
[ec2-user@ip-10-24-39-222 ~]$ sudo vi /etc/haproxy/haproxy.cfg
global
daemon
defaults
mode http
frontend http-in
bind *:80
default_backend backend_servers
backend backend_servers
balance roundrobin
# cookie SVID insert indirect nocache maxlife 10s
server seoul 13.125.218.137:80 cookie w1 check
server london 20.90.208.21:80 cookie w2 check
server oregon 34.127.96.169:80 cookie w3 check
server hongkong 8.210.204.64:80 cookie w4 check
server paulo 54.232.61.58:80 cookie w5 check
[ec2-user@ip-10-24-39-222 ~]$ sudo vi /etc/haproxy/haproxy.cfg
global
daemon
defaults
mode http
frontend http-in
bind *:80
default_backend backend_servers
backend backend_servers
balance roundrobin
# cookie SVID insert indirect nocache maxlife 10s
server seoul 13.125.218.137:80 cookie w1 check
server london 20.90.208.21:80 cookie w2 check
server oregon 34.127.96.169:80 cookie w3 check
server hongkong 8.210.204.64:80 cookie w4 check
server paulo 54.232.61.58:80 cookie w5 check
레코드 생성
london 추가
oregon 추가
hongkong 추가
paulo 추가
아시아이기 때문에 홍콩 나와야함
이름 : win2012
애플리케이션 및 OS 이미지 : Microsoft Windows Server 2012 R2 Base
인스턴스 유형 : t2.micro
키 페어 : win-key (새로생성)
VPC : default
서브넷 : MY-PUBLIC-SUBNET-2A
퍼블릭 IP 자동 할당 : 활성화
방화벽(보안 그룹) : (보안 그룹 생성) launch-wizard-1
에서 SSH 트래픽 허용 체크
스토리지 구성 : 8GiB gp2
win2012 체크 후 연결
-> 인스턴스 창에서 암호 가져오기 클릭
-> browse 눌러서 win-key.pem
-> 암호 해독하기
-> oregon으로 나와야함
네트워크 > 보안그룹 변경
SG-EFS로 변경
연결
[ec2-user@ip-10-24-39-222 ~]$ sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-09dd0f10bf8247685.efs.ap-northeast-2.amazonaws.com:/ /mnt
[ec2-user@ip-10-24-39-222 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 474M 0 474M 0% /dev
tmpfs 483M 0 483M 0% /dev/shm
tmpfs 483M 420K 483M 1% /run
tmpfs 483M 0 483M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 1.6G 6.5G 20% /
tmpfs 97M 0 97M 0% /run/user/1000
fs-09dd0f10bf8247685.efs.ap-northeast-2.amazonaws.com:/ 8.0E 0 8.0E 0% /mnt
# vi /etc/ipsec.d/aws.conf
conn Tunnel1
authby=secret
auto=start
left=%defaultroute
leftid=123.142.252.25 //학원IP
right=52.78.58.119 //구성정보 내
type=tunnel
ikelifetime=8h
keylife=1h
phase2alg=aes128-sha1;modp1024
ike=aes128-sha1;modp1024
keyingtries=%forever
keyexchange=ike
leftsubnet=192.168.0.0/20 //학원
rightsubnet=10.24.0.0/16 //AWS(MY-VPC)
dpddelay=10
dpdtimeout=30
dpdaction=restart_by_peer
overlapip=yes
conn Tunnel2
authby=secret
auto=start
left=%defaultroute
leftid=123.142.252.25
right=52.79.104.82
type=tunnel
ikelifetime=8h
keylife=1h
phase2alg=aes128-sha1;modp1024
ike=aes128-sha1;modp1024
keyingtries=%forever
keyexchange=ike
leftsubnet=192.168.0.0/20
rightsubnet=10.24.0.0/16
dpddelay=10
dpdtimeout=30
dpdaction=restart_by_peer
overlapip=yes
vi /etc/ipsec.d/aws.secrets
123.142.252.25 52.78.58.119: PSK "Prb2hHOSnkLZbqrJuLHkO1ZYbMpi0_TS"
123.142.252.25 52.79.104.82: PSK "yFXI85e7D7id3GQjpx6zwXaNCS7lLixk"
systemctl restart ipsec
[centos@centos7 ~]$ ping 10.24.39.222
-> ping 나가야함
[ec2-user@ip-10-24-39-222 ~]$ ping 192.168.9.202
-> ha-seoul에서 centos로 ping 나가야함
VPC > 보안그룹 > SG-EFS > 인바운드 규칙
NFS, 192.168.0.0/0 추가
NFS, 10.24.0.0/6 추가
마운트
[centos@centos7 ~]$ sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 10.24.13.87:/ /mnt
[centos@centos7 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 472M 0 472M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 13M 483M 3% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/vda1 10G 1.1G 9.0G 11% /
tmpfs 100M 0 100M 0% /run/user/1000
10.24.13.87:/ 8.0E 0 8.0E 0% /mnt
[centos@centos7 ~]$ sudo cp aws.tar /mnt/
-> openstack /mnt에 복사 후
[ec2-user@ip-10-24-39-222 ~]$ ls /mnt
aws.tar
-> aws /mnt에서 확인 가능
CPU 4C
RAM 16GB
SSD 128GB
CPU 4C
RAM 16GB(12GB)
SSD 128G(Cache 150GB)
MY-FGW > 설정편집
새 표준 하드 디스크 추가 (150GB)
게이트웨이 : MY-SGW
버킷 이름 : s3.hyejin36.shop
제어판 > 프로그램
예제 명령
mount -o nolock -o mtype=hard 192.168.0.145:/s3.hyejin36.shop z: