๐Ÿ™‚ 0527 [AWS]

๋ง์ง€ยท2022๋…„ 5์›” 27์ผ
0
post-custom-banner

๐Ÿ“Œ AWS

๐Ÿ“™ AWS ์Šคํ† ๋ฆฌ์ง€ ์„œ๋น„์Šค

โœ”๏ธ 1. ๋ธ”๋ก์Šคํ† ๋ฆฌ์ง€ - OS, ์•ฑ์„ค์น˜
โœ”๏ธ 2. ๊ฐ์ฒด์Šคํ† ๋ฆฌ์ง€ - URL ๋งํฌ์ƒ์„ฑ -> http ์ •์ ์›น์‚ฌ์ดํŠธ์— ์‚ฌ์šฉ
โœ”๏ธ 3. ํŒŒ์ผ์Šคํ† ๋ฆฌ์ง€ - ๋„คํŠธ์›Œํฌ๋กœ ์—ฐ๊ฒฐ๋œ ๊ณต์œ ํด๋”์— ์ ‘๊ทผ, NFS, SAMBA

๐Ÿ“Œ AWS - EBS (๋ธ”๋ก์Šคํ† ๋ฆฌ์ง€)

Elastic Block Store

๐Ÿš€ 1. ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ์‹œ ์Šคํ† ๋ฆฌ์ง€ ์ถ”๊ฐ€ (ex.์œˆ๋„์šฐ D๋“œ๋ผ์ด๋ธŒ)

๐Ÿ“™ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ

โœ”๏ธ ์ธ์Šคํ„ด์Šค ์ด๋ฆ„ : WEB01
โœ”๏ธ ์ด๋ฏธ์ง€ : Amazon Linux 2 Kernel 5.10 AMI 2.0.20220426.0 x86_64 HVM gp2
โœ”๏ธ ์ธ์Šคํ„ด์Šค ์œ ํ˜• : t2.micro
โœ”๏ธ ํ‚ค ํŽ˜์–ด : aws-key(์–ด์ œ ๋งŒ๋“ค์–ด๋‘” ํ‚ค)
โœ”๏ธ ๋„คํŠธ์›Œํฌ ์„ค์ • :
-์„œ๋ธŒ๋„ท : 2a
-๋ณด์•ˆ๊ทธ๋ฃน : SG-WEB
โœ”๏ธ ์Šคํ† ๋ฆฌ์ง€ ๊ตฌ์„ฑ :
์ƒˆ ๋ณผ๋ฅจ ์ถ”๊ฐ€ 8gib, gp2 EBS ๋ณผ๋ฅจ

โœ”๏ธ ๊ณ ๊ธ‰ ์„ธ๋ถ€์ •๋ณด ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ :

#!/bin/bash
yum install -y httpd
systemctl enable --now httpd
echo "<h1>WEB01</h1>" > /var/www/html/index.html

โœ”๏ธ ์ธ์Šคํ„ด์Šค ์‹œ์ž‘

๐Ÿ“™ ์Šคํ† ๋ฆฌ์ง€ ํ™•์ธ ๋ฐ CLI๋กœ ์ ‘๊ทผํ•˜์—ฌ ๋งˆ์šดํŠธ

โœ”๏ธ 0. ๋งˆ์šดํŠธ ์—ฌ๋ถ€ ํ™•์ธ

[ec2-user@ip-172-31-9-45 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        474M     0  474M   0% /dev
tmpfs           483M     0  483M   0% /dev/shm
tmpfs           483M  416K  482M   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
[ec2-user@ip-172-31-9-45 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   8G  0 disk
โ””โ”€xvda1 202:1    0   8G  0 part /
xvdb    202:16   0   8G  0 disk

โœ”๏ธ 1. ๋งˆ์šดํŠธ ์ง„ํ–‰

[ec2-user@ip-172-31-9-45 ~]$ sudo mkfs -t ext4 /dev/xvdb //ํฌ๋งท

[ec2-user@ip-172-31-9-45 ~]$ ls /
bin   dev  home  lib64  media  opt   root  sbin  sys  usr
boot  etc  lib   local  mnt    proc  run   srv   tmp  var


[ec2-user@ip-172-31-9-45 ~]$ sudo mount /dev/xvdb /mnt ๋งˆ์šดํŠธ 

โœ๏ธ /dev/xvdb ์ด ์žฅ์น˜๋ฅผ /mntํด๋”์™€ ์—ฐ๊ฒฐ

โœ”๏ธ 2. ๋งˆ์šดํŠธ ํ™•์ธ ๋ฐ ํ…Œ์ŠคํŠธ ํŒŒ์ผ ์ƒ์„ฑ


[ec2-user@ip-172-31-9-45 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        474M     0  474M   0% /dev
tmpfs           483M     0  483M   0% /dev/shm
tmpfs           483M  416K  482M   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
/dev/xvdb       7.8G   36M  7.3G   1% /mnt

[ec2-user@ip-172-31-9-45 ~]$ sudo vi /mnt/test.txt
hello

โœ”๏ธ 3. Elastic Block Store - ๋ณผ๋ฅจ - ์—ฐ๊ฒฐ๋œ ์ธ์Šคํ„ด์Šค ; ๋ฃจํŠธ๋ณผ๋ฅจ ํ™•์ธ ๊ฐ€๋Šฅ

๐Ÿš€ 2. ์ด๋ฏธ ์‹คํ–‰๋˜๊ณ  ์žˆ๋Š” ์ธ์Šคํ„ด์Šค์— ๋ณผ๋ฅจ ์ถ”๊ฐ€

๐Ÿ“™ new๋ณผ๋ฅจ ์ƒ์„ฑ

โœ”๏ธ 0. Elastic Block Store - ๋ณผ๋ฅจ - ๋ณผ๋ฅจ์ƒ์„ฑ
โœ”๏ธ 1. ๋ณผ๋ฅจ ์„ค์ • - ์œ ํ˜• : ๋ฒ”์šฉ SSD(gp2) - ํฌ๊ธฐ : 8GiB - ๊ฐ€์šฉ์˜์—ญ : 2a

๐Ÿ“ข ์ฃผ์˜์‚ฌํ•ญ 1 : 2a์— ๋งŒ๋“  ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐํ•  ๋ณผ๋ฅจ์ด๋ฏ€๋กœ ๋ณผ๋ฅจ ๋˜ํ•œ 2a์— ์ƒ์„ฑํ•ด์•ผํ•œ๋‹ค.
๐Ÿ“ข ์ฃผ์˜์‚ฌํ•ญ 2 :์•”ํ˜ธํ™”๊ฐ€ ๋˜์ง€ ์•Š์€์ƒํƒœ๋กœ ๋งŒ๋“  ๋””์Šคํฌ๋Š” ๋‹ค์‹œ ์•”ํ˜ธํ™” ์‹œํ‚ฌ ์ˆ˜๋Š” ์—†๋‹ค. ๋Œ€์•ˆ์ด ์žˆ๊ธด ํ•˜์ง€๋งŒ ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ์•”ํ˜ธํ™”๋Š” ๋ถˆ๊ฐ€.

โœ”๏ธ 2. ํƒœ๊ทธ - ํƒœ๊ทธ์ถ”๊ฐ€ - ํ‚ค :Name - ๊ฐ’ : WEB01-ADD - ๋ณผ๋ฅจ์ƒ์„ฑ

๐Ÿ“™ ๋ณผ๋ฅจ ์—ฐ๊ฒฐ

โœ”๏ธ 1. Elastic Block Store - ๋ณผ๋ฅจ - WEB01-ADD ์„ ํƒ - ์ž‘์—… - ๋ณผ๋ฅจ ์—ฐ๊ฒฐ

โœ”๏ธ 2. ์ธ์Šคํ„ด์Šค ์„ ํƒ, ๋””๋ฐ”์ด์Šค ์ด๋ฆ„ ๊ธฐ์ž…(default์‚ฌ์šฉ) - ๋ณผ๋ฅจ ์—ฐ๊ฒฐ

โœ”๏ธ 3. CLIํ™˜๊ฒฝ์—์„œ ํ™•์ธ

[ec2-user@ip-172-31-9-45 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   8G  0 disk
โ””โ”€xvda1 202:1    0   8G  0 part /
xvdb    202:16   0   8G  0 disk /mnt
xvdf    202:80   0   8G  0 disk

โœ”๏ธ 4. ๋งˆ์šดํŠธ


[ec2-user@ip-172-31-9-45 ~]$ sudo mkfs -t ext4 /dev/xvdf

[ec2-user@ip-172-31-9-45 ~]$ mkdir ebs-share

[ec2-user@ip-172-31-9-45 ~]$ sudo mount /dev/xvdf ~/ebs-share

[ec2-user@ip-172-31-9-45 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        474M     0  474M   0% /dev
tmpfs           483M     0  483M   0% /dev/shm
tmpfs           483M  476K  482M   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
/dev/xvdb       7.8G   36M  7.3G   1% /mnt
tmpfs            97M     0   97M   0% /run/user/0
/dev/xvdf       7.8G   36M  7.3G   1% /home/ec2-user/ebs-share
[ec2-user@ip-172-31-9-45 ~]$

๐Ÿ“™ root๋ณผ๋ฅจ์— ์žˆ๋˜ ํŒŒ์ผ ์ถ”๊ฐ€๋œ ๋ณผ๋ฅจ์œผ๋กœ ์˜ฎ๊ธฐ๊ธฐ

โœ”๏ธ 0. mobaxtermํ†ตํ•ด์„œ home์— ํŒŒ์ผ ๋„ฃ๊ธฐ (aws.tar)

โœ”๏ธ 1. ํ™ˆํŽ˜์ด์ง€ ๋””์ž์ธ tarํŒŒ์ผ ์ ์šฉ

[ec2-user@ip-172-31-9-45 ~]$ sudo tar -xvf aws.tar -C /var/www/html

โœ”๏ธ 2. ์˜ฎ๊ธฐ๊ธฐ

[ec2-user@ip-172-31-9-45 ~]$ sudo mv aws.tar ebs-share/

๐Ÿš€ 3. root๋ณผ๋ฅจ ํฌ๊ธฐ ๋Š˜๋ฆฌ๊ธฐ(web01)

โœ”๏ธ 0. ๋ณผ๋ฅจ - web01 root๋ณผ๋ฅจ ์„ ํƒ - ์ž‘์—… -๋ณผ๋ฅจ ์ˆ˜์ •

โœ”๏ธ 1. ํฌ๊ธฐ 10GiB๋กœ ํ™•์žฅ

โœ”๏ธ 2. CLIํ™˜๊ฒฝ์—์„œ ํ™•์ธ ํ›„ ํŒŒํ‹ฐ์…˜ ์šฉ๋Ÿ‰ ํ™•์ธ

[ec2-user@ip-172-31-9-45 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  10G  0 disk
โ””โ”€xvda1 202:1    0   8G  0 part /
xvdb    202:16   0   8G  0 disk /mnt
xvdf    202:80   0   8G  0 disk /home/ec2-user/ebs-share

[ec2-user@ip-172-31-9-45 ~]$ 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  482M   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
/dev/xvdb       7.8G   36M  7.3G   1% /mnt
/dev/xvdf       7.8G   38M  7.3G   1% /home/ec2-user/ebs-share

โœ๏ธ ์•„์ง ์šฉ๋Ÿ‰์ด ์‹ค์งˆ์ ์œผ๋กœ ๋Š˜์–ด๋‚˜์ง€ ์•Š์•˜์Œ. df -h์—์„œ ๋‚˜์˜ค๋Š” ์šฉ๋Ÿ‰์ด 10G๋กœ ๋ฐ”๋€Œ์–ด์•ผ ํ•จ.

โœ”๏ธ 3. ๋ช…๋ น์–ด ํ†ตํ•ด ์šฉ๋Ÿ‰ ํ™•์žฅ ๋ฐ˜์˜

[ec2-user@ip-172-31-9-45 ~]$ sudo growpart /dev/xvda 1 // ํŒŒํ‹ฐ์…˜ ์šฉ๋Ÿ‰ ํ™•์žฅ

CHANGED: partition=1 start=4096 old: size=16773087 end=16777183 new: size=20967391 end=20971487


[ec2-user@ip-172-31-9-45 ~]$ lsblk

NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  10G  0 disk
โ””โ”€xvda1 202:1    0  10G  0 part /
xvdb    202:16   0   8G  0 disk /mnt
xvdf    202:80   0   8G  0 disk /home/ec2-user/ebs-share

[ec2-user@ip-172-31-9-45 ~]$ sudo xfs_growfs -d /

meta-data=/dev/xvda1             isize=512    agcount=4, agsize=524159 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1 spinodes=0
data     =                       bsize=4096   blocks=2096635, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 2096635 to 2620923


[ec2-user@ip-172-31-9-45 ~]$ 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  482M   1% /run
tmpfs           483M     0  483M   0% /sys/fs/cgroup
/dev/xvda1       10G  1.6G  8.5G  16% /
tmpfs            97M     0   97M   0% /run/user/1000
/dev/xvdb       7.8G   36M  7.3G   1% /mnt
/dev/xvdf       7.8G   38M  7.3G   1% /home/ec2-user/ebs-share

๐Ÿš€ 4. ๋‹ค๋ฅธ ๊ฐ€์šฉ์˜์—ญ์— ์žˆ๋Š” ์ธ์Šคํ„ด์Šค๋กœ ๋ณผ๋ฅจ ์˜ฎ๊ธฐ๊ธฐ

๐Ÿ“™ ์ƒˆ๋กœ์šด ๊ฐ€์šฉ์„œ๋ฒ„์˜ ์›น์„œ๋ฒ„(์ธ์Šคํ„ด์Šค) ์ƒ์„ฑ

โœ”๏ธ ์ธ์Šคํ„ด์Šค ์ด๋ฆ„ : WEB02
โœ”๏ธ ์ด๋ฏธ์ง€ : Canonical, Ubuntu, 18.04 LTS, amd64 bionic image build on 2022-04-11
โœ”๏ธ ์ธ์Šคํ„ด์Šค ์œ ํ˜• : t2.micro
โœ”๏ธ ํ‚ค ํŽ˜์–ด : aws-key(์–ด์ œ ๋งŒ๋“ค์–ด๋‘” ํ‚ค)
โœ”๏ธ ๋„คํŠธ์›Œํฌ ์„ค์ • :
-์„œ๋ธŒ๋„ท : 2c
-๋ณด์•ˆ๊ทธ๋ฃน : SG-WEB
โœ”๏ธ ์Šคํ† ๋ฆฌ์ง€ ๊ตฌ์„ฑ : ๊ทธ๋Œ€๋กœ

โœ”๏ธ ๊ณ ๊ธ‰ ์„ธ๋ถ€์ •๋ณด ์‚ฌ์šฉ์ž ๋ฐ์ดํ„ฐ :

#!/bin/bash
apt update
apt install -y  apache2

โœ”๏ธ ์ธ์Šคํ„ด์Šค ์‹œ์ž‘ ํด๋ฆญ
โœ”๏ธ web02 ํผ๋ธ”๋ฆญ IP , key์ด์šฉํ•˜์—ฌ ์ ‘์†
โœ”๏ธ ์šฉ๋Ÿ‰ํ™•์ธ

ubuntu@ip-172-31-47-102:~$ lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0     7:0    0 43.6M  1 loop /snap/snapd/15177
loop1     7:1    0 55.5M  1 loop /snap/core18/2344
loop2     7:2    0 26.7M  1 loop /snap/amazon-ssm-agent/5163
xvda    202:0    0    8G  0 disk
โ””โ”€xvda1 202:1    0    8G  0 part /

๐Ÿ“™ web01 ๋ณผ๋ฅจ mountํ•ด์ œํ•˜๊ธฐ

โœ”๏ธ 0. mobaxterm์œผ๋กœ web01 CLIํ™˜๊ฒฝ์œผ๋กœ ์ง„์ž… ํ•ด์„œ ์–ธ๋งˆ์šดํŠธ ์ง„ํ–‰

[ec2-user@ip-172-31-9-45 ~]$ sudo umount /home/ec2-user/ebs-share

๐Ÿ“ข ์ฃผ์˜์‚ฌํ•ญ : ๋งˆ์šดํŠธ๋˜์–ด์žˆ๋Š” ํด๋”์—์„œ umount ๋ถˆ๊ฐ€.

โœ”๏ธ 1. EC2 ๋ณผ๋ฅจ์—์„œ attatch๋˜์–ด์žˆ๋Š” ๋ณผ๋ฅจ ์„ ํƒ - ์ž‘์—… - ๋ณผ๋ฅจ ๋ถ„๋ฆฌ

๐Ÿ“™ ์Šค๋ƒ…์ƒท ์ด์šฉํ•˜์—ฌ ๋ณผ๋ฅจ ๊ฐ€์šฉ์˜์—ญ ๋ฐ”๊ฟ” ์—ฐ๊ฒฐํ•˜๊ธฐ

๋‚ด์šฉ๋ฌผ ๋ณต์‚ฌ, ๊ฐ€์šฉ์˜์—ญ ๋ฐ”๊พผ ์ƒˆ๋กœ์šด ๋ณผ๋ฅจ ์ƒ์„ฑ

โœ”๏ธ 1. EBS - ์Šค๋ƒ…์ƒท - ์Šค๋ƒ…์ƒท ์ƒ์„ฑ - ๋ณผ๋ฅจ ID : web-add

โœ”๏ธ 2. ํƒœ๊ทธ ํ‚ค : Name- ๊ฐ’ : WEB01-ADD-SNAPSHOT - ์Šค๋ƒ…์ƒท ์ƒ์„ฑ

โœ”๏ธ 3. ์ƒ์„ฑํ•œ ์Šค๋ƒ…์ƒท ์„ ํƒ - ์ž‘์—… - ์Šค๋ƒ…์ƒท์—์„œ ๋ณผ๋ฅจ ์ƒ์„ฑ - ๊ฐ€์šฉ์˜์—ญ : 2C

โœ”๏ธ 4. ํƒœ๊ทธ - ํ‚ค : Name - ๊ฐ’ : WEB01-ADD-SNAPSHOT-2C-VOL - ๋ณผ๋ฅจ ์ƒ์„ฑ

โœ”๏ธ 5. ํ•ด๋‹น ๋ณผ๋ฅจ ์„ ํƒ - ์ž‘์—… - ๋ณผ๋ฅจ์—ฐ๊ฒฐ - WEB02์„ ํƒ - ๋ณผ๋ฅจ ์—ฐ๊ฒฐ

๐Ÿ“™ CLIํ†ตํ•ด์„œ web02์™€ ๋ณผ๋ฅจ ๋งˆ์šดํŠธํ•˜๊ธฐ

โœ”๏ธ 0. xvdf lsblk, df -h ํ™•์ธ
-> lsblk์—๋Š” ์žˆ์œผ๋‚˜ ๋งˆ์šดํŠธ๋Š” ์•ˆ๋˜์–ด์žˆ๋Š” ์ƒํ™ฉ.

ubuntu@ip-172-31-47-102:~$ lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0     7:0    0 43.6M  1 loop /snap/snapd/15177
loop1     7:1    0 55.5M  1 loop /snap/core18/2344
loop2     7:2    0 26.7M  1 loop /snap/amazon-ssm-agent/5163
xvda    202:0    0    8G  0 disk
โ””โ”€xvda1 202:1    0    8G  0 part /
ubuntu@ip-172-31-47-102:~$ lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0     7:0    0 43.6M  1 loop /snap/snapd/15177
loop1     7:1    0 55.5M  1 loop /snap/core18/2344
loop2     7:2    0 26.7M  1 loop /snap/amazon-ssm-agent/5163
xvda    202:0    0    8G  0 disk
โ””โ”€xvda1 202:1    0    8G  0 part /
xvdf    202:80   0    8G  0 disk

ubuntu@ip-172-31-47-102:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            473M     0  473M   0% /dev
tmpfs            98M  776K   97M   1% /run
/dev/xvda1      7.7G  1.4G  6.3G  19% /
tmpfs           488M     0  488M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           488M     0  488M   0% /sys/fs/cgroup
/dev/loop0       44M   44M     0 100% /snap/snapd/15177
/dev/loop1       56M   56M     0 100% /snap/core18/2344
/dev/loop2       27M   27M     0 100% /snap/amazon-ssm-agent/5163
tmpfs            98M     0   98M   0% /run/user/1000

โœ”๏ธ 1. mount ์ง„ํ–‰

ubuntu@ip-172-31-47-102:~$ mkdir ebs-share

ubuntu@ip-172-31-47-102:~$ sudo mount /dev/xvdf ebs-share

ubuntu@ip-172-31-47-102:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            473M     0  473M   0% /dev
tmpfs            98M  776K   97M   1% /run
/dev/xvda1      7.7G  1.4G  6.3G  19% /
tmpfs           488M     0  488M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           488M     0  488M   0% /sys/fs/cgroup
/dev/loop0       44M   44M     0 100% /snap/snapd/15177
/dev/loop1       56M   56M     0 100% /snap/core18/2344
/dev/loop2       27M   27M     0 100% /snap/amazon-ssm-agent/5163
tmpfs            98M     0   98M   0% /run/user/1000
/dev/xvdf       7.8G   38M  7.3G   1% /home/ubuntu/ebs-share


ubuntu@ip-172-31-47-102:~$ ls ebs-share
aws.tar  lost+found

๐Ÿ“ข ์ฃผ์˜์‚ฌํ•ญ : ๋งˆ์šดํŠธ ํ•˜๊ธฐ ์ „ ํฌ๋งทํ•˜๋ฉด ์•ˆ ๋จ web01์—์„œ ์ €์žฅํ•œ ๋ฐ์ดํ„ฐ ๋‚ ์•„๊ฐ!

โœ”๏ธ 2. ์—ฐ๊ฒฐ๋œ ๋ณผ๋ฅจ์— ์žˆ๋˜ tarํŒŒ์ผ ์ด์šฉํ•˜์—ฌ ์›นํ™ˆํŽ˜์ด์ง€ ๊พธ๋ฏธ๊ธฐ

ubuntu@ip-172-31-47-102:~$ sudo tar -xvf ebs-share/aws.tar -C /var/www/html/

๐Ÿš€ ์Šค๋ƒ…์ƒท ์ด์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ ์œ ์ง€ํ•˜๋ฉด์„œ ๋‹ค๋ฅธ ์ง€์—ญ์— ์ธ์Šคํ„ด์Šค ๋งŒ๋“ค๊ธฐ

์Šค๋ƒ…์ƒท ๋ณต์‚ฌ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ ๋ณด๊ด€ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค๋ฅธ ๋จธ์‹ ์œผ๋กœ ์˜ฎ๊ธฐ๋Š” ์ž‘์—…(๋ฐฑ์—…)

โœ”๏ธ EBS- ๋ณผ๋ฅจ - ์ด๋ฆ„ ์ถ”๊ฐ€(WEB01-ROOT) ํ›„ ์—”ํ„ฐ

โœ”๏ธ WEB01-ROOT์„ ํƒ - ์ž‘์—… - ์Šค๋ƒ…์ƒท ์ƒ์„ฑ - ํƒœ๊ทธ ๊ฐ’ : WEB01-ROOT-SNAPSHOT

โœ”๏ธ ์Šค๋ƒ…์ƒท WEB01-ROOT- SNAPSHOT ์„ ํƒ - ์ž‘์—… - ์Šค๋ƒ…์ƒท ๋ณต์‚ฌ - ๋Œ€์ƒ ๋ฆฌ์ „ : ap-northeast-1(๋„์ฟ„) - ์Šค๋ƒ…์ƒท ๋ณต์‚ฌ ํด๋ฆญ

โœ”๏ธ ์ƒˆ ํƒญ์œผ๋กœ ๋˜‘๊ฐ™์€ ํ™”๋ฉด ์—ด์–ด์„œ Region ๋„์ฟ„๋กœ ๋ฐ”๊พธ๊ธฐ

๐Ÿ“™ ์Šค๋ƒ…์ƒท(๋„์ฟ„)์„ ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค๊ธฐ

โœ”๏ธ ์Šค๋ƒ…์ƒท ์„ ํƒ - ์ž‘์—… - ์Šค๋ƒ…์ƒท์—์„œ ์ด๋ฏธ์ง€ ์ƒ์„ฑ

โœ”๏ธ ์ด๋ฏธ์ง€ ์ด๋ฆ„ : SEOUL-IMAGE - ์ด๋ฏธ์ง€ ์ƒ์„ฑ

โœ”๏ธ EC2 ์™ผ์ชฝ๋ฉ”๋‰ด - ์ด๋ฏธ์ง€ - AMI

๐Ÿ“™ ์ด๋ฏธ์ง€๋กœ ์›น์„œ๋ฒ„(์ธ์Šคํ„ด์Šค) ์ƒ์„ฑ

โœ”๏ธ ๋„์ฟ„์—์„œ, ์ธ์Šคํ„ด์Šค - ์ธ์Šคํ„ด์Šค ์‹œ์ž‘

โœ”๏ธ ์ด๋ฆ„ : TOKYO-WEB01 - ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฐ ์ด๋ฏธ์ง€ : ๋‚ด AMI - ๋‚ด ์†Œ์œ  : SEOUL-IMAGE

โœ”๏ธ์ธ์Šคํ„ด์Šค ์œ ํ˜• : t2.micro - ํ‚ค ํŽ˜์–ด : ํ‚ค ํŽ˜์–ด ์ƒ์„ฑ - ํ‚ค ํŽ˜์–ด ์ด๋ฆ„ : tokyo-key - RSA, .pem - ํ‚ค ํŽ˜์–ด ๋ฐฉ๊ธˆ ๋งŒ๋“ ๊ฑธ๋กœ ์ ์šฉ

โœ”๏ธ ๋„คํŠธ์›Œํฌ ์„ค์ • ํŽธ์ง‘ - ์„œ๋ธŒ๋„ท : 1a - ๋ณด์•ˆ๊ทธ๋ฃน ์ƒ์„ฑ - ๋ณด์•ˆ๊ทธ๋ฃน ์ด๋ฆ„ : SG-WEB -Add security group rule - HTTP ์ถ”๊ฐ€ - ์†Œ์Šค : ์œ„์น˜๋ฌด๊ด€ - ์›๋ณธ : 0.0.0.0/0 - ์ธ์Šคํ„ด์Šค ์‹œ์ž‘

โœ”๏ธํผ๋ธ”๋ฆญ IP๋ฅผ ํ†ตํ•ด ์ง„์ž…ํ•˜๋ฉด ์„œ์šธ web01 ํ™”๋ฉด ๊ทธ๋Œ€๋กœ ํ™•์ธ ๊ฐ€๋Šฅ

โœ”๏ธ๋„์ฟ„์— ์žˆ๋Š” ๊ฒƒ๋“ค ๋ชจ๋‘ ์ •๋ฆฌ (์‚ญ์ œ)
์ธ์Šคํ„ด์Šค - ์ด๋ฏธ์ง€(๊ป๋ฐ๊ธฐ) - ์Šค๋ƒ…์ƒท(์•Œ๋งน) - ํ‚คํŽ˜์–ด - ๋ณด์•ˆ๊ทธ๋ฃน ์ˆœ

๐Ÿ“Œ AWS - EFS (ํŒŒ์ผ์Šคํ† ๋ฆฌ์ง€)

Elastic File System

๐Ÿ“Œ ๊ธฐํƒ€

โญ๏ธ ์›น์„œ๋ฒ„ ์ ‘์†์ด ์•ˆ๋  ๋•Œ, ๋ณด์•ˆ๊ทธ๋ฃน ํ™•์ธ

โœ”๏ธ ๋„คํŠธ์›Œํฌ ๋ฐ ๋ณด์•ˆ - ๋ณด์•ˆ๊ทธ๋ฃน(์ธ์Šคํ„ด์Šค์— ํ• ๋‹น๋œ ๋ณด์•ˆ๊ทธ๋ฃน ์„ ํƒ) - ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™- ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™ ํŽธ์ง‘ - HTTP ๋“ฑ ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™์˜ ์†Œ์Šค์œ ํ˜•, ์†Œ์Šค ๋“ฑ ํ™•์ธ

โญ๏ธ ํŒŒํ‹ฐ์…˜ ํ™•์žฅ ๋ช…๋ น์–ด

โœ”๏ธ ํŒŒํ‹ฐ์…˜ ํ™•์žฅ


sudo growpart /dev/xvda 1

lsblk

โœ”๏ธ XFS ํŒŒ์ผ ์‹œ์Šคํ…œ ํ™•์žฅ



df -Th

sudo xfs_growfs -d /

df -Th

โญ๏ธ ๋ณผ๋ฅจ ์Šค๋ƒ…์ƒท์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ

EBS์—์„œ ๋ชปํ•˜๋Š” ๊ฒƒ๋“ค์„ ์Šค๋ƒ…์ƒท์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ,

โœ”๏ธ ์Šค๋ƒ…์ƒท ๋ณผ๋ฅจ ์ƒ์„ฑ
โœ”๏ธ ์Šค๋ƒ…์ƒท ์ด๋ฏธ์ง€ ์ƒ์„ฑ
โœ”๏ธ ์Šค๋ƒ…์ƒท ๋ณต์‚ฌ

โญ๏ธ ํผ๋ธ”๋ฆญ IP CLIํ™˜๊ฒฝ์—์„œ ๊ฐ€์ ธ์˜ค๋Š” ๋ฒ•

โœ”๏ธ meta data ๋ช…๋ น์–ด ์ด์šฉ

ubuntu@ip-172-31-47-102:~$ curl http://169.254.169.254/latest/meta-data/public-ipv4

15.164.221.185ubuntu@ip-172-31-47-102:~$

โœ”๏ธ meta data ํ†ตํ•ด์„œ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋Š” ์ •๋ณด๋“ค

ubuntu@ip-172-31-47-102:~$ curl http://169.254.169.254/latest/meta-data

ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
identity-credentials/
instance-action
instance-id
instance-life-cycle
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups

โญ๏ธ ํ‚ค ํŽ˜์–ด๋Š” region ๋‹จ์œ„๋กœ ์กด์žฌ

โญ๏ธ ELB์™€ route53

โœ”๏ธELB
region ์•ˆ ,๋‹ค๋ฅธ ๊ฐ€์šฉ์˜์—ญ์œผ๋กœ ์—ฐ๊ฒฐ ๊ฐ€๋Šฅ (multi az)

โœ”๏ธROUTE53
๋‹ค๋ฅธ region๊นŒ์ง€ ์—ฐ๊ฒฐ ๊ฐ€๋Šฅ (cross region_๊ธ€๋กœ๋ฒŒ ๋‹จ์œ„)

โญ๏ธ Failover

์„œ์šธ failover ๋‚˜๋ฉด standbyํ•˜๊ณ ์žˆ๋˜ ๋„์ฟ„ ๋“ฑ์žฅ.@@

profile
๊พธ์ค€ํžˆ, ์ฐจ๊ทผ์ฐจ๊ทผ
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€