1.
2.
3.
4.
5.
6.
7.
: 기존의 생성된 키 페어가 있을 경우 기존 키 페어 선택
: 키 페어 이름 지정 후 키 페어 다운로드 버튼 클릭
8.
: 인스턴스 보기 버튼 클릭
9.
10.
14.
: 위의 목록 중 해당 머신의 빈곳에서 우클릭
15.
: 인스턴스 연결 관련 정보는 하기 이미지와 다를 수 있음
16.
: 인스턴스 생성 시 생성한 pem 파일을 ppk 파일로 변환하려면 클릭
17.
: putty 실행 후 인스턴스의 퍼블릭 DNS -> Host Name (or IP address)에 입력
ex) ubuntu@퍼블릭 DNS
18.
: 좌측 카테고리에서 SSH > Auth 클릭
: Browser 버튼을 클릭하여 변환한 ppk 파일을 찾아 경로 지정
19.
: 예 버튼 클릭 후 원격 접속 진행
20.
: 정상적으로 접속 성공 시 다음과 같음
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | login as: ubuntu Authenticating with public key "imported-openssh-key" Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-1021-aws x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Sun Oct 14 01:41:10 UTC 2018 System load: 0.0 Processes: 88 Usage of /: 13.3% of 7.69GB Users logged in: 0 Memory usage: 13% IP address for eth0: Swap usage: 0% Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 0 packages can be updated. 0 updates are security updates. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. | cs |
21.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | $ curl -sL https://deb.nodesource.com/setup_10.x | su -E bash - ## Installing the NodeSource Node.js 10.x repo... ## Populating apt-get cache... + apt-get update Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic InRelease Get:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelse [88.7 kB] Get:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-backports InRease [74.6 kB] Get:4 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/restricted Soces [5324 B] Get:5 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main Sources 29 kB] Get:6 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/universe Sours [9051 kB] Get:7 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB] Get:8 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/multiverse Soces [181 kB] Get:9 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/universe amd6Packages [8570 kB] Get:10 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/universe Tralation-en [4941 kB] Get:11 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/multiverse a64 Packages [151 kB] Get:12 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/multiverse Tnslation-en [108 kB] Get:13 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/univse Sources [87.8 kB] Get:14 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/restcted Sources [2064 B] Get:15 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/multerse Sources [3212 B] Get:16 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/mainources [196 kB] Get:17 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/mainmd64 Packages [401 kB] Get:18 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/mainranslation-en [149 kB] Get:19 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/restcted amd64 Packages [7028 B] Get:20 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/restcted Translation-en [3076 B] Get:21 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/univse amd64 Packages [560 kB] Get:22 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/univse Translation-en [145 kB] Get:23 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/multerse amd64 Packages [5708 B] Get:24 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/multerse Translation-en [3176 B] Get:25 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-backports/unerse Sources [1188 B] Get:26 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-backports/unerse amd64 Packages [2852 B] Get:27 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-backports/unerse Translation-en [1200 B] Get:28 http://security.ubuntu.com/ubuntu bionic-security/main Sources [51.6 kB Get:29 http://security.ubuntu.com/ubuntu bionic-security/multiverse Sources [16 B] Get:30 http://security.ubuntu.com/ubuntu bionic-security/universe Sources [19.kB] Get:31 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1 kB] Get:32 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [.3 kB] Get:33 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packag [85.1 kB] Get:34 http://security.ubuntu.com/ubuntu bionic-security/universe Translation- [46.8 kB] Get:35 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packes [1440 B] Get:36 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translatioen [996 B] Fetched 26.1 MB in 5s (5313 kB/s) Reading package lists... Done ## Confirming "bionic" is supported... + curl -sLf -o /dev/null 'https://deb.nodesource.com/node_10.x/dists/bionic/Release' ## Adding the NodeSource signing key to your keyring... + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - OK ## Creating apt sources list file for the NodeSource Node.js 10.x repo... + echo 'deb https://deb.nodesource.com/node_10.x bionic main' > /etc/apt/sources.list.d/nodesource.list + echo 'deb-src https://deb.nodesource.com/node_10.x bionic main' >> /etc/apt/sources.list.d/nodesource.list ## Running `apt-get update` for you... + apt-get update Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic InRelease Hit:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease Get:4 https://deb.nodesource.com/node_10.x bionic InRelease [4611 B] Get:5 https://deb.nodesource.com/node_10.x bionic/main amd64 Packages [768 B] Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease Fetched 5379 B in 1s (8255 B/s) Reading package lists... Done ## Run `sudo apt-get install -y nodejs` to install Node.js 10.x and npm ## You may also need development tools to build native addons: sudo apt-get install gcc g++ make ## To install the Yarn package manager, run: curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn | cs |
22.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | $ sudo apt-get install -y nodejs Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal Suggested packages: python-doc python-tk python2.7-doc binutils binfmt-support The following NEW packages will be installed: libpython-stdlib libpython2.7-minimal libpython2.7-stdlib nodejs python python-minimal python2.7 python2.7-minimal 0 upgraded, 8 newly installed, 0 to remove and 54 not upgraded. Need to get 19.0 MB of archives. After this operation, 88.4 MB of additional disk space will be used. Get:1 https://deb.nodesource.com/node_10.x bionic/main amd64 nodejs amd64 10.12.0-1nodesource1 [15.0 MB] Get:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7-minimal amd64 2.7.15~rc1-1 [334 kB] Get:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 python2.7-minimal amd64 2.7.15~rc1-1 [1292 kB] Get:4 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 python-minimal amd64 2.7.15~rc1-1 [28.1 kB] Get:5 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7-stdlib amd64 2.7.15~rc1-1 [1910 kB] Get:6 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 python2.7 amd64 2.7.15~rc1-1 [238 kB] Get:7 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libpython-stdlib amd64 2.7.15~rc1-1 [7620 B] Get:8 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 python amd64 2.7.15~rc1-1 [140 kB] Fetched 19.0 MB in 1s (26.7 MB/s) Selecting previously unselected package libpython2.7-minimal:amd64. (Reading database ... 56473 files and directories currently installed.) Preparing to unpack .../0-libpython2.7-minimal_2.7.15~rc1-1_amd64.deb ... Unpacking libpython2.7-minimal:amd64 (2.7.15~rc1-1) ... Selecting previously unselected package python2.7-minimal. Preparing to unpack .../1-python2.7-minimal_2.7.15~rc1-1_amd64.deb ... Unpacking python2.7-minimal (2.7.15~rc1-1) ... Selecting previously unselected package python-minimal. Preparing to unpack .../2-python-minimal_2.7.15~rc1-1_amd64.deb ... Unpacking python-minimal (2.7.15~rc1-1) ... Selecting previously unselected package libpython2.7-stdlib:amd64. Preparing to unpack .../3-libpython2.7-stdlib_2.7.15~rc1-1_amd64.deb ... Unpacking libpython2.7-stdlib:amd64 (2.7.15~rc1-1) ... Selecting previously unselected package python2.7. Preparing to unpack .../4-python2.7_2.7.15~rc1-1_amd64.deb ... Unpacking python2.7 (2.7.15~rc1-1) ... Selecting previously unselected package libpython-stdlib:amd64. Preparing to unpack .../5-libpython-stdlib_2.7.15~rc1-1_amd64.deb ... Unpacking libpython-stdlib:amd64 (2.7.15~rc1-1) ... Setting up libpython2.7-minimal:amd64 (2.7.15~rc1-1) ... Setting up python2.7-minimal (2.7.15~rc1-1) ... Linking and byte-compiling packages for runtime python2.7... Setting up python-minimal (2.7.15~rc1-1) ... Selecting previously unselected package python. (Reading database ... 57220 files and directories currently installed.) Preparing to unpack .../python_2.7.15~rc1-1_amd64.deb ... Unpacking python (2.7.15~rc1-1) ... Selecting previously unselected package nodejs. Preparing to unpack .../nodejs_10.12.0-1nodesource1_amd64.deb ... Unpacking nodejs (10.12.0-1nodesource1) ... Processing triggers for mime-support (3.60ubuntu1) ... Setting up nodejs (10.12.0-1nodesource1) ... Processing triggers for man-db (2.8.3-2) ... Setting up libpython2.7-stdlib:amd64 (2.7.15~rc1-1) ... Setting up python2.7 (2.7.15~rc1-1) ... Setting up libpython-stdlib:amd64 (2.7.15~rc1-1) ... Setting up python (2.7.15~rc1-1) ... | cs |
23.
: node.js 관련 작업 디렉터리 생성
1 2 | $ mkdir nodejs | cs |
24.
1 2 | $ cd nodejs | cs |
25.
: 관련 패키지 설치를 진행하기 전에 다음과 같이 업데이트 먼저 진행하는 것을 추천
1 2 | $ sudo npm update | cs |
26.
: mysql 패키지 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 | $ sudo npm install -y mysql npm WARN saveError ENOENT: no such file or directory, open '/home/ubuntu/nodejs/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/home/ubuntu/nodejs/package.json' npm WARN nodejs No description npm WARN nodejs No repository field. npm WARN nodejs No README data npm WARN nodejs No license field. + mysql@2.16.0 added 11 packages from 15 contributors and audited 13 packages in 1.588s found 0 vulnerabilities | cs |
27.
: cors 패키지 설치
1 2 3 4 5 6 7 8 9 10 11 12 | $ sudo npm install -y cors npm WARN saveError ENOENT: no such file or directory, open '/home/ubuntu/nodejs/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/ubuntu/nodejs/package.json' npm WARN nodejs No description npm WARN nodejs No repository field. npm WARN nodejs No README data npm WARN nodejs No license field. + cors@2.8.4 added 3 packages from 3 contributors and audited 35 packages in 1.402s found 0 vulnerabilities | cs |
28.
: express 패키지 설치
1 2 3 4 5 6 7 8 9 10 11 12 | $ sudo npm install -y express npm WARN saveError ENOENT: no such file or directory, open '/home/ubuntu/nodejs/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/ubuntu/nodejs/package.json' npm WARN nodejs No description npm WARN nodejs No repository field. npm WARN nodejs No README data npm WARN nodejs No license field. + express@4.16.4 added 45 packages from 35 contributors and audited 158 packages in 2.19s found 0 vulnerabilities | cs |
29.
: forever 패키지 설치
1 2 3 4 5 6 7 8 | $ sudo npm install -y -g forever /usr/bin/forever -> /usr/lib/node_modules/forever/bin/forever npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/forever/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) + forever@0.15.3 added 242 packages from 153 contributors in 7.009s | cs |
* forever 패키지 같은 경우 설치 시 -g 옵션을 주어 전역 모드로 설치를 진행해야 함
30.
: Windows에서 Ubuntu로 파일 전송을 위한 WinSCP 설치 필요 시 하기 링크를 클릭
31.
: WinSCP 실행 후 접속하려고 하는 AWS Ubuntu 서버의 정보 기입 후 고급 버튼 클릭
: AWS Ubuntu 퍼블릭 DNS > 호스트 이름
: 사용자 이름 > ubuntu
32.
: 이전의 과정에서 기입 후 고급 버튼 클릭 시 다음과 같은 창이 출력
: SSH > 인증 > 개인키 파일, 이전 과정에서 pem -> ppk 변환한 파일의 경로를 지정 후 확인
33.
: 예 버튼을 클릭 후 접속
34.
: 좌측은 로컬 Windows, 우측은 클라우드 Ubuntu
* app.js 업로드 시 해당 파일에 database 접속 정보 확인 필요
35.
: 좌측의 해당 app.js 파일을 우클릭 하여 서버측으로 업로드 진행
36.
: 확인 버튼 클릭
37.
: putty 실행 후 해당 AWS Ubuntu 서버 접속 정보 기입
: ubuntu@퍼블릭 DNS > Host Name
38.
: SSH > Auth > 개인키 파일, 이전 과정에서 pem -> ppk 변환한 파일의 경로를 지정 후 Open 버튼 클릭
39.
40.
: 업로드한 node.js 작업 디렉터리로 이동
1 2 | $ cd nodejs/ | cs |
41.
: node 명령어로 app.js 실행
1 2 3 4 5 | $ sudo forever start -o output.log -e error.log app.js warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: app.js | cs |
42.
: AWS EC2 Ubuntu에 app.js의 서비스 주소로 요청 시 해당 RDS의 MySQL DB에서 데이터 조회 후 출력
* 위와 같이 DB 생성 및 데이터가 있음에도 불구하고 제대로 된 데이터를 출력하지 못한다면 아래와 같은 경우를 고려해야 함
: EC2 Ubuntu 인스턴스의 인바운드 규칙
: EC2 Ubuntu 내의 app.js 서비스 상태 및 포트
: RDS MySQL 인스턴스의 인바운드 규칙
'Cloud > Amazon Web Services' 카테고리의 다른 글
S3 버킷을 통해 정적 웹 사이트 호스팅 구성 및 Vue.js Web App 배포 (0) | 2018.10.20 |
---|---|
클라우드, S3를 사용한 정적 웹 페이지 구성 (0) | 2018.10.14 |
클라우드, RDS를 사용한 데이터베이스 구성 (0) | 2018.10.14 |
로컬, RDS를 사용한 데이터베이스 구성 (0) | 2018.10.13 |
로컬, EC2를 사용한 동적 웹 페이지 구성 (0) | 2018.10.13 |