
Lab. Build a Database Server
워크플로우
1. 보안 그룹 생성
2. 인스턴스 생성
3. RDS 구성
3.1. 서브넷 그룹 생성
3.2. 파라미터 그룹 생성
3.3. 옵션 그룹 생성
4. RDS 데이터베이스 생성
5. 웹 서버 접속 후 DB 정보 기록

#!/bin/bash -ex
# Install http php, mysql
dnf update
dnf install httpd php php-mysqlnd php-fpm php-json mariadb105 -y
#Web Service start
systemctl enable --now httpd
#Download web data
cd /var/www/html/
wget https://aws-largeobjects.s3.ap-northeast-2.amazonaws.com/AWS-AcademyACF/lab7-app-php7.zip
unzip lab7-app-php7.zip -d /var/www/html/
chown apache:root /var/www/html/rds.conf.php
서브넷 그룹
파라미터 그룹
옵션 그룹


자동으로 실행되는 작업
1. 테이블 생성
2. 샘플 데이터 입력
# 데이터베이스 접속
mysql -h lab-rds.cvkgguc0e04l.ap-northeast-2.rds.amazonaws.com -u admin
[root@ip-10-0-1-113 html]# cat sql/addressbook.sql
CREATE TABLE address (id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, lastname VARCHAR(30), firstname VARCHAR(30), phone VARCHAR(30), email VARCHAR(30));
INSERT INTO address (lastname, firstname, phone, email) VALUES ( "Johnson", "Roberto", "123-456-7890", "robertoj@someaddress.com"), ( "Doe", "Jane", "010-110-1101", "janed@someotheraddress.org" );
[root@ip-10-0-1-113 html]# nslookup lab-rds.cvkgguc0e04l.ap-northeast-2.rds.amazonaws.com
Server: 10.0.0.2
Address: 10.0.0.2#53
Non-authoritative answer:
Name: lab-rds.cvkgguc0e04l.ap-northeast-2.rds.amazonaws.com
Address: 10.0.3.174